[libcamera-devel] [PATCH v2 0/8] Implement flush() camera operation

Jacopo Mondi jacopo at jmondi.org
Thu May 13 11:22:38 CEST 2021


Implement the flush() camera operation in Android CameraDevice class.

The series includes the already sent
"android: Rework request completion notification" patch slightly modified:

- set partial_results = 0 in case of error (as reported by cros_camera_test)
- on fatal ERROR_DEVICE notify() to the framework first then call Fatal. Record
  with a \todo the on-going discussion on the requirement to close the camera
  to handle failures gracefully.

To get to a successfull implementation of flush() a bit of preparatory work is
required as currently Requests that fails to queue to the pipeline handler are
not returned to the application. Add Request::cancel() and call it in the
PipelineHandler base class when calling queueRequestDevice() fails to allow
application to keep track of the queued requests.

On top of that, prepare the CameraDevice to support flush with a few clean-up
patches, then implement the operation.

No regression detected when running CTS in LIMITED mode.

Tested with cros_camera_test:

   # cros_camera_test --gtest_filter="Camera3FrameTest/Camera3FlushRequestsTest*"
   [==========] 12 tests from 1 test suite ran. (1380 ms total)
   [  PASSED  ] 12 tests.

v1->v2:
 - The majority of patches in the series have not been changed if not for
   collecting tags. However 8/8 which implement the actual flush() has been
   changed to address Hiro's comment about protecting close() and
   configureStreams() from being concurrently run with flush().

   - 8/8:
     - Introduce a new flushed_ condition variable to be used by close() and
       configureStreams() to be unlocked when flushing has terminated.

- The patches that introduce Request::cancel() has pending discussion with
  Hiro and Niklas. As they impact the libcamera API I'll wait for Laurent to
  chime-in.

Jacopo Mondi (8):
  android: Rework request completion notification
  libcamera: request: Add Request::cancel()
  libcamera: pipeline_handler: Notify Request queueing failure
  android: camera_device: Replace running_ with CameraState
  android: Replace scoped_lock<> with libcamera::MutexLocker
  android: Guard access to the camera state
  android: Rename CameraDevice::mutex_
  android: Implement flush() camera operation

 include/libcamera/request.h        |   1 +
 src/android/camera_device.cpp      | 261 +++++++++++++++++++++--------
 src/android/camera_device.h        |  22 ++-
 src/android/camera_ops.cpp         |   8 +-
 src/libcamera/pipeline_handler.cpp |  15 +-
 src/libcamera/request.cpp          |  30 ++++
 6 files changed, 261 insertions(+), 76 deletions(-)

--
2.31.1



More information about the libcamera-devel mailing list