summaryrefslogtreecommitdiff
path: root/drivers/media/common/videobuf2/videobuf2-v4l2.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2019-01-24 06:47:49 -0200
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-01-31 09:26:55 -0200
commit03535e7a3a9937da99ee18304309e0574d2504fc (patch)
treed6fe727fbb0b3905844e7fd1aac29bb19220c9d6 /drivers/media/common/videobuf2/videobuf2-v4l2.c
parent04bde67410bfff52958298e831fc5c7db04abe2d (diff)
media: vb2: vb2_find_timestamp: drop restriction on buffer state
There really is no reason why vb2_find_timestamp can't just find buffers in any state. Drop that part of the test. This also means that vb->timestamp should only be set to 0 when the driver doesn't copy timestamps. This change allows for more efficient pipelining (i.e. you can use a buffer for a reference frame even when it is queued). Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Alexandre Courbot <acourbot@chromium.org> Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/common/videobuf2/videobuf2-v4l2.c')
-rw-r--r--drivers/media/common/videobuf2/videobuf2-v4l2.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
index 75ea90e795d8..2f3b3ca5bde6 100644
--- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
+++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
@@ -567,7 +567,7 @@ static int __fill_vb2_buffer(struct vb2_buffer *vb, struct vb2_plane *planes)
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
unsigned int plane;
- if (!vb->vb2_queue->is_output || !vb->vb2_queue->copy_timestamp)
+ if (!vb->vb2_queue->copy_timestamp)
vb->timestamp = 0;
for (plane = 0; plane < vb->num_planes; ++plane) {
@@ -594,14 +594,9 @@ int vb2_find_timestamp(const struct vb2_queue *q, u64 timestamp,
{
unsigned int i;
- for (i = start_idx; i < q->num_buffers; i++) {
- struct vb2_buffer *vb = q->bufs[i];
-
- if ((vb->state == VB2_BUF_STATE_DEQUEUED ||
- vb->state == VB2_BUF_STATE_DONE) &&
- vb->timestamp == timestamp)
+ for (i = start_idx; i < q->num_buffers; i++)
+ if (q->bufs[i]->timestamp == timestamp)
return i;
- }
return -1;
}
EXPORT_SYMBOL_GPL(vb2_find_timestamp);