media: zoran: use u64 for the timestamp internally

Just like vb2 does, use u64 internally to store the timestamps
of the buffers. Only convert to timeval when interfacing with
userspace.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
Hans Verkuil 2019-01-21 08:32:28 -05:00 committed by Mauro Carvalho Chehab
parent 459d2a5d1e
commit 7b6b9a8c36
3 changed files with 5 additions and 5 deletions

View File

@ -35,7 +35,7 @@ struct zoran_sync {
unsigned long frame; /* number of buffer that has been free'd */ unsigned long frame; /* number of buffer that has been free'd */
unsigned long length; /* number of code bytes in buffer (capture only) */ unsigned long length; /* number of code bytes in buffer (capture only) */
unsigned long seq; /* frame sequence number */ unsigned long seq; /* frame sequence number */
struct timeval timestamp; /* timestamp */ u64 ts; /* timestamp */
}; };

View File

@ -1151,7 +1151,7 @@ zoran_reap_stat_com (struct zoran *zr)
} }
frame = zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME]; frame = zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME];
buffer = &zr->jpg_buffers.buffer[frame]; buffer = &zr->jpg_buffers.buffer[frame];
v4l2_get_timestamp(&buffer->bs.timestamp); buffer->bs.ts = ktime_get_ns();
if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) { if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) {
buffer->bs.length = (stat_com & 0x7fffff) >> 1; buffer->bs.length = (stat_com & 0x7fffff) >> 1;
@ -1389,7 +1389,7 @@ zoran_irq (int irq,
zr->v4l_buffers.buffer[zr->v4l_grab_frame].state = BUZ_STATE_DONE; zr->v4l_buffers.buffer[zr->v4l_grab_frame].state = BUZ_STATE_DONE;
zr->v4l_buffers.buffer[zr->v4l_grab_frame].bs.seq = zr->v4l_grab_seq; zr->v4l_buffers.buffer[zr->v4l_grab_frame].bs.seq = zr->v4l_grab_seq;
v4l2_get_timestamp(&zr->v4l_buffers.buffer[zr->v4l_grab_frame].bs.timestamp); zr->v4l_buffers.buffer[zr->v4l_grab_frame].bs.ts = ktime_get_ns();
zr->v4l_grab_frame = NO_GRAB_ACTIVE; zr->v4l_grab_frame = NO_GRAB_ACTIVE;
zr->v4l_pend_tail++; zr->v4l_pend_tail++;
} }

View File

@ -1354,7 +1354,7 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh,
fh->buffers.buffer[num].state == BUZ_STATE_USER) { fh->buffers.buffer[num].state == BUZ_STATE_USER) {
buf->sequence = fh->buffers.buffer[num].bs.seq; buf->sequence = fh->buffers.buffer[num].bs.seq;
buf->flags |= V4L2_BUF_FLAG_DONE; buf->flags |= V4L2_BUF_FLAG_DONE;
buf->timestamp = fh->buffers.buffer[num].bs.timestamp; buf->timestamp = ns_to_timeval(fh->buffers.buffer[num].bs.ts);
} else { } else {
buf->flags |= V4L2_BUF_FLAG_QUEUED; buf->flags |= V4L2_BUF_FLAG_QUEUED;
} }
@ -1388,7 +1388,7 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh,
if (fh->buffers.buffer[num].state == BUZ_STATE_DONE || if (fh->buffers.buffer[num].state == BUZ_STATE_DONE ||
fh->buffers.buffer[num].state == BUZ_STATE_USER) { fh->buffers.buffer[num].state == BUZ_STATE_USER) {
buf->sequence = fh->buffers.buffer[num].bs.seq; buf->sequence = fh->buffers.buffer[num].bs.seq;
buf->timestamp = fh->buffers.buffer[num].bs.timestamp; buf->timestamp = ns_to_timeval(fh->buffers.buffer[num].bs.ts);
buf->bytesused = fh->buffers.buffer[num].bs.length; buf->bytesused = fh->buffers.buffer[num].bs.length;
buf->flags |= V4L2_BUF_FLAG_DONE; buf->flags |= V4L2_BUF_FLAG_DONE;
} else { } else {