[{"id":14462,"web_url":"https://patchwork.libcamera.org/comment/14462/","msgid":"<X/Z+gQuiMuJuMswi@pendragon.ideasonboard.com>","date":"2021-01-07T03:22:41","subject":"Re: [libcamera-devel] [PATCH v2 04/11] libcamera: ipu3: cio2:\n\tReturn the FrameBuffer pointer used","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Tue, Dec 29, 2020 at 05:03:11PM +0100, Niklas Söderlund wrote:\n> When adding IPA plumbing to the IPU3 pipeline handler it will be needed\n> to track which raw buffer was queued to the CIO2 for a specific request.\n> Currently if using an internally allocated raw buffer the FrameBuffer is\n> not exposed outside the CIO2Device as it was not needed. Prepare for the\n> IPA by exposing which internal raw buffer is picked for each request,\n> later changes will associate this with a Request.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n> * Changes since v1\n> - Update commit message.\n> ---\n>  src/libcamera/pipeline/ipu3/cio2.cpp | 10 +++++++---\n>  src/libcamera/pipeline/ipu3/cio2.h   |  2 +-\n>  src/libcamera/pipeline/ipu3/ipu3.cpp |  8 ++++----\n>  3 files changed, 12 insertions(+), 8 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\n> index bd5260d5b28893e8..f76c6675b0f448fe 100644\n> --- a/src/libcamera/pipeline/ipu3/cio2.cpp\n> +++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n> @@ -254,7 +254,7 @@ int CIO2Device::stop()\n>  \treturn ret;\n>  }\n>  \n> -int CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)\n> +FrameBuffer *CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)\n>  {\n>  \tFrameBuffer *buffer = rawBuffer;\n>  \n> @@ -262,7 +262,7 @@ int CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)\n>  \tif (!buffer) {\n>  \t\tif (availableBuffers_.empty()) {\n>  \t\t\tLOG(IPU3, Error) << \"CIO2 buffer underrun\";\n> -\t\t\treturn -EINVAL;\n> +\t\t\treturn nullptr;\n>  \t\t}\n>  \n>  \t\tbuffer = availableBuffers_.front();\n> @@ -271,7 +271,11 @@ int CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)\n>  \n>  \tbuffer->setRequest(request);\n>  \n> -\treturn output_->queueBuffer(buffer);\n> +\tint ret = output_->queueBuffer(buffer);\n> +\tif (ret)\n> +\t\treturn nullptr;\n> +\n> +\treturn buffer;\n>  }\n>  \n>  void CIO2Device::tryReturnBuffer(FrameBuffer *buffer)\n> diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h\n> index 236ad287354a0bf6..dca4d40e4c32e8b2 100644\n> --- a/src/libcamera/pipeline/ipu3/cio2.h\n> +++ b/src/libcamera/pipeline/ipu3/cio2.h\n> @@ -51,7 +51,7 @@ public:\n>  \tCameraSensor *sensor() { return sensor_.get(); }\n>  \tconst CameraSensor *sensor() const { return sensor_.get(); }\n>  \n> -\tint queueBuffer(Request *request, FrameBuffer *rawBuffer);\n> +\tFrameBuffer *queueBuffer(Request *request, FrameBuffer *rawBuffer);\n>  \tvoid tryReturnBuffer(FrameBuffer *buffer);\n>  \tSignal<FrameBuffer *> &bufferReady() { return output_->bufferReady; }\n>  \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 3e0e88fa63c4f1fb..a87ce8f3378ba2fe 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -643,10 +643,10 @@ int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)\n>  \t * Queue a buffer on the CIO2, using the raw stream buffer provided in\n>  \t * the request, if any, or a CIO2 internal buffer otherwise.\n>  \t */\n> -\tFrameBuffer *rawBuffer = request->findBuffer(&data->rawStream_);\n> -\terror = data->cio2_.queueBuffer(request, rawBuffer);\n> -\tif (error)\n> -\t\treturn error;\n> +\tFrameBuffer *reqRawBuffer = request->findBuffer(&data->rawStream_);\n> +\tFrameBuffer *rawBuffer = data->cio2_.queueBuffer(request, reqRawBuffer);\n> +\tif (!rawBuffer)\n> +\t\treturn -ENOMEM;\n>  \n>  \t/* Queue all buffers from the request aimed for the ImgU. */\n>  \tfor (auto it : request->buffers()) {","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 7D07DC0F1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  7 Jan 2021 03:22:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0935C631B9;\n\tThu,  7 Jan 2021 04:22:57 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 96BD86010E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  7 Jan 2021 04:22:54 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 181A02E0;\n\tThu,  7 Jan 2021 04:22:54 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Bh+wk8kJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1609989774;\n\tbh=N9id0Lqc6euOIKdPsJ6gebTl1FXQ2RHPJnYtnp9Sfhk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Bh+wk8kJHkWb+7lpqp7VXSYp1iPTPWEgkQSAbbN7IR/p+pudJT42ytPX7i9c+H59p\n\t4jvH4kA6RBwh0XGI/vSCjaUI6FJdvlikLEMIOsuf6CypTuKkOp8D8tv1Lbbn8LVIXD\n\tZ5nggaLP3CLmAnl1Wegjvh0413/s7Sa4ztNRKF1s=","Date":"Thu, 7 Jan 2021 05:22:41 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<X/Z+gQuiMuJuMswi@pendragon.ideasonboard.com>","References":"<20201229160318.77536-1-niklas.soderlund@ragnatech.se>\n\t<20201229160318.77536-5-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201229160318.77536-5-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH v2 04/11] libcamera: ipu3: cio2:\n\tReturn the FrameBuffer pointer used","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]