Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] media: Add V4L2_EVENT_BUF_PROGRESS and use it in j721e-csi2rx
@ 2026-11-29 13:28 Siddharth Vadapalli
  2026-11-29 13:28 ` [PATCH 1/3] media: v4l2: Add V4L2_EVENT_BUF_PROGRESS to report progress of capture Siddharth Vadapalli
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Siddharth Vadapalli @ 2026-11-29 13:28 UTC (permalink / raw)
  To: mchehab, jai.luthra, nicolas.dufresne, detlev.casanova,
	hverkuil+cisco, sakari.ailus, richard.leitner, jackson.lee
  Cc: linux-media, linux-arm-kernel, devarsht, vigneshr, srk,
	s-vadapalli

Hello,

This series adds support for processing sub-frames of a capture buffer
before the whole buffer has been captured, in order to reduce the latency
of video pipelines by a large part of a frame period.

A capture buffer is only returned by VIDIOC_DQBUF once the whole frame has
been captured, and no generic mechanism exists to tell userspace how much
of the buffer has been written. The series adds:

1. V4L2_EVENT_BUF_PROGRESS, a generic event which reports the number of
   bytes from the start of a buffer that have been written so far.
2. V4L2_CID_BUF_PROGRESS_SIZE and V4L2_CID_BUF_PROGRESS_INTERVAL, which
   select the granularity of the event in lines and the interval at which
   a driver that has to sample the progress does so.
3. Support in the TI J721E CSI2RX driver. A single DMA descriptor is used
   for each frame, which only completes at the end of the frame. Hence,
   the progress is sampled periodically using dmaengine_tx_status() from
   a high resolution timer.

The vb2 buffer life cycle is not changed. A buffer is still returned by
VIDIOC_DQBUF at the end of the frame, and the last event for a buffer that
completed successfully is queued before that.

Series is based on linux-next tagged next-20261127.

Series has been tested on the AM62A7-SK board with the AM62Ax SoC of
Texas Instruments connected to the OV5640 Sensor.

Timestamping the v4l2 EVENTS without sub-frames enabled shows about 33
milliseconds of interval between frames corresponding to the 30 FPS
frame-rate for a 1280x720 resolution. Enabling sub-frames with each
sub-frame being 10 lines and the polling interval for HRTIMERS being
100 microseconds using the following commands:
v4l2-ctl -d /dev/video3 --set-ctrl=buffer_progress_size=10
v4l2-ctl -d /dev/video3 --set-ctrl=buffer_progress_interval=100
shows each sub-frame being queued to the v4l2 event queue every
258 microseconds on average (with a total of 72 such sub-frames
i.e. 720 / 10) resulting in the entire frame now being queued by
18.5 milliseconds and a blanking period of 14.8 milliseconds.
This not only proves sub-frame queueing to v4l2 event queue but also
shows that the OV5640 sensor which also supports 60 FPS seems to have
the frame ready by about 18.5 milliseconds even when operating at 30 FPS.

Early processing of the sub-frames by userspace applications not only
reduce the latency but also provide a safe guard-band when the Sensor has
a blanking period as seen in the specific experimental setup described
above. Given the benefits and the use-cases that can be enabled with this
series, I hope to receive feedback on the implementation with the
objective of eventually having it supported in Mainline Linux.

Regards,
Siddharth.

Siddharth Vadapalli (3):
  media: v4l2: Add V4L2_EVENT_BUF_PROGRESS to report progress of capture
  media: v4l2-ctrls: Add buffer progress controls for sub-frame
    functionality
  media: ti: j721e-csi2rx: Generate capture-progress events for
    sub-frames

 .../userspace-api/media/v4l/control.rst       |  21 ++
 .../media/v4l/videodev2.h.rst.exceptions      |   1 +
 .../media/v4l/vidioc-dqevent.rst              |  74 ++++++
 .../platform/ti/j721e-csi2rx/j721e-csi2rx.c   | 251 +++++++++++++++++-
 drivers/media/v4l2-core/v4l2-ctrls-defs.c     |   2 +
 include/uapi/linux/v4l2-controls.h            |   5 +-
 include/uapi/linux/videodev2.h                |  18 ++
 7 files changed, 366 insertions(+), 6 deletions(-)

-- 
2.56.0



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-30 15:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 13:28 [PATCH 0/3] media: Add V4L2_EVENT_BUF_PROGRESS and use it in j721e-csi2rx Siddharth Vadapalli
2026-11-29 13:28 ` [PATCH 1/3] media: v4l2: Add V4L2_EVENT_BUF_PROGRESS to report progress of capture Siddharth Vadapalli
2026-11-30 15:21   ` Nicolas Dufresne
2026-11-29 13:28 ` [PATCH 2/3] media: v4l2-ctrls: Add buffer progress controls for sub-frame functionality Siddharth Vadapalli
2026-11-29 13:28 ` [PATCH 3/3] media: ti: j721e-csi2rx: Generate capture-progress events for sub-frames Siddharth Vadapalli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox