media: v4l2-mem2mem: support held capture buffers
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Fri, 11 Oct 2019 09:32:41 +0000 (06:32 -0300)
committerpopcornmix <popcornmix@gmail.com>
Wed, 1 Jul 2020 15:33:30 +0000 (16:33 +0100)
commit120686fa6ad0bf690a3980edfdf0ebfdbc85188b
tree3ba669a6dc2b8ce29913e1b6265eea35a7e85fad
parent5e73dd2bf42358448ca3e2ccd5625041208581de
media: v4l2-mem2mem: support held capture buffers

Commit f8cca8c97a63d77f48334cde81d15014f43530ef upstream.

Check for held buffers that are ready to be returned to vb2 in
__v4l2_m2m_try_queue(). This avoids drivers having to handle this
case.

Add v4l2_m2m_buf_done_and_job_finish() to correctly return source
and destination buffers and mark the job as finished while taking
a held destination buffer into account (i.e. that buffer won't be
returned). This has to be done while job_spinlock is held to avoid
race conditions.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/v4l2-core/v4l2-mem2mem.c
include/media/v4l2-mem2mem.h