Discussion of libcamera::Camera::stop() and flush

Cheng-Hao Yang chenghaoyang at chromium.org
Tue Nov 19 06:42:30 CET 2024


Hi upstream developers,

During the review of the pending mtkisp7 patches to be upstreamed, I
found one [1] that I don't think you'd like.

I don't think Android adapter's flush() is correctly implemented now,
as it requires all requests & buffers to be returned from the HAL [2].

In the current implementation [3] though, it only stops processing new
requests and stops the camera, which basically stops all processing
and does nothing else.

IIUC, in V4L2, stopping wouldn't trigger any returning signal
emission. However, Android Camera HAL v3 (function flush()) still
expects requests and buffers being returned with success/failure
signals.

I also found Umang's patch [4] that adds a flushing mechanism in post
processing, while it's never enabled. Without using it, the current
mechanism is problematic that a flush call would drop buffers that are
still being post-processed.

In mtkisp7, we chose to wait for the completion of requests/buffers
before the return of the flush() function [1]. Also, the current
design of libcamera::Camera::stop() doesn't quite work with our Task &
Scheduler [5], so we have WIP CLs [6] to add
libcamera::Camera::flush() that hints a pipeline handler to abort
requests before calling stop().

Please check and share your thoughts about supporting Android
adapter's flushing mechanism. Thanks!

BR,
Harvey

[1]: https://chromium-review.googlesource.com/c/chromiumos/third_party/libcamera/+/5674665
[2]: https://android.googlesource.com/platform/hardware/interfaces/+/main/camera/device/3.2/ICameraDeviceSession.hal#283
[3]: https://git.libcamera.org/libcamera/libcamera.git/tree/src/android/camera_device.cpp#n418
[4]: https://git.libcamera.org/libcamera/libcamera.git/commit/src/android/camera_device.cpp?id=b1cefe38f360915ad597ab2934c009bd1e46d10d
[5]: https://patchwork.libcamera.org/patch/21029/
[6]: https://chromium-review.googlesource.com/c/chromiumos/third_party/libcamera/+/5553372/8


More information about the libcamera-devel mailing list