[PATCH 4/5] camera: Use invokeMethod() for pipe_->acquire() and pipe_->release()
Hans de Goede
hdegoede at redhat.com
Tue Aug 20 21:50:15 CEST 2024
Some pipeline handlers may want to open / close /dev/video# nodes
from pipe_->acquireDevices() / pipe_->releaseDevices().
V4L2VideoDevice::open() creates an EventNotifier, this notifier needs
to be created from the CameraManager thread.
Use invokeMethod() for pipe_->acquire() and pipe_->release() so that
any EventNotifiers created are created from the CameraManager thread
context.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
src/libcamera/camera.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 4e393f89..61925e83 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -995,7 +995,8 @@ int Camera::acquire()
if (ret < 0)
return ret == -EACCES ? -EBUSY : ret;
- if (!d->pipe_->acquire(this)) {
+ if (!d->pipe_->invokeMethod(&PipelineHandler::acquire,
+ ConnectionTypeBlocking, this)) {
LOG(Camera, Info)
<< "Pipeline handler in use by another process";
return -EBUSY;
@@ -1030,7 +1031,8 @@ int Camera::release()
return ret == -EACCES ? -EBUSY : ret;
if (d->isAcquired())
- d->pipe_->release(this);
+ d->pipe_->invokeMethod(&PipelineHandler::release,
+ ConnectionTypeBlocking, this);
d->setState(Private::CameraAvailable);
--
2.46.0
More information about the libcamera-devel
mailing list