[v2,0/3] Add generic V4L2 Events support
mbox series

Message ID 20261005-v4l2-events-v2-0-e4883190489d@ideasonboard.com
Headers show
Series
  • Add generic V4L2 Events support
Related show

Message

Daniel Scally Oct. 5, 2026, 3:40 p.m. UTC
At present class V4L2Device allows subscriptions to V4L2 Events of
type V4L2_EVENT_FRAME_SYNC through a very specific API; support is
verified with "supportsFrameSyncEvents()" and subscription enabled
with "setFrameStartEnabled()". The arrival of an event is signalled
with a Signal<uint32_t> which passes the frame sequence number to
the slot.

This is adequate, but limited, and expansion to support other event
types in a similar manner would be quite clunky. This series adapts
the event support to be more generic with the aim of facilitating
easy use of other event types.

My plan was originally to just rename the functions and parametise
them such that support for a given event type could be checked and
enabled, however the fact that the existing frameStart Signal takes
only a uint32_t as parameter means it cannot be renamed to apply to
other events too, as the details of the other event types could not
be conveyed through a single uint32_t. Having separate Signals for
each event type seems ugly, and so this series instead uses a single
Signal<const v4l2_event &> and lets the Slot deal with figuring out
which type of event it is.

Thanks
Dan

Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
---
Changes in v2:
- Drops the V4L2Event and V4L2EventSubscription classes and just uses
  the kernel uAPI types directly in the pipeline handlers
- Link to v2: https://patchwork.libcamera.org/project/libcamera/list/?series=6209

---
Daniel Scally (3):
      libcamera: v4l2_device: Make supportsFrameStartEvent() generic
      libcamera: v4l2_device: Emit signals for V4L2Events generically
      libcamera: v4l2_device: Make setFrameStartEnabled() generic

 include/libcamera/internal/v4l2_device.h           |  9 ++--
 src/libcamera/pipeline/ipu3/cio2.cpp               |  9 +++-
 src/libcamera/pipeline/ipu3/cio2.h                 |  4 +-
 src/libcamera/pipeline/ipu3/ipu3.cpp               | 18 ++++---
 src/libcamera/pipeline/mali-c55/mali-c55.cpp       | 28 +++++++---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp           | 24 +++++++--
 .../pipeline/rpi/common/pipeline_base.cpp          | 21 +++++---
 src/libcamera/pipeline/rpi/common/pipeline_base.h  |  4 +-
 src/libcamera/pipeline/simple/simple.cpp           | 34 +++++++++---
 src/libcamera/v4l2_device.cpp                      | 61 ++++++++++------------
 10 files changed, 140 insertions(+), 72 deletions(-)
---
base-commit: 279d355ef8f7a4f98bb0a3004c0f788387814506
change-id: 20260918-v4l2-events-3e74a7ae6862

Best regards,