From 16f3d2de50ffa35295240e247d8cc4cffabf1a53 Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Wed, 6 Apr 2022 13:35:52 +0100 Subject: libcamera: v4l2_videodevice: Add a dequeue timer Add a timer that gets reset on every buffer dequeue event. If the timeout expires, optionally call a slot in the pipeline handler to handle this condition. This may be useful in detecting and handling stalls in either the hardware or device driver. Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- include/libcamera/internal/v4l2_videodevice.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index cfeae7bd..9c9493cc 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -20,7 +20,9 @@ #include #include #include +#include #include +#include #include #include @@ -217,6 +219,9 @@ public: int streamOn(); int streamOff(); + void setDequeueTimeout(utils::Duration timeout); + Signal<> dequeueTimeout; + static std::unique_ptr fromEntityName(const MediaDevice *media, const std::string &entity); @@ -253,6 +258,8 @@ private: void bufferAvailable(); FrameBuffer *dequeueBuffer(); + void watchdogExpired(); + V4L2Capability caps_; V4L2DeviceFormat format_; const PixelFormatInfo *formatInfo_; @@ -266,6 +273,9 @@ private: EventNotifier *fdBufferNotifier_; State state_; + + Timer watchdog_; + utils::Duration watchdogDuration_; }; class V4L2M2MDevice -- cgit v1.2.1