From patchwork Fri Nov 19 15:05:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dorota Czaplejewicz X-Patchwork-Id: 14661 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 058CDBDB13 for ; Fri, 19 Nov 2021 15:06:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 345E660371; Fri, 19 Nov 2021 16:06:15 +0100 (CET) Received: from comms.puri.sm (comms.puri.sm [159.203.221.185]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D175600B5 for ; Fri, 19 Nov 2021 16:06:13 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id 7B7CEDFE3F; Fri, 19 Nov 2021 07:06:11 -0800 (PST) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Koj4PoYKZs8s; Fri, 19 Nov 2021 07:06:10 -0800 (PST) Date: Fri, 19 Nov 2021 16:05:58 +0100 From: Dorota Czaplejewicz To: Librem5-team , libcamera-devel@lists.libcamera.org Message-ID: <20211119150421.974848-1-dorota.czaplejewicz@puri.sm> Organization: Purism MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] FrameBuffer: Make FrameBuffer::cancel private X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" FrameBuffer::cancel is not meant to be used by the API consumer. It was moved to FrameBuffer::Private::cancel . Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Dorota Czaplejewicz --- Hi, I'm sending this as discussed on the mailing list. Regards, Dorota include/libcamera/framebuffer.h | 2 -- include/libcamera/internal/framebuffer.h | 2 ++ src/libcamera/framebuffer.cpp | 16 ++++++++-------- src/libcamera/pipeline/ipu3/ipu3.cpp | 5 +++-- .../pipeline/raspberrypi/raspberrypi.cpp | 2 +- src/libcamera/pipeline/vimc/vimc.cpp | 3 ++- src/libcamera/request.cpp | 2 +- 7 files changed, 17 insertions(+), 15 deletions(-) diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h index 7f2f176a..367a8a71 100644 --- a/include/libcamera/framebuffer.h +++ b/include/libcamera/framebuffer.h @@ -66,8 +66,6 @@ public: unsigned int cookie() const { return cookie_; } void setCookie(unsigned int cookie) { cookie_ = cookie; } - void cancel() { metadata_.status = FrameMetadata::FrameCancelled; } - private: LIBCAMERA_DISABLE_COPY_AND_MOVE(FrameBuffer) diff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h index cd33c295..27676212 100644 --- a/include/libcamera/internal/framebuffer.h +++ b/include/libcamera/internal/framebuffer.h @@ -23,6 +23,8 @@ public: void setRequest(Request *request) { request_ = request; } bool isContiguous() const { return isContiguous_; } + void cancel() { LIBCAMERA_O_PTR()->metadata_.status = FrameMetadata::FrameCancelled; } + private: Request *request_; bool isContiguous_; diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp index 337ea115..dd344ed8 100644 --- a/src/libcamera/framebuffer.cpp +++ b/src/libcamera/framebuffer.cpp @@ -137,6 +137,14 @@ FrameBuffer::Private::Private() * \return True if the planes are stored contiguously in memory, false otherwise */ +/** + * \fn FrameBuffer::Private::cancel() + * \brief Marks the buffer as cancelled + * + * If a buffer is not used by a request, it shall be marked as cancelled to + * indicate that the metadata is invalid. + */ + /** * \class FrameBuffer * \brief Frame buffer data and its associated dynamic metadata @@ -305,12 +313,4 @@ Request *FrameBuffer::request() const * libcamera core never modifies the buffer cookie. */ -/** - * \fn FrameBuffer::cancel() - * \brief Marks the buffer as cancelled - * - * If a buffer is not used by a request, it shall be marked as cancelled to - * indicate that the metadata is invalid. - */ - } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index c65afdb2..f8516cba 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -27,6 +27,7 @@ #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/delayed_controls.h" #include "libcamera/internal/device_enumerator.h" +#include "libcamera/internal/framebuffer.h" #include "libcamera/internal/ipa_manager.h" #include "libcamera/internal/media_device.h" #include "libcamera/internal/pipeline_handler.h" @@ -816,7 +817,7 @@ void IPU3CameraData::cancelPendingRequests() for (auto it : request->buffers()) { FrameBuffer *buffer = it.second; - buffer->cancel(); + buffer->_d()->cancel(); pipe()->completeBuffer(request, buffer); } @@ -1333,7 +1334,7 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer) if (buffer->metadata().status == FrameMetadata::FrameCancelled) { for (auto it : request->buffers()) { FrameBuffer *b = it.second; - b->cancel(); + b->_d()->cancel(); pipe()->completeBuffer(request, b); } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 5e1f2273..b7cabf5e 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1573,7 +1573,7 @@ void RPiCameraData::clearIncompleteRequests() * request? If not, do so now. */ if (buffer->request()) { - buffer->cancel(); + buffer->_d()->cancel(); pipe()->completeBuffer(request, buffer); } } diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index e453091d..1ec814d1 100644 --- a/src/libcamera/pipeline/vimc/vimc.cpp +++ b/src/libcamera/pipeline/vimc/vimc.cpp @@ -32,6 +32,7 @@ #include "libcamera/internal/camera.h" #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/device_enumerator.h" +#include "libcamera/internal/framebuffer.h" #include "libcamera/internal/ipa_manager.h" #include "libcamera/internal/media_device.h" #include "libcamera/internal/pipeline_handler.h" @@ -574,7 +575,7 @@ void VimcCameraData::bufferReady(FrameBuffer *buffer) if (buffer->metadata().status == FrameMetadata::FrameCancelled) { for (auto it : request->buffers()) { FrameBuffer *b = it.second; - b->cancel(); + b->_d()->cancel(); pipe->completeBuffer(request, b); } diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp index 17fefab7..a4dbf750 100644 --- a/src/libcamera/request.cpp +++ b/src/libcamera/request.cpp @@ -304,7 +304,7 @@ void Request::cancel() ASSERT(status_ == RequestPending); for (FrameBuffer *buffer : pending_) { - buffer->cancel(); + buffer->_d()->cancel(); camera_->bufferCompleted.emit(this, buffer); }