From 2eca16b674ff9e849d7681fbc670325de87ad0a2 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Fri, 24 Sep 2021 17:59:20 +0200 Subject: android: Wait on fences in CameraStream::process() Acquire fences for streams of type Mapped generated by post-processing are not correctly handled and are currently ignored by the camera HAL. Fix this by adding CameraStream::waitFence(), executed before starting the post-processing in CameraStream::process(). The change applies to all streams generated by post-processing (Mapped and Internal) but currently acquire fences of Internal streams are handled by the camera worker. Postpone that to post-processing time by passing -1 to the Worker for Internal streams. Also correct the release_fence handling for failed captures, as the framework requires the release fences to be set to the acquire fence value if the acquire fence has not been waited on. Signed-off-by: Jacopo Mondi Reviewed-by: Hirokazu Honda Tested-by: Umang Jain Reviewed-by: Umang Jain Reviewed-by: Laurent Pinchart --- src/android/camera_stream.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/android/camera_stream.h') diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h index 2dab6c3a..03ecfa94 100644 --- a/src/android/camera_stream.h +++ b/src/android/camera_stream.h @@ -119,13 +119,15 @@ public: int configure(); int process(const libcamera::FrameBuffer &source, - buffer_handle_t camera3Dest, + camera3_stream_buffer_t &camera3Buffer, const CameraMetadata &requestMetadata, CameraMetadata *resultMetadata); libcamera::FrameBuffer *getBuffer(); void putBuffer(libcamera::FrameBuffer *buffer); private: + int waitFence(int fence); + CameraDevice *const cameraDevice_; const libcamera::CameraConfiguration *config_; const Type type_; -- cgit v1.2.1