@@ -1146,25 +1146,8 @@ void CameraDevice::requestComplete(Request *request)
* The buffer status is set to Success and later changed to Error if
* post-processing/compression fails.
*/
- for (auto &buffer : descriptor->buffers_) {
- CameraStream *stream = buffer.stream;
-
- /*
- * Streams of type Direct have been queued to the
- * libcamera::Camera and their acquire fences have
- * already been waited on by the library.
- *
- * Acquire fences of streams of type Internal and Mapped
- * will be handled during post-processing.
- */
- if (stream->type() == CameraStream::Type::Direct) {
- /* If handling of the fence has failed restore buffer.fence. */
- std::unique_ptr<Fence> fence = buffer.frameBuffer->releaseFence();
- if (fence)
- buffer.fence = fence->release();
- }
+ for (auto &buffer : descriptor->buffers_)
buffer.status = Camera3RequestDescriptor::Status::Success;
- }
/*
* If the Request has failed, abort the request by notifying the error
@@ -10,6 +10,7 @@
#include <libcamera/base/span.h>
#include "camera_buffer.h"
+#include "camera_stream.h"
using namespace libcamera;
@@ -195,6 +196,18 @@ Camera3RequestDescriptor::StreamBuffer::operator=(Camera3RequestDescriptor::Stre
camera3_stream_buffer_t Camera3RequestDescriptor::StreamBuffer::prepareToReturn()
{
+ /*
+ * Streams of type Direct have a non-nullptr `frameBuffer` and
+ * have been queued to the libcamera::Camera and their acquire
+ * fences have already been waited on by the library.
+ */
+ if (frameBuffer) {
+ /* If handling of the fence has failed restore buffer.fence. */
+ auto f = frameBuffer->releaseFence();
+ if (f)
+ fence = f->release();
+ }
+
/*
* Pass the buffer fence back to the camera framework as
* a release fence. This instructs the framework to wait
It is sufficient to restore the fence for returning it to the camera framework just before the returned `camera3_stream_buffer_t` is constructed, so do that. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- src/android/camera_device.cpp | 19 +------------------ src/android/camera_request.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 18 deletions(-)