[PATCHv2 00/12] Add support for read-only requests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Read-only requests do not contain any configuration values when queued
(only buffers can be part of a read-only request), but they do allow the
driver to associate additional information with the completed request.

This is useful to e.g. add per-frame metadata such as HDMI InfoFrames to
a captured buffer.

While working on this I discovered that the Request API is also missing a
feature: if userspace did not set any controls, then the request object
will not contain a control object (that's created only if the user sets a
control in the request).

This is fine for e.g. stateless codecs since they require that each request
contains controls, so this is always done. And this is also the reason that
this hasn't been a problem before, since the Request API is almost exclusively
used by stateless codecs.

But for e.g. vivid this means that the completed request does not contain
any controls in the request with the values of the time that the frame was
captured (or output).

In addition, if a driver needs to set a status control, then that control
won't be part of the request either.

This series adds a v4l2_ctrl_request_add_handler() function that can be
called in the req_validate() callback of the request. If the request
doesn't contain a control object, then it will add a new one.

This series adds read-only request support to vivid, vim2m and vicodec, and
adds new helper functions to vb2 (vb2_request_buffer_first) and v4l2-mem2mem.c
(v4l2_m2m_request_validate).

In addition, the first patch of this series adds debugfs support to the
media device to be able to keep track of outstanding requests and request
objects. Without this it is next to impossible to check if all requests and
request objects are properly released after all file handles are closed.

This series supersedes this old RFC series:

https://patchwork.linuxtv.org/project/linux-media/cover/20200728094851.121933-1-hverkuil-cisco@xxxxxxxxx/

I'll also post an RFC patch for v4l-utils that adds support for this to
v4l2-ctl and v4l2-compliance.

Regards,

	Hans


Hans Verkuil (12):
  media/mc: keep track of outstanding requests
  vivid: add read-only int32 control
  media: document read-only requests
  videodev2.h: add V4L2_BUF_CAP_SUPPORTS_RO_REQUESTS
  videobuf2-core: add vb2_request_buffer_first()
  v4l2-ctrls.c: add v4l2_ctrl_request_add_handler
  vivid: call v4l2_ctrl_request_add_handler()
  vivid: add ro_requests module option
  v4l2-mem2mem.c: add v4l2_m2m_request_validate()
  vim2m: use v4l2_m2m_request_validate()
  vim2m: support read-only requests on the capture queue
  vicodec: add support for read-only requests

 Documentation/admin-guide/media/vivid.rst     | 10 +++
 .../mediactl/media-request-ioc-queue.rst      |  5 ++
 .../media/mediactl/request-api.rst            | 11 +++
 .../media/v4l/vidioc-reqbufs.rst              |  6 ++
 .../media/common/videobuf2/videobuf2-core.c   | 22 ++++++
 .../media/common/videobuf2/videobuf2-v4l2.c   |  4 +-
 drivers/media/mc/mc-device.c                  | 27 +++++++
 drivers/media/mc/mc-devnode.c                 | 13 ++++
 drivers/media/mc/mc-request.c                 |  8 ++-
 .../media/test-drivers/vicodec/vicodec-core.c | 70 +++++++++----------
 drivers/media/test-drivers/vim2m.c            | 13 +++-
 drivers/media/test-drivers/vivid/vivid-core.c | 52 ++++++++++++++
 drivers/media/test-drivers/vivid/vivid-core.h |  1 +
 .../media/test-drivers/vivid/vivid-ctrls.c    | 13 ++++
 .../test-drivers/vivid/vivid-kthread-cap.c    | 10 +--
 drivers/media/v4l2-core/v4l2-ctrls.c          | 35 ++++++++++
 drivers/media/v4l2-core/v4l2-mem2mem.c        | 45 ++++++++++--
 include/media/media-device.h                  |  9 +++
 include/media/media-devnode.h                 |  4 ++
 include/media/media-request.h                 |  2 +
 include/media/v4l2-ctrls.h                    | 21 ++++++
 include/media/v4l2-mem2mem.h                  | 28 +++++++-
 include/media/videobuf2-core.h                |  8 +++
 include/uapi/linux/videodev2.h                |  1 +
 24 files changed, 368 insertions(+), 50 deletions(-)

-- 
2.27.0




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux