summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2022-04-06 13:35:52 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-04-06 15:44:32 +0300
commit16f3d2de50ffa35295240e247d8cc4cffabf1a53 (patch)
tree846a0a74e66389f4528e976bee0ea4ca76fecff2 /include
parent226792a1411bd485e087bf40e241611966099b52 (diff)
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 <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/internal/v4l2_videodevice.h10
1 files changed, 10 insertions, 0 deletions
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 <libcamera/base/class.h>
#include <libcamera/base/log.h>
#include <libcamera/base/signal.h>
+#include <libcamera/base/timer.h>
#include <libcamera/base/unique_fd.h>
+#include <libcamera/base/utils.h>
#include <libcamera/color_space.h>
#include <libcamera/framebuffer.h>
@@ -217,6 +219,9 @@ public:
int streamOn();
int streamOff();
+ void setDequeueTimeout(utils::Duration timeout);
+ Signal<> dequeueTimeout;
+
static std::unique_ptr<V4L2VideoDevice>
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