[{"id":26898,"web_url":"https://patchwork.libcamera.org/comment/26898/","msgid":"<20230419054832.GO30837@pendragon.ideasonboard.com>","date":"2023-04-19T05:48:32","subject":"Re: [libcamera-devel] [PATCH 05/11] pipeline: ipu3: Add needsImgu\n\tflag to IPU3Frames","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Dan,\n\nThank you for the patch.\n\nOn Sat, Mar 18, 2023 at 11:40:08PM +0000, Daniel Scally via libcamera-devel wrote:\n> Some sensors using the IPU3 pipeline do not transfer data to the\n> Imgu, so we need the ability to disable the related processing\n> from this class. Add a boolean flag denoting whether or not to\n> run the Imgu related processing. For now, hard code this to true\n> in IPU3CameraData::queuePendingRequests().\n> \n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n>  src/libcamera/pipeline/ipu3/frames.cpp | 45 +++++++++++++++-----------\n>  src/libcamera/pipeline/ipu3/frames.h   |  3 +-\n>  src/libcamera/pipeline/ipu3/ipu3.cpp   |  2 +-\n>  3 files changed, 29 insertions(+), 21 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp\n> index a4c3477c..55b90e9d 100644\n> --- a/src/libcamera/pipeline/ipu3/frames.cpp\n> +++ b/src/libcamera/pipeline/ipu3/frames.cpp\n> @@ -40,28 +40,32 @@ void IPU3Frames::clear()\n>  \tavailableStatBuffers_ = {};\n>  }\n>  \n> -IPU3Frames::Info *IPU3Frames::create(Request *request)\n> +IPU3Frames::Info *IPU3Frames::create(Request *request, bool needsImgu)\n\nWhy do we need this flag per frame ? I expect the ImgU to either be used\nfor all frames, or for none.\n\n>  {\n>  \tunsigned int id = request->sequence();\n> +\tFrameBuffer *paramBuffer = nullptr;\n> +\tFrameBuffer *statBuffer = nullptr;\n>  \n> -\tif (availableParamBuffers_.empty()) {\n> -\t\tLOG(IPU3, Debug) << \"Parameters buffer underrun\";\n> -\t\treturn nullptr;\n> -\t}\n> +\tif (needsImgu) {\n> +\t\tif (availableParamBuffers_.empty()) {\n> +\t\t\tLOG(IPU3, Debug) << \"Parameters buffer underrun\";\n> +\t\t\treturn nullptr;\n> +\t\t}\n>  \n> -\tif (availableStatBuffers_.empty()) {\n> -\t\tLOG(IPU3, Debug) << \"Statistics buffer underrun\";\n> -\t\treturn nullptr;\n> -\t}\n> +\t\tif (availableStatBuffers_.empty()) {\n> +\t\t\tLOG(IPU3, Debug) << \"Statistics buffer underrun\";\n> +\t\t\treturn nullptr;\n> +\t\t}\n>  \n> -\tFrameBuffer *paramBuffer = availableParamBuffers_.front();\n> -\tFrameBuffer *statBuffer = availableStatBuffers_.front();\n> +\t\tparamBuffer = availableParamBuffers_.front();\n> +\t\tstatBuffer = availableStatBuffers_.front();\n>  \n> -\tparamBuffer->_d()->setRequest(request);\n> -\tstatBuffer->_d()->setRequest(request);\n> +\t\tparamBuffer->_d()->setRequest(request);\n> +\t\tstatBuffer->_d()->setRequest(request);\n>  \n> -\tavailableParamBuffers_.pop();\n> -\tavailableStatBuffers_.pop();\n> +\t\tavailableParamBuffers_.pop();\n> +\t\tavailableStatBuffers_.pop();\n> +\t}\n>  \n>  \t/* \\todo Remove the dynamic allocation of Info */\n>  \tstd::unique_ptr<Info> info = std::make_unique<Info>();\n> @@ -73,6 +77,7 @@ IPU3Frames::Info *IPU3Frames::create(Request *request)\n>  \tinfo->statBuffer = statBuffer;\n>  \tinfo->paramDequeued = false;\n>  \tinfo->metadataProcessed = false;\n> +\tinfo->needsImgu = needsImgu;\n>  \n>  \tframeInfo_[id] = std::move(info);\n>  \n> @@ -96,11 +101,13 @@ bool IPU3Frames::tryComplete(IPU3Frames::Info *info)\n>  \tif (request->hasPendingBuffers())\n>  \t\treturn false;\n>  \n> -\tif (!info->metadataProcessed)\n> -\t\treturn false;\n> +\tif (info->needsImgu) {\n> +\t\tif (!info->metadataProcessed)\n> +\t\t\treturn false;\n>  \n> -\tif (!info->paramDequeued)\n> -\t\treturn false;\n> +\t\tif (!info->paramDequeued)\n> +\t\t\treturn false;\n> +\t}\n>  \n>  \tremove(info);\n>  \n> diff --git a/src/libcamera/pipeline/ipu3/frames.h b/src/libcamera/pipeline/ipu3/frames.h\n> index 6e3cb915..d58fd998 100644\n> --- a/src/libcamera/pipeline/ipu3/frames.h\n> +++ b/src/libcamera/pipeline/ipu3/frames.h\n> @@ -40,6 +40,7 @@ public:\n>  \n>  \t\tbool paramDequeued;\n>  \t\tbool metadataProcessed;\n> +\t\tbool needsImgu;\n>  \t};\n>  \n>  \tIPU3Frames();\n> @@ -48,7 +49,7 @@ public:\n>  \t\t  const std::vector<std::unique_ptr<FrameBuffer>> &statBuffers);\n>  \tvoid clear();\n>  \n> -\tInfo *create(Request *request);\n> +\tInfo *create(Request *request, bool needsImgu);\n>  \tvoid remove(Info *info);\n>  \tbool tryComplete(Info *info);\n>  \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index d0d55651..3077c6bb 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -806,7 +806,7 @@ void IPU3CameraData::queuePendingRequests()\n>  \twhile (!pendingRequests_.empty()) {\n>  \t\tRequest *request = pendingRequests_.front();\n>  \n> -\t\tIPU3Frames::Info *info = frameInfos_.create(request);\n> +\t\tIPU3Frames::Info *info = frameInfos_.create(request, true);\n>  \t\tif (!info)\n>  \t\t\tbreak;\n>","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 2C838BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 19 Apr 2023 05:48:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8237A627B1;\n\tWed, 19 Apr 2023 07:48:22 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C4EAF603A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Apr 2023 07:48:20 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(133-32-181-51.west.xps.vectant.ne.jp [133.32.181.51])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 27C84A5;\n\tWed, 19 Apr 2023 07:48:12 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681883302;\n\tbh=8i8/+YZhJ4E24vWjFm6JEKSPs5FssamHTIWIFMMQI4U=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=13vFKeLcbFURMR+EQdanYGRJH4EVWbj2ZUYtsusW3ttqOpXjscoox3tSiFCxO3Iof\n\tNQfW1YPd+JVpLwzU+Ray4z68mpYfwX81ph2PiivnT1EmJ0u3/OqOq5QrIgzA0cm+pS\n\tnE+df5JOOrAbq9JiA3PidSMmebB3ohw95WpZolnOCYCMemdGC6yOhkbBosmsGrhaT6\n\tUQDeWhOqywVnnR+rpmA1V2W0671RWBWhBEldsYH30b9JXroY+CFyQmkkFektPhuXXG\n\tFst2TYIfqQXrwkpbBLytDBhL2aQgkvvl0X94cpZnjHL4QFptryJ01sPluXrFK8w/ua\n\tt1263Kxa5w3Sg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1681883294;\n\tbh=8i8/+YZhJ4E24vWjFm6JEKSPs5FssamHTIWIFMMQI4U=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=q4AQqauj7d1RKEIwYCzYjng3slSXLnFO7r4dXqIWN+650gxAG7jrJQ6D5pqXYYqxy\n\tnoBTDxi9eAV2svXQZsPZlACba/fm77M5tEvL1MX0ygXRgCedI+tvM06zac6S8s0Uce\n\t32fayxWetYO+tEByuF8kFB/V7Sg9/LgFlKPOSJ8g="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"q4AQqauj\"; dkim-atps=neutral","Date":"Wed, 19 Apr 2023 08:48:32 +0300","To":"Daniel Scally <dan.scally@ideasonboard.com>","Message-ID":"<20230419054832.GO30837@pendragon.ideasonboard.com>","References":"<20230318234014.29506-1-dan.scally@ideasonboard.com>\n\t<20230318234014.29506-6-dan.scally@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230318234014.29506-6-dan.scally@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 05/11] pipeline: ipu3: Add needsImgu\n\tflag to IPU3Frames","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]