{"id":8794,"url":"https://patchwork.libcamera.org/api/1.1/patches/8794/?format=json","web_url":"https://patchwork.libcamera.org/patch/8794/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200714104212.48683-20-jacopo@jmondi.org>","date":"2020-07-14T10:42:11","name":"[libcamera-devel,19/20] libcamera: ipu3: Configure ImgU with the computed parameters","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"dae7ce696de59571f16200095038b184f520ee96","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/8794/mbox/","series":[{"id":1104,"url":"https://patchwork.libcamera.org/api/1.1/series/1104/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1104","date":"2020-07-14T10:41:52","name":"libcamera: ipu3: Rework pipe configuration","version":1,"mbox":"https://patchwork.libcamera.org/series/1104/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8794/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8794/checks/","tags":{},"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 A2344BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Jul 2020 10:39:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 481C86087E;\n\tTue, 14 Jul 2020 12:39:06 +0200 (CEST)","from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E383A60917\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jul 2020 12:39:01 +0200 (CEST)","from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay10.mail.gandi.net (Postfix) with ESMTPSA id 2008C24000F;\n\tTue, 14 Jul 2020 10:39:00 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 14 Jul 2020 12:42:11 +0200","Message-Id":"<20200714104212.48683-20-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200714104212.48683-1-jacopo@jmondi.org>","References":"<20200714104212.48683-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 19/20] libcamera: ipu3: Configure ImgU\n\twith the computed parameters","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>","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>"},"content":"Instrument the ImgUDevice::configureInput() function to use the provided\npipe configuration parameters to configure the IF, BDS and GDC\nrectangles.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/imgu.    |  0\n src/libcamera/pipeline/ipu3/imgu.cpp | 35 ++++++++++++++++------------\n src/libcamera/pipeline/ipu3/imgu.h   |  2 +-\n src/libcamera/pipeline/ipu3/ipu3.cpp | 11 ++++++++-\n 4 files changed, 31 insertions(+), 17 deletions(-)\n create mode 100644 src/libcamera/pipeline/ipu3/imgu.","diff":"diff --git a/src/libcamera/pipeline/ipu3/imgu. b/src/libcamera/pipeline/ipu3/imgu.\nnew file mode 100644\nindex 000000000000..e69de29bb2d1\ndiff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp\nindex ff0062a0e95c..32e26c85807b 100644\n--- a/src/libcamera/pipeline/ipu3/imgu.cpp\n+++ b/src/libcamera/pipeline/ipu3/imgu.cpp\n@@ -425,11 +425,11 @@ ImgUDevice::PipeConfig ImgUDevice::calculatePipeConfig(Pipe *pipe)\n \n /**\n  * \\brief Configure the ImgU unit input\n- * \\param[in] size The ImgU input frame size\n+ * \\param[in] config The ImgU pipe configuration parameters\n  * \\param[in] inputFormat The format to be applied to ImgU input\n  * \\return 0 on success or a negative error code otherwise\n  */\n-int ImgUDevice::configureInput(const Size &size,\n+int ImgUDevice::configureInput(const PipeConfig &pipeConfig,\n \t\t\t       V4L2DeviceFormat *inputFormat)\n {\n \t/* Configure the ImgU input video device with the requested sizes. */\n@@ -449,32 +449,37 @@ int ImgUDevice::configureInput(const Size &size,\n \t * to configure the crop/compose rectangles, contradicting the\n \t * V4L2 specification.\n \t */\n-\tRectangle rect = {\n+\tRectangle iif = {\n \t\t.x = 0,\n \t\t.y = 0,\n-\t\t.width = inputFormat->size.width,\n-\t\t.height = inputFormat->size.height,\n+\t\t.width = pipeConfig.iif.width,\n+\t\t.height = pipeConfig.iif.height,\n \t};\n-\tret = imgu_->setSelection(PAD_INPUT, V4L2_SEL_TGT_CROP, &rect);\n+\tret = imgu_->setSelection(PAD_INPUT, V4L2_SEL_TGT_CROP, &iif);\n \tif (ret)\n \t\treturn ret;\n+\tLOG(IPU3, Debug) << \"ImgU IF rectangle = \" << iif.toString();\n \n-\tret = imgu_->setSelection(PAD_INPUT, V4L2_SEL_TGT_COMPOSE, &rect);\n+\tRectangle bds = {\n+\t\t.x = 0,\n+\t\t.y = 0,\n+\t\t.width = pipeConfig.bds.width,\n+\t\t.height = pipeConfig.bds.height,\n+\t};\n+\tret = imgu_->setSelection(PAD_INPUT, V4L2_SEL_TGT_COMPOSE, &bds);\n \tif (ret)\n \t\treturn ret;\n+\tLOG(IPU3, Debug) << \"ImgU BDS rectangle = \" << bds.toString();\n \n-\tLOG(IPU3, Debug) << \"ImgU input feeder and BDS rectangle = \"\n-\t\t\t << rect.toString();\n-\n-\tV4L2SubdeviceFormat imguFormat = {};\n-\timguFormat.mbus_code = MEDIA_BUS_FMT_FIXED;\n-\timguFormat.size = size;\n+\tV4L2SubdeviceFormat gdcFormat = {};\n+\tgdcFormat.mbus_code = MEDIA_BUS_FMT_FIXED;\n+\tgdcFormat.size = pipeConfig.gdc;\n \n-\tret = imgu_->setFormat(PAD_INPUT, &imguFormat);\n+\tret = imgu_->setFormat(PAD_INPUT, &gdcFormat);\n \tif (ret)\n \t\treturn ret;\n \n-\tLOG(IPU3, Debug) << \"ImgU GDC format = \" << imguFormat.toString();\n+\tLOG(IPU3, Debug) << \"ImgU GDC format = \" << gdcFormat.toString();\n \n \treturn 0;\n }\ndiff --git a/src/libcamera/pipeline/ipu3/imgu.h b/src/libcamera/pipeline/ipu3/imgu.h\nindex 15ee9a7f5698..6193c84bf35d 100644\n--- a/src/libcamera/pipeline/ipu3/imgu.h\n+++ b/src/libcamera/pipeline/ipu3/imgu.h\n@@ -45,7 +45,7 @@ public:\n \n \tPipeConfig calculatePipeConfig(Pipe *pipe);\n \n-\tint configureInput(const Size &size, V4L2DeviceFormat *inputFormat);\n+\tint configureInput(const PipeConfig &pipeConfig, V4L2DeviceFormat *inputFormat);\n \n \tint configureOutput(const StreamConfiguration &cfg,\n \t\t\t    V4L2DeviceFormat *outputFormat)\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 00aab2bdfc14..9906de38021b 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -67,6 +67,7 @@ public:\n \tStatus validate() override;\n \n \tconst StreamConfiguration &cio2Format() const { return cio2Configuration_; };\n+\tconst ImgUDevice::PipeConfig imguConfig() const { return pipeConfig_; }\n \n private:\n \t/*\n@@ -457,7 +458,15 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \tif (ret)\n \t\treturn ret;\n \n-\tret = imgu->configureInput(sensorSize, &cio2Format);\n+\t/*\n+\t * If no ImgU configuration has been computed, only RAW stream has\n+\t * been requested: return here and skip the ImgU configuration part.\n+\t */\n+\tImgUDevice::PipeConfig imguConfig = config->imguConfig();\n+\tif (imguConfig.isNull())\n+\t\treturn 0;\n+\n+\tret = imgu->configureInput(imguConfig, &cio2Format);\n \tif (ret)\n \t\treturn ret;\n \n","prefixes":["libcamera-devel","19/20"]}