Patch Detail
Show a patch.
GET /api/patches/8540/?format=api
{ "id": 8540, "url": "https://patchwork.libcamera.org/api/patches/8540/?format=api", "web_url": "https://patchwork.libcamera.org/patch/8540/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200701123036.51922-14-jacopo@jmondi.org>", "date": "2020-07-01T12:30:34", "name": "[libcamera-devel,13/15] libcamera: ipu3: Collect ImgU pipe configuration", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "37e41617e205e44e42b60ab9b1e232db64e022cb", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 15, "url": "https://patchwork.libcamera.org/api/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/8540/mbox/", "series": [ { "id": 1066, "url": "https://patchwork.libcamera.org/api/series/1066/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1066", "date": "2020-07-01T12:30:21", "name": "libcamera: ipu3: Rework streams configuration", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1066/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/8540/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/8540/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 8F346C2E69\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 1 Jul 2020 12:27:29 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 65CA860CDB;\n\tWed, 1 Jul 2020 14:27:29 +0200 (CEST)", "from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 96B2960CDB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 1 Jul 2020 14:27:26 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 31D361C000F;\n\tWed, 1 Jul 2020 12:27:26 +0000 (UTC)" ], "X-Originating-IP": "93.34.118.233", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 1 Jul 2020 14:30:34 +0200", "Message-Id": "<20200701123036.51922-14-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20200701123036.51922-1-jacopo@jmondi.org>", "References": "<20200701123036.51922-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH 13/15] libcamera: ipu3: Collect ImgU pipe\n\tconfiguration", "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=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Break the stream assignement and ImgU configuration performed at\nIPU3PipelineHandler::configure() time in two parts, to collect the\nImgU pipe configuration.\n\nThe first pass collects the desired ImgU pipe configuration and assigns\nstreams to configurations. The second pass, which is performed after the\nImgU pipe has been configured, programs the computed sizes to the ImgU\noutput video devices.\n\nUse the collected pipe configuration in ImgUDevice::configureInput() as\nit will be used to compute the pipe configuration parameters.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/imgu.cpp | 11 ++--\n src/libcamera/pipeline/ipu3/imgu.h | 2 +-\n src/libcamera/pipeline/ipu3/ipu3.cpp | 80 +++++++++++++++++++---------\n 3 files changed, 60 insertions(+), 33 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp\nindex 7e9047cc8dc1..49201157eb07 100644\n--- a/src/libcamera/pipeline/ipu3/imgu.cpp\n+++ b/src/libcamera/pipeline/ipu3/imgu.cpp\n@@ -95,12 +95,11 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index)\n \n /**\n * \\brief Configure the ImgU unit input\n- * \\param[in] size The ImgU input frame size\n+ * \\param[in] pipe The ImgU pipe configuration\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-\t\t\t V4L2DeviceFormat *inputFormat)\n+int ImgUDevice::configureInput(struct Pipe *pipe, V4L2DeviceFormat *inputFormat)\n {\n \t/* Configure the ImgU input video device with the requested sizes. */\n \tint ret = input_->setFormat(inputFormat);\n@@ -122,8 +121,8 @@ int ImgUDevice::configureInput(const Size &size,\n \tRectangle rect = {\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 = pipe->input.width,\n+\t\t.height = pipe->input.height,\n \t};\n \tret = imgu_->setSelection(PAD_INPUT, V4L2_SEL_TGT_CROP, &rect);\n \tif (ret)\n@@ -138,7 +137,7 @@ int ImgUDevice::configureInput(const Size &size,\n \n \tV4L2SubdeviceFormat imguFormat = {};\n \timguFormat.mbus_code = MEDIA_BUS_FMT_FIXED;\n-\timguFormat.size = size;\n+\timguFormat.size = pipe->input;\n \n \tret = imgu_->setFormat(PAD_INPUT, &imguFormat);\n \tif (ret)\ndiff --git a/src/libcamera/pipeline/ipu3/imgu.h b/src/libcamera/pipeline/ipu3/imgu.h\nindex 8fb271fb8350..c0353955ea43 100644\n--- a/src/libcamera/pipeline/ipu3/imgu.h\n+++ b/src/libcamera/pipeline/ipu3/imgu.h\n@@ -31,7 +31,7 @@ public:\n \n \tint init(MediaDevice *media, unsigned int index);\n \n-\tint configureInput(const Size &size, V4L2DeviceFormat *inputFormat);\n+\tint configureInput(struct Pipe *pipe, 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 16bda97a3cc3..9499c127ef79 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -396,32 +396,26 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t\toutCount++;\n \t}\n \n-\t/*\n-\t * Configure the CIO2 unit with the format computed during validation\n-\t * and apply the same format to the ImgU input.\n-\t */\n+\t/* Configure the CIO2 unit with the format computed during validation. */\n \tconst Size &sensorSize = config->cio2Format().size;\n \tV4L2DeviceFormat cio2Format = {};\n \tret = data->cio2_.configure(sensorSize, &cio2Format);\n \tif (ret)\n \t\treturn ret;\n \n-\tret = imgu->configureInput(sensorSize, &cio2Format);\n-\tif (ret)\n-\t\treturn ret;\n+\t/*\n+\t * Collect the input, output and viewfinder sizes to configure the\n+\t * ImgU pipe and assign streams to configurations while iterating them.\n+\t */\n+\tImgUDevice::Pipe imguPipe{};\n+\timguPipe.input.width = cio2Format.size.width;\n+\timguPipe.input.height = cio2Format.size.height;\n \n-\t/* Apply the format to the configured streams output devices. */\n-\tbool outActive = false;\n-\tbool vfActive = false;\n \tfor (unsigned int i = 0; i < config->size(); ++i) {\n \t\tStreamConfiguration &cfg = (*config)[i];\n \t\tconst PixelFormatInfo &info =\n \t\t\tPixelFormatInfo::info(cfg.pixelFormat);\n \t\tif (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW) {\n-\t\t\t/*\n-\t\t\t * The RAW stream is configured as part of the CIO2 and\n-\t\t\t * no configuration is needed for the ImgU.\n-\t\t\t */\n \t\t\tcfg.setStream(&data->rawStream_);\n \t\t\tcfg.stride = cio2Format.planes[0].bpl;\n \n@@ -437,13 +431,9 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t\t * requested.\n \t\t */\n \t\tif (cfg.size == maxOut && outCount > 1) {\n-\t\t\tret = imgu->configureOutput(cfg, &outputFormat);\n-\t\t\tif (ret)\n-\t\t\t\treturn ret;\n-\n-\t\t\tcfg.stride = outputFormat.planes[0].bpl;\n \t\t\tcfg.setStream(&data->outStream_);\n-\t\t\toutActive = true;\n+\t\t\timguPipe.output.width = cfg.size.width;\n+\t\t\timguPipe.output.height = cfg.size.height;\n \n \t\t\tLOG(IPU3, Debug) << \"Assigned \" << cfg.toString()\n \t\t\t\t\t << \" to the main output\";\n@@ -457,18 +447,56 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t\t * the smaller one to reduce the cropping required (if any) on\n \t\t * the main output.\n \t\t */\n-\t\tret = imgu->configureViewfinder(cfg, &outputFormat);\n-\t\tif (ret)\n-\t\t\treturn ret;\n-\n-\t\tcfg.stride = outputFormat.planes[0].bpl;\n \t\tcfg.setStream(&data->vfStream_);\n-\t\tvfActive = true;\n+\t\timguPipe.viewfinder.width = cfg.size.width;\n+\t\timguPipe.viewfinder.height = cfg.size.height;\n \n \t\tLOG(IPU3, Debug) << \"Assigned \" << cfg.toString()\n \t\t\t\t << \" to the viewfinder output\";\n \t}\n \n+\t/*\n+\t * Configure the ImgU with the collected pipe configuration and the\n+\t * CIO2 unit format.\n+\t */\n+\tret = imgu->configureInput(&imguPipe, &cio2Format);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* Apply the format to the ImgU output devices. */\n+\tbool outActive = false;\n+\tbool vfActive = false;\n+\tfor (unsigned int i = 0; i < config->size(); ++i) {\n+\t\tStreamConfiguration &cfg = (*config)[i];\n+\t\tStream *stream = cfg.stream();\n+\n+\t\tif (stream == &data->rawStream_) {\n+\t\t\t/*\n+\t\t\t * The RAW stream is configured as part of the CIO2 and\n+\t\t\t * no configuration is needed for the ImgU.\n+\t\t\t */\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (stream == &data->outStream_) {\n+\t\t\tret = imgu->configureOutput(cfg, &outputFormat);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\n+\t\t\toutActive = true;\n+\t\t\tcfg.stride = outputFormat.planes[0].bpl;\n+\t\t}\n+\n+\t\tif (stream == &data->vfStream_) {\n+\t\t\tret = imgu->configureViewfinder(cfg, &outputFormat);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\n+\t\t\tvfActive = true;\n+\t\t\tcfg.stride = outputFormat.planes[0].bpl;\n+\t\t}\n+\t}\n+\n \t/*\n \t * As we need to set format also on the non-active streams, use\n \t * the configuration of the active one for that purpose (there should\n", "prefixes": [ "libcamera-devel", "13/15" ] }