[PATCH] libcamera: v4l2: Support changing poller thread for V4L2VideoDevice
Harvey Yang
chenghaoyang at chromium.org
Wed Oct 16 15:46:33 CEST 2024
From: Han-Lin Chen <hanlinchen at chromium.org>
Signed-off-by: Han-Lin Chen <hanlinchen at chromium.org>
Co-developed-by: Yudhistira Erlandinata <yerlandinata at chromium.org>
Signed-off-by: Yudhistira Erlandinata <yerlandinata at chromium.org>
Co-developed-by: Harvey Yang <chenghaoyang at chromium.org>
Signed-off-by: Harvey Yang <chenghaoyang at chromium.org>
---
include/libcamera/internal/v4l2_videodevice.h | 2 ++
src/libcamera/v4l2_videodevice.cpp | 13 +++++++++++++
2 files changed, 15 insertions(+)
diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h
index f021c2a01..f8d017b01 100644
--- a/include/libcamera/internal/v4l2_videodevice.h
+++ b/include/libcamera/internal/v4l2_videodevice.h
@@ -232,6 +232,8 @@ public:
V4L2PixelFormat toV4L2PixelFormat(const PixelFormat &pixelFormat) const;
+ void changePollerThread(Thread *thread);
+
protected:
std::string logPrefix() const override;
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 14eba0561..fc6b88ec1 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -2120,6 +2120,19 @@ V4L2PixelFormat V4L2VideoDevice::toV4L2PixelFormat(const PixelFormat &pixelForma
return {};
}
+/**
+ * \brief Move the event notifier and timer to \a thread
+ * \param[in] thread The thread to poll on
+ */
+void V4L2VideoDevice::changePollerThread(Thread *thread)
+{
+ if (!isOpen())
+ return;
+
+ fdBufferNotifier_->moveToThread(thread);
+ watchdog_.moveToThread(thread);
+}
+
/**
* \class V4L2M2MDevice
* \brief Memory-to-Memory video device
--
2.47.0.rc1.288.g06298d1525-goog
More information about the libcamera-devel
mailing list