[libcamera-devel] [RFC 0/2] android: Introduce CameraWorker
Jacopo Mondi
jacopo at jmondi.org
Tue Oct 6 18:06:35 CEST 2020
This two small patches, sent as RFC mostly for comments on the design,
implement a worker in the libcamera HAL that is used to handle synchronization
fences before queueing a Request to the libcamera::Camera.
The camera framework provides, for each buffer part of a capture request
an acquisition fence the camera HAL is supposed to wait on before using
the buffer. The wait procedure cannot be performed in the Camera HAL thread, as
the HAL runs in the global CameraManager thread.
As fences are handled through a simple poll, it would be possible to install
a Notifier for each fence and handle their completion through a Signal in the
CameraDevice. Although this would make the class over-complicated.
Introducing a worker that synchronously waits on fences using its own thread
is a cleaner design a provides a cleaner interface for the CameraDevice.
The waitFence() function implementes the same mechanism as the libdrm provided
sync_wait() function without introducing an explicit dependency in libcamera.
Jacopo Mondi (2):
android: camera_worker: Introduce CameraWorker
android: camera_device: Queue request to Worker
src/android/camera_device.cpp | 21 ++++------
src/android/camera_device.h | 3 ++
src/android/camera_worker.cpp | 67 +++++++++++++++++++++++++++++++
src/android/camera_worker.h | 75 +++++++++++++++++++++++++++++++++++
src/android/meson.build | 1 +
5 files changed, 154 insertions(+), 13 deletions(-)
create mode 100644 src/android/camera_worker.cpp
create mode 100644 src/android/camera_worker.h
--
2.28.0
More information about the libcamera-devel
mailing list