[PATCH 2/3] media: v4l2-ctrls: Add buffer progress controls for sub-frame functionality
Siddharth Vadapalli
s-vadapalli at ti.com
Sun Nov 29 05:28:16 PST 2026
The V4L2_EVENT_BUF_PROGRESS event is generated whenever N lines in a
capture buffer are ready to be consumed by a subscriber. Two controls
associated with this event are:
1. Number of lines 'N' after which the event should be generated.
2. Interval 'I' at which the buffer progress has to be queried by the
driver to detect the readiness of the next 'N' lines.
Hence, add V4L2_CID_BUF_PROGRESS_SIZE and V4L2_CID_BUF_PROGRESS_INTERVAL
controls which respectively correspond to the controls described above.
Since the event is generated by the capture DMA engine and not by the
image source, the controls are not specific to cameras. Hence, add them to
the user control class instead of the camera control class.
Signed-off-by: Siddharth Vadapalli <s-vadapalli at ti.com>
---
.../userspace-api/media/v4l/control.rst | 21 +++++++++++++++++++
drivers/media/v4l2-core/v4l2-ctrls-defs.c | 2 ++
include/uapi/linux/v4l2-controls.h | 5 ++++-
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/Documentation/userspace-api/media/v4l/control.rst b/Documentation/userspace-api/media/v4l/control.rst
index 19372bb32c4b..7dcf7c80a0d8 100644
--- a/Documentation/userspace-api/media/v4l/control.rst
+++ b/Documentation/userspace-api/media/v4l/control.rst
@@ -316,6 +316,27 @@ Control IDs
set the alpha component value of all pixels for further processing
in the device.
+``V4L2_CID_BUF_PROGRESS_SIZE`` ``(integer)``
+ Granularity of the :ref:`V4L2_EVENT_BUF_PROGRESS <event-type>` event, in
+ lines. While a capture buffer is being filled, the driver queues the
+ event each time at least this many additional complete lines have been
+ written to it. The event that reports the completion of the buffer is
+ always queued, even if fewer lines were written since the previous
+ event. If the value is not smaller than the height of the frame, the
+ only event that is queued for a buffer is the one that reports its
+ completion. The value 0, which is the default, disables the event. The
+ control is only supported by drivers that generate the event, and its
+ value cannot be changed while the device is streaming.
+
+``V4L2_CID_BUF_PROGRESS_INTERVAL`` ``(integer)``
+ Interval, in microseconds, at which a driver that has to sample the
+ progress of the buffer being filled does so for the
+ :ref:`V4L2_EVENT_BUF_PROGRESS <event-type>` event. A shorter interval
+ reduces the delay between lines being written and the event being
+ queued, at the cost of a higher CPU load. The control is only supported
+ by drivers that have to sample the progress, and its value cannot be
+ changed while the device is streaming.
+
``V4L2_CID_LASTP1``
End of the predefined control IDs (currently
``V4L2_CID_ALPHA_COMPONENT`` + 1).
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
index e062f2088490..e9bbe40e8d33 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
@@ -831,6 +831,8 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_ALPHA_COMPONENT: return "Alpha Component";
case V4L2_CID_COLORFX_CBCR: return "Color Effects, CbCr";
case V4L2_CID_COLORFX_RGB: return "Color Effects, RGB";
+ case V4L2_CID_BUF_PROGRESS_SIZE: return "Buffer Progress Size";
+ case V4L2_CID_BUF_PROGRESS_INTERVAL: return "Buffer Progress Interval";
/*
* Codec controls
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index d17e41d51d2e..4e05f63bcf12 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -110,8 +110,11 @@ enum v4l2_colorfx {
#define V4L2_CID_COLORFX_CBCR (V4L2_CID_BASE+42)
#define V4L2_CID_COLORFX_RGB (V4L2_CID_BASE+43)
+#define V4L2_CID_BUF_PROGRESS_SIZE (V4L2_CID_BASE+44)
+#define V4L2_CID_BUF_PROGRESS_INTERVAL (V4L2_CID_BASE+45)
+
/* last CID + 1 */
-#define V4L2_CID_LASTP1 (V4L2_CID_BASE+44)
+#define V4L2_CID_LASTP1 (V4L2_CID_BASE+46)
/* USER-class private control IDs */
--
2.56.0
More information about the linux-arm-kernel
mailing list