From patchwork Wed Mar 20 16:30:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 756 Return-Path: Received: from relay12.mail.gandi.net (relay12.mail.gandi.net [217.70.178.232]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 68D7E612E2 for ; Wed, 20 Mar 2019 17:30:34 +0100 (CET) Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 02D2D200008; Wed, 20 Mar 2019 16:30:33 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 20 Mar 2019 17:30:34 +0100 Message-Id: <20190320163055.22056-11-jacopo@jmondi.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320163055.22056-1-jacopo@jmondi.org> References: <20190320163055.22056-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 10/31] libcamera: ipu3: Implement buffer release X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 16:30:35 -0000 Release buffers on all video devices in the pipeline. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/ipu3/ipu3.cpp | 30 +++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 659a7ca4829f..965794494a4e 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -158,6 +158,7 @@ private: void registerCameras(); ImgUDevice imgus_[IPU3_IMGU_COUNT]; + std::shared_ptr cio2MediaDev_; std::shared_ptr imguMediaDev_; }; @@ -358,13 +359,32 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera, Stream *stream) int PipelineHandlerIPU3::freeBuffers(Camera *camera, Stream *stream) { IPU3CameraData *data = cameraData(camera); + V4L2Device *viewfinder = data->imgu->viewfinder; + V4L2Device *output = data->imgu->output; + V4L2Device *input = data->imgu->input; V4L2Device *cio2 = data->cio2.output; + V4L2Device *stat = data->imgu->stat; + int ret; - int ret = cio2->releaseBuffers(); - if (ret) { - LOG(IPU3, Error) << "Failed to release memory"; - return ret; - } + ret = output->releaseBuffers(); + if (ret) + LOG(IPU3, Error) << "Failed to release ImgU output memory"; + + ret = stat->releaseBuffers(); + if (ret) + LOG(IPU3, Error) << "Failed to release ImgU stat memory"; + + ret = viewfinder->releaseBuffers(); + if (ret) + LOG(IPU3, Error) << "Failed to release ImgU viewfinder memory"; + + ret = input->releaseBuffers(); + if (ret) + LOG(IPU3, Error) << "Failed to release ImgU input memory"; + + ret = cio2->releaseBuffers(); + if (ret) + LOG(IPU3, Error) << "Failed to release CIO2 memory"; return 0; }