[{"id":13791,"web_url":"https://patchwork.libcamera.org/comment/13791/","msgid":"<20201118170033.abkst3nyw6cuk72j@uno.localdomain>","date":"2020-11-18T17:00:33","subject":"Re: [libcamera-devel] [PATCH 10/11] libcamera: ipu3: imgu: Allocate\n\tbuffers for stats and param","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Niklas,\n\nOn Thu, Nov 05, 2020 at 01:15:45AM +0100, Niklas Söderlund wrote:\n> Instead of preparing for buffer importing allocate buffers that can be\n> used by an IPA.\n>\n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n> ---\n>  src/libcamera/pipeline/ipu3/imgu.cpp | 14 +++++---------\n>  src/libcamera/pipeline/ipu3/imgu.h   |  3 +++\n>  2 files changed, 8 insertions(+), 9 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp\n> index 547a9e00325e7519..1dfa968d00379631 100644\n> --- a/src/libcamera/pipeline/ipu3/imgu.cpp\n> +++ b/src/libcamera/pipeline/ipu3/imgu.cpp\n> @@ -551,20 +551,13 @@ int ImgUDevice::allocateBuffers(unsigned int bufferCount)\n>  \t\treturn ret;\n>  \t}\n>\n> -\tret = param_->importBuffers(bufferCount);\n> +\tret = param_->allocateBuffers(bufferCount, &paramBuffers_);\n>  \tif (ret < 0) {\n>  \t\tLOG(IPU3, Error) << \"Failed to allocate ImgU param buffers\";\n>  \t\tgoto error;\n>  \t}\n>\n> -\t/*\n> -\t * The kernel fails to start if buffers are not either imported or\n> -\t * allocated for the statistics video device. As statistics buffers are\n> -\t * not yet used by the pipeline import buffers to save memory.\n> -\t *\n> -\t * \\todo To be revised when we'll actually use the stat node.\n> -\t */\n> -\tret = stat_->importBuffers(bufferCount);\n> +\tret = stat_->allocateBuffers(bufferCount, &statBuffers_);\n>  \tif (ret < 0) {\n>  \t\tLOG(IPU3, Error) << \"Failed to allocate ImgU stat buffers\";\n>  \t\tgoto error;\n> @@ -602,6 +595,9 @@ void ImgUDevice::freeBuffers()\n>  {\n>  \tint ret;\n>\n> +\tparamBuffers_.clear();\n> +\tstatBuffers_.clear();\n> +\n>  \tret = output_->releaseBuffers();\n>  \tif (ret)\n>  \t\tLOG(IPU3, Error) << \"Failed to release ImgU output buffers\";\n> diff --git a/src/libcamera/pipeline/ipu3/imgu.h b/src/libcamera/pipeline/ipu3/imgu.h\n> index 1388d07a45b28590..05fbc26648549bd6 100644\n> --- a/src/libcamera/pipeline/ipu3/imgu.h\n> +++ b/src/libcamera/pipeline/ipu3/imgu.h\n> @@ -76,6 +76,9 @@ public:\n>  \tstd::unique_ptr<V4L2VideoDevice> param_;\n>  \tstd::unique_ptr<V4L2VideoDevice> stat_;\n>\n> +\tstd::vector<std::unique_ptr<FrameBuffer>> paramBuffers_;\n> +\tstd::vector<std::unique_ptr<FrameBuffer>> statBuffers_;\n> +\n>  private:\n>  \tstatic constexpr unsigned int PAD_INPUT = 0;\n>  \tstatic constexpr unsigned int PAD_PARAM = 1;\n> --\n> 2.29.2\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 9192EBE08A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 18 Nov 2020 17:00:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2FBA47E9AE;\n\tWed, 18 Nov 2020 18:00:32 +0100 (CET)","from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DE06F632AF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Nov 2020 18:00:30 +0100 (CET)","from uno.localdomain (93-34-118-233.ip49.fastwebnet.it\n\t[93.34.118.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 5A84BE0009;\n\tWed, 18 Nov 2020 17:00:29 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","Date":"Wed, 18 Nov 2020 18:00:33 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20201118170033.abkst3nyw6cuk72j@uno.localdomain>","References":"<20201105001546.1690179-1-niklas.soderlund@ragnatech.se>\n\t<20201105001546.1690179-11-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201105001546.1690179-11-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH 10/11] libcamera: ipu3: imgu: Allocate\n\tbuffers for stats and param","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>"}},{"id":14120,"web_url":"https://patchwork.libcamera.org/comment/14120/","msgid":"<X87qqrIiJrVOiX0m@pendragon.ideasonboard.com>","date":"2020-12-08T02:53:30","subject":"Re: [libcamera-devel] [PATCH 10/11] libcamera: ipu3: imgu: Allocate\n\tbuffers for stats and param","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 Thu, Nov 05, 2020 at 01:15:45AM +0100, Niklas Söderlund wrote:\n> Instead of preparing for buffer importing allocate buffers that can be\n> used by an IPA.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/libcamera/pipeline/ipu3/imgu.cpp | 14 +++++---------\n>  src/libcamera/pipeline/ipu3/imgu.h   |  3 +++\n>  2 files changed, 8 insertions(+), 9 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp\n> index 547a9e00325e7519..1dfa968d00379631 100644\n> --- a/src/libcamera/pipeline/ipu3/imgu.cpp\n> +++ b/src/libcamera/pipeline/ipu3/imgu.cpp\n> @@ -551,20 +551,13 @@ int ImgUDevice::allocateBuffers(unsigned int bufferCount)\n>  \t\treturn ret;\n>  \t}\n>  \n> -\tret = param_->importBuffers(bufferCount);\n> +\tret = param_->allocateBuffers(bufferCount, &paramBuffers_);\n>  \tif (ret < 0) {\n>  \t\tLOG(IPU3, Error) << \"Failed to allocate ImgU param buffers\";\n>  \t\tgoto error;\n>  \t}\n>  \n> -\t/*\n> -\t * The kernel fails to start if buffers are not either imported or\n> -\t * allocated for the statistics video device. As statistics buffers are\n> -\t * not yet used by the pipeline import buffers to save memory.\n> -\t *\n> -\t * \\todo To be revised when we'll actually use the stat node.\n> -\t */\n> -\tret = stat_->importBuffers(bufferCount);\n> +\tret = stat_->allocateBuffers(bufferCount, &statBuffers_);\n>  \tif (ret < 0) {\n>  \t\tLOG(IPU3, Error) << \"Failed to allocate ImgU stat buffers\";\n>  \t\tgoto error;\n> @@ -602,6 +595,9 @@ void ImgUDevice::freeBuffers()\n>  {\n>  \tint ret;\n>  \n> +\tparamBuffers_.clear();\n> +\tstatBuffers_.clear();\n> +\n>  \tret = output_->releaseBuffers();\n>  \tif (ret)\n>  \t\tLOG(IPU3, Error) << \"Failed to release ImgU output buffers\";\n> diff --git a/src/libcamera/pipeline/ipu3/imgu.h b/src/libcamera/pipeline/ipu3/imgu.h\n> index 1388d07a45b28590..05fbc26648549bd6 100644\n> --- a/src/libcamera/pipeline/ipu3/imgu.h\n> +++ b/src/libcamera/pipeline/ipu3/imgu.h\n> @@ -76,6 +76,9 @@ public:\n>  \tstd::unique_ptr<V4L2VideoDevice> param_;\n>  \tstd::unique_ptr<V4L2VideoDevice> stat_;\n>  \n> +\tstd::vector<std::unique_ptr<FrameBuffer>> paramBuffers_;\n> +\tstd::vector<std::unique_ptr<FrameBuffer>> statBuffers_;\n> +\n>  private:\n>  \tstatic constexpr unsigned int PAD_INPUT = 0;\n>  \tstatic constexpr unsigned int PAD_PARAM = 1;","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 60A5ABDB1F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Dec 2020 02:53:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ED22F67E6F;\n\tTue,  8 Dec 2020 03:53:34 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F125767E6C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Dec 2020 03:53:33 +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 6D8EDDD;\n\tTue,  8 Dec 2020 03:53:33 +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=\"vSO/pfJz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1607396013;\n\tbh=OYQfHbIoVcz/fII/tJZxp9ziWDY2nnyxtJjg08GxbLA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=vSO/pfJzsvjwqmK9RU+QMK77NzJCy/iEExWjbrl1DRR4E0aO/N0/jE2U+88uM/SDo\n\tCrPJgLZmxuBY4ZNMm0WssKKbFBpeOWsllsAQA0gNHe1rC/wqb8rl6K3Og7Qygepsik\n\tQcBBQsqdZROcd2yCWKMxIGuIO9ugqt0APa84K8iY=","Date":"Tue, 8 Dec 2020 04:53:30 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<X87qqrIiJrVOiX0m@pendragon.ideasonboard.com>","References":"<20201105001546.1690179-1-niklas.soderlund@ragnatech.se>\n\t<20201105001546.1690179-11-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201105001546.1690179-11-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH 10/11] libcamera: ipu3: imgu: Allocate\n\tbuffers for stats and param","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>"}}]