diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2019-10-11 12:32:44 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-10-21 13:42:01 +0300 |
commit | f07602ac388723233e9e3c5a05b54baf34e0a3e9 (patch) | |
tree | 10013d1eb5e989459c56b8f31911cf1690d4fcd6 /drivers/media/v4l2-core | |
parent | bef41d93aac64b54c3008ca6170bec54f85784f5 (diff) | |
download | linux-f07602ac388723233e9e3c5a05b54baf34e0a3e9.tar.xz |
media: v4l2-mem2mem: add new_frame detection
Drivers that support VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF
typically want to know if a new frame is started (i.e. the first
slice is about to be processed). Add a new_frame bool to v4l2_m2m_ctx
and set it accordingly.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-mem2mem.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index b46d2c388349..db07ef3bf3d0 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -319,8 +319,10 @@ static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev, goto job_unlock; } - if (src && dst && - dst->is_held && dst->vb2_buf.copied_timestamp && + m2m_ctx->new_frame = true; + + if (src && dst && dst->is_held && + dst->vb2_buf.copied_timestamp && dst->vb2_buf.timestamp != src->vb2_buf.timestamp) { dst->is_held = false; v4l2_m2m_dst_buf_remove(m2m_ctx); @@ -333,6 +335,11 @@ static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev, } } + if (src && dst && (m2m_ctx->cap_q_ctx.q.subsystem_flags & + VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF)) + m2m_ctx->new_frame = !dst->vb2_buf.copied_timestamp || + dst->vb2_buf.timestamp != src->vb2_buf.timestamp; + if (m2m_dev->m2m_ops->job_ready && (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) { dprintk("Driver not ready\n"); |