Patch Detail
Show a patch.
GET /api/patches/18711/?format=api
{ "id": 18711, "url": "https://patchwork.libcamera.org/api/patches/18711/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18711/", "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": "<20230606103336.17782-4-jacopo.mondi@ideasonboard.com>", "date": "2023-06-06T10:33:35", "name": "[libcamera-devel,v5,3/4] libcamera: rkisp1: Assign sizes to roles", "commit_ref": "d45da036a47369d91ad5fc7e1e656e5f58dda235", "pull_url": null, "state": "accepted", "archived": false, "hash": "50dd2754393cbfcea5bead4571a9382a006bd37a", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18711/mbox/", "series": [ { "id": 3909, "url": "https://patchwork.libcamera.org/api/series/3909/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3909", "date": "2023-06-06T10:33:32", "name": "libcamera: rkisp1: Fix generateConfiguration", "version": 5, "mbox": "https://patchwork.libcamera.org/series/3909/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18711/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18711/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 B1E64C3200\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 6 Jun 2023 10:33:57 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 619A56289F;\n\tTue, 6 Jun 2023 12:33:57 +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 B78C662894\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 6 Jun 2023 12:33:53 +0200 (CEST)", "from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E150B838;\n\tTue, 6 Jun 2023 12:33:27 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1686047637;\n\tbh=ByJY033FLZ+91hcSRYxrJLCpI+DPcX3IxL8lWJmdFSg=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=OUuGMHP71op3tBPq90XiC7T0e/1GSWVc3resJfWqOvtqR7i4ZA6aDLxuavEWHyyuz\n\t7pQkDuX+PakYFYZkrAUx0df+8ONn/1cqyLqatu6niR6J2x0Ep/QwF6exFBMInGvbe7\n\trpbZkZHBOOKH7a7FYmJjAIodmRxchFH8fEXq81tH+RJvHCDrZyZETdIc/u9DbEcwkg\n\tOUOuRUeiFOfWpLDhz1n1p7XuGn2o8d1XHWhBXz0MlxgTQJXPHcgJSqPX1eerj4uG9n\n\t98yoe9Uunr1oXaojmcgXbjRMnNt3YzruhKS8Z85CIq/2DLsDg52Kowl5wwny4YNjc1\n\tb5EJAyY0c0VTw==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1686047608;\n\tbh=ByJY033FLZ+91hcSRYxrJLCpI+DPcX3IxL8lWJmdFSg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=CA8C7s08P3ScF1C1OynGNVfDwBklxdQYIMRcji0xKDPWRlq3o4zgUFQERgQ9ybDC9\n\tKv9UuUcburfM8CY2Rwr/kRrs6BYZ2F/B4/ebEVtXbjWmZPpK+P0Vr3Pq1EArlHR5/D\n\tH50Fk7U0EFctF/RWsF/vKP1fkghDqy/E+jbOiozE=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"CA8C7s08\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 6 Jun 2023 12:33:35 +0200", "Message-Id": "<20230606103336.17782-4-jacopo.mondi@ideasonboard.com>", "X-Mailer": "git-send-email 2.40.1", "In-Reply-To": "<20230606103336.17782-1-jacopo.mondi@ideasonboard.com>", "References": "<20230606103336.17782-1-jacopo.mondi@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 3/4] libcamera: rkisp1: Assign sizes to\n\troles", "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": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Cc": "libcamera@luigi311.com, Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Currently each RkISP1 path (main and self) generate a configuration\nby bounding the sensor's resolution to their respective maximum output\naspect ratio and size.\n\n\tSize maxResolution = maxResolution_.boundedToAspectRatio(resolution)\n\t\t\t\t\t .boundedTo(resolution);\n\nIn the case of self path, whose maximum size is 1920x1920, the generated\nconfiguration could get assigned unusual sizes, as the result of the\nabove operation.\n\nAs an example, with the imx258 sensor whose resolution is 4208x3118, the\nresulting size for the Viewfinder use case is an unusual 1920x1423.\n\nFix this by assigning to each role a desired output size:\n- Use the sensor's resolution for StillCapture and Raw\n- Use 1080p for Viewfinder and VideoRecording\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +++++++++++-\n src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 9 +++++++--\n src/libcamera/pipeline/rkisp1/rkisp1_path.h | 1 +\n 3 files changed, 19 insertions(+), 3 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 78c4a6dd60a4..91a3c60757e1 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -162,6 +162,8 @@ public:\n \tbool match(DeviceEnumerator *enumerator) override;\n \n private:\n+\tstatic constexpr Size kRkISP1PreviewSize = { 1920, 1080 };\n+\n \tRkISP1CameraData *cameraData(Camera *camera)\n \t{\n \t\treturn static_cast<RkISP1CameraData *>(camera->_d());\n@@ -633,12 +635,15 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera,\n \tbool mainPathAvailable = true;\n \n \tfor (const StreamRole role : roles) {\n+\t\tSize size;\n \n \t\tswitch (role) {\n \t\tcase StreamRole::StillCapture:\n \t\t\t/* JPEG encoders typically expect sYCC. */\n \t\t\tif (!colorSpace)\n \t\t\t\tcolorSpace = ColorSpace::Sycc;\n+\n+\t\t\tsize = data->sensor_->resolution();\n \t\t\tbreak;\n \n \t\tcase StreamRole::Viewfinder:\n@@ -648,12 +653,16 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera,\n \t\t\t */\n \t\t\tif (!colorSpace)\n \t\t\t\tcolorSpace = ColorSpace::Sycc;\n+\n+\t\t\tsize = kRkISP1PreviewSize;\n \t\t\tbreak;\n \n \t\tcase StreamRole::VideoRecording:\n \t\t\t/* Rec. 709 is a good default for HD video recording. */\n \t\t\tif (!colorSpace)\n \t\t\t\tcolorSpace = ColorSpace::Rec709;\n+\n+\t\t\tsize = kRkISP1PreviewSize;\n \t\t\tbreak;\n \n \t\tcase StreamRole::Raw:\n@@ -664,6 +673,7 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera,\n \t\t\t}\n \n \t\t\tcolorSpace = ColorSpace::Raw;\n+\t\t\tsize = data->sensor_->resolution();\n \t\t\tbreak;\n \n \t\tdefault:\n@@ -690,7 +700,7 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera,\n \t\t}\n \n \t\tStreamConfiguration cfg =\n-\t\t\tpath->generateConfiguration(data->sensor_.get(), role);\n+\t\t\tpath->generateConfiguration(data->sensor_.get(), size, role);\n \t\tif (!cfg.pixelFormat.isValid())\n \t\t\treturn nullptr;\n \ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\nindex 0f728cea72b7..89fb6596b0be 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n@@ -127,15 +127,20 @@ void RkISP1Path::populateFormats()\n }\n \n StreamConfiguration\n-RkISP1Path::generateConfiguration(const CameraSensor *sensor, StreamRole role)\n+RkISP1Path::generateConfiguration(const CameraSensor *sensor, const Size &size,\n+\t\t\t\t StreamRole role)\n {\n \tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n \tconst Size &resolution = sensor->resolution();\n \n+\t/* Min and max resolutions to populate the available stream formats. */\n \tSize maxResolution = maxResolution_.boundedToAspectRatio(resolution)\n \t\t\t\t\t .boundedTo(resolution);\n \tSize minResolution = minResolution_.expandedToAspectRatio(resolution);\n \n+\t/* The desired stream size, bound to the max resolution. */\n+\tSize streamSize = size.boundedTo(maxResolution);\n+\n \t/* Create the list of supported stream formats. */\n \tstd::map<PixelFormat, std::vector<SizeRange>> streamFormats;\n \tunsigned int rawBitsPerPixel = 0;\n@@ -189,7 +194,7 @@ RkISP1Path::generateConfiguration(const CameraSensor *sensor, StreamRole role)\n \tStreamFormats formats(streamFormats);\n \tStreamConfiguration cfg(formats);\n \tcfg.pixelFormat = format;\n-\tcfg.size = maxResolution;\n+\tcfg.size = streamSize;\n \tcfg.bufferCount = RKISP1_BUFFER_COUNT;\n \n \treturn cfg;\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\nindex bdf3f95b95e1..cd77957ee4a6 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n@@ -41,6 +41,7 @@ public:\n \tbool isEnabled() const { return link_->flags() & MEDIA_LNK_FL_ENABLED; }\n \n \tStreamConfiguration generateConfiguration(const CameraSensor *sensor,\n+\t\t\t\t\t\t const Size &resolution,\n \t\t\t\t\t\t StreamRole role);\n \tCameraConfiguration::Status validate(const CameraSensor *sensor,\n \t\t\t\t\t StreamConfiguration *cfg);\n", "prefixes": [ "libcamera-devel", "v5", "3/4" ] }