[libcamera-devel] [PATCH 0/2] android: Introduce CameraWorker

Jacopo Mondi jacopo at jmondi.org
Fri Oct 9 15:39:54 CEST 2020


This two small patches 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 camera service thread.

The CameraWorker::Worker::waitFence() function implementes the same mechanism as
the libdrm provided sync_wait() function without introducing an explicit
dependency in libcamera.

Compared to the RFC version the following has changed:
- Add a start()/stop() function to start and stop the Worker thread and
  call them from the CameraDevice at Camera::stop() and Camera::start() time
- Add CaptureRequest::queue(Camera *camera) and CaptureRequest::fences()
  methods to remove friend statement in CaptureRequest
- Add more context to 1/2 commit message

Rework will be needed to rebase on the reusable Request patch.

Thanks
   j

Jacopo Mondi (2):
  android: camera_worker: Introduce CameraWorker
  android: camera_device: Queue request to Worker

 src/android/camera_device.cpp | 19 ++++----
 src/android/camera_device.h   |  3 ++
 src/android/camera_worker.cpp | 88 +++++++++++++++++++++++++++++++++++
 src/android/camera_worker.h   | 73 +++++++++++++++++++++++++++++
 src/android/meson.build       |  1 +
 5 files changed, 174 insertions(+), 10 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