linux_dsm_epyc7002/Documentation/media
John Sheu d644cca50f media: vb2: Allow reqbufs(0) with "in use" MMAP buffers
Videobuf2 presently does not allow VIDIOC_REQBUFS to destroy outstanding
buffers if the queue is of type V4L2_MEMORY_MMAP, and if the buffers are
considered "in use".  This is different behavior than for other memory
types and prevents us from deallocating buffers in following two cases:

1) There are outstanding mmap()ed views on the buffer. However even if
   we put the buffer in reqbufs(0), there will be remaining references,
   due to vma .open/close() adjusting vb2 buffer refcount appropriately.
   This means that the buffer will be in fact freed only when the last
   mmap()ed view is unmapped.

2) Buffer has been exported as a DMABUF. Refcount of the vb2 buffer
   is managed properly by VB2 DMABUF ops, i.e. incremented on DMABUF
   get and decremented on DMABUF release. This means that the buffer
   will be alive until all importers release it.

Considering both cases above, there does not seem to be any need to
prevent reqbufs(0) operation, because buffer lifetime is already
properly managed by both mmap() and DMABUF code paths. Let's remove it
and allow userspace freeing the queue (and potentially allocating a new
one) even though old buffers might be still in processing.

To let userspace know that the kernel now supports orphaning buffers
that are still in use, add a new V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS
to be set by reqbufs and create_bufs.

[p.zabel@pengutronix.de: added V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS,
 updated documentation, and added back debug message]

Signed-off-by: John Sheu <sheu@chromium.org>
Reviewed-by: Pawel Osciak <posciak@chromium.org>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: added V4L2-BUF-CAP-SUPPORTS-ORPHANED-BUFS ref]
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-23 06:41:39 -05:00
..
cec-drivers media: docs: don't show ToC for each part on PDF output 2017-09-05 06:27:50 -04:00
dvb-drivers media: docs: add documentation for frontend attach info 2017-11-30 04:19:04 -05:00
kapi media updates for v4.20-rc1 2018-10-31 10:53:29 -07:00
uapi media: vb2: Allow reqbufs(0) with "in use" MMAP buffers 2018-11-23 06:41:39 -05:00
v4l-drivers media: doc-rst: Fix broken references 2018-11-23 05:42:49 -05:00
.gitignore
audio.h.rst.exceptions media: dvb/audio.h: get rid of unused APIs 2018-07-30 16:21:49 -04:00
ca.h.rst.exceptions media: ca.h: get rid of CA_SET_PID 2017-09-05 06:06:56 -04:00
cec.h.rst.exceptions media: cec-ioc-dqevent.rst: fix typo 2017-09-23 07:40:25 -04:00
conf_nitpick.py
conf.py
dmx.h.rst.exceptions media: dvb: add continuity error indicators for memory mapped buffers 2018-02-23 05:28:41 -05:00
frontend.h.rst.exceptions media: dvb frontend docs: use kernel-doc documentation 2017-09-05 05:57:35 -04:00
index.rst media: index.rst: don't write "Contents:" on PDF output 2017-09-05 06:30:41 -04:00
intro.rst docs-rst: Don't use explicit Makefile rules to build SVG and DOT files 2017-03-13 16:41:22 -06:00
lirc.h.rst.exceptions media: rc docs: fix warning for RC_PROTO_IMON 2018-03-22 07:58:42 -04:00
Makefile docs-rst: Don't use explicit Makefile rules to build SVG and DOT files 2017-03-13 16:41:22 -06:00
media_kapi.rst media: docs: don't show ToC for each part on PDF output 2017-09-05 06:27:50 -04:00
media_uapi.rst media: docs: don't show ToC for each part on PDF output 2017-09-05 06:27:50 -04:00
media.h.rst.exceptions media: media.h.rst.exceptions: ignore MEDIA-ENT-F-DTV-DECODER 2018-07-27 07:02:53 -04:00
net.h.rst.exceptions
typical_media_device.svg media: svg files: simplify files 2017-07-18 11:53:43 -03:00
video.h.rst.exceptions media: dvb/video.h: get rid of unused APIs 2018-07-30 15:43:47 -04:00
videodev2.h.rst.exceptions media updates for v4.20-rc1 2018-10-31 10:53:29 -07:00