[libcamera-devel] [PATCH v3 0/1] android: Wait on acquisition fences in CameraStream

Jacopo Mondi jacopo at jmondi.org
Tue Sep 28 14:25:14 CEST 2021


An acquisition fence is associated to each camera3_stream_buffer_t part of a
capture request.

Streams generated by libcamera (Type::Direct) are queued to the
libcamera::Camera and their fences are waited on by the CameraWorker class.

Acquisition fences for Streams generated by post-processing have been so far
ignored and the fence was not closed, resulting in a leak that crashed the
camera service with:

 FATAL FileDescriptor file_descriptor.cpp:265 Failed to dup() fd: Too many open files

Fix this by instrumenting CameraStream to handle fences in the process()
function.

v3:
- Squash the two patches in one
- Set acquire_fence = -1 in post-processor
- Correct handling of buffer status in CameraDevice::requestCompleted()

v2:
- Handle ::Internal stream type and shuffle the patch order as suggested by
  Hiro.

Jacopo Mondi (1):
  android: Wait on fences in CameraStream::process()

 src/android/camera_device.cpp | 39 +++++++++++++++++++++++----
 src/android/camera_stream.cpp | 50 +++++++++++++++++++++++++++++++++--
 src/android/camera_stream.h   |  4 ++-
 3 files changed, 85 insertions(+), 8 deletions(-)

--
2.32.0



More information about the libcamera-devel mailing list