Show a patch.

GET /api/patches/18291/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 18291,
    "url": "https://patchwork.libcamera.org/api/patches/18291/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18291/",
    "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": "<20230221164504.120738-3-jacopo.mondi@ideasonboard.com>",
    "date": "2023-02-21T16:45:03",
    "name": "[libcamera-devel,2/3] libcamera: rkisp1: Assign sizes to roles",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "e79b1989c73897dac235d1e0a656fc75a58f978d",
    "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/18291/mbox/",
    "series": [
        {
            "id": 3760,
            "url": "https://patchwork.libcamera.org/api/series/3760/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3760",
            "date": "2023-02-21T16:45:01",
            "name": "libcamera: rkisp1: Fix generateConfiguration",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3760/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18291/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18291/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 319D0C329C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 21 Feb 2023 16:45:25 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BDE576264F;\n\tTue, 21 Feb 2023 17:45:23 +0100 (CET)",
            "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 2EE5862636\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Feb 2023 17:45:22 +0100 (CET)",
            "from uno.homenet.telecomitalia.it\n\t(host-87-16-53-160.retail.telecomitalia.it [87.16.53.160])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7F6446E0;\n\tTue, 21 Feb 2023 17:45:21 +0100 (CET)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1676997923;\n\tbh=DE4uJKwHklOI3CV+no2FP/CyUn1FJ22M7cSuTnjQW3I=;\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=x4n0wy2VVKLvfTiyNTTQSUITq/SJA8uJ9Jzfx4mcI6uMbyyF2TLthuRlfzUCTI++V\n\tuOpX7lab7Zzx45orHOcNYHx3PB+d09jbNmnIkPtJsoy8e56ZpGWL8Kt8Dw6Sc71cvU\n\tBtqNAmP+bCRaDPQXWAXj6O5hZlDBaNoqlClvmw+csP4qelRt2vzMS9sq/G6gM7UF3C\n\tM9Y40o45evJ8Asfr4N6V/GUb1QzKs87KTXSXe5BFsjNzma6JoioqZCvvf+3x+3tzqs\n\tfJGi8NG+PL5ls6S4l1ky0WF8Oz4gkUyOr3afkwMPvvpiaOdrsvajPdx2c/sn9+lVeT\n\t958MBo5Nti/3A==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1676997921;\n\tbh=DE4uJKwHklOI3CV+no2FP/CyUn1FJ22M7cSuTnjQW3I=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=nsVxWrUy1weexsOBz6G2n9UwUY5QTzGA5P49McbV9lRMSzPGCNGGVjS08eM6qNjZ8\n\tBRdsPVc+g6EMDsxLWYrpZ4XM4eXVEEd65mXVdaUbLr4j1JlhWVKP3PNeNCBHHKO1kV\n\td7LR860TE41aKSBNr6oPoh2BMqt6kHmx1e+xZabk="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"nsVxWrUy\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 21 Feb 2023 17:45:03 +0100",
        "Message-Id": "<20230221164504.120738-3-jacopo.mondi@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.39.0",
        "In-Reply-To": "<20230221164504.120738-1-jacopo.mondi@ideasonboard.com>",
        "References": "<20230221164504.120738-1-jacopo.mondi@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 2/3] 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": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>, libcamera@luigi311.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>\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp      | 12 +++++++++++-\n src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 11 ++++++-----\n src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  1 +\n 3 files changed, 18 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 569fb8ecb629..05a7ba03b2d2 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@@ -634,12 +636,15 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera,\n \n \tfor (const StreamRole role : roles) {\n \t\tbool useMainPath = mainPathAvailable;\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@@ -649,12 +654,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@@ -665,6 +674,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@@ -683,7 +693,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 5079b268c464..9bfb4068779f 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n@@ -127,14 +127,14 @@ void RkISP1Path::populateFormats()\n }\n \n StreamConfiguration\n-RkISP1Path::generateConfiguration(const CameraSensor *sensor, StreamRole role)\n+RkISP1Path::generateConfiguration(const CameraSensor *sensor,\n+\t\t\t\t  const Size &resolution,\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+\tSize minResolution = minResolution_.expandedToAspectRatio(resolution);\n \tSize maxResolution = maxResolution_.boundedToAspectRatio(resolution)\n \t\t\t\t\t   .boundedTo(resolution);\n-\tSize minResolution = minResolution_.expandedToAspectRatio(resolution);\n \n \t/* Create the list of supported stream formats. */\n \tstd::map<PixelFormat, std::vector<SizeRange>> streamFormats;\n@@ -155,7 +155,8 @@ RkISP1Path::generateConfiguration(const CameraSensor *sensor, StreamRole role)\n \t\t    mbusCodes.end())\n \t\t\tcontinue;\n \n-\t\tstreamFormats[format] = { { resolution, resolution } };\n+\t\tstreamFormats[format] = { { sensor->resolution(),\n+\t\t\t\t\t    sensor->resolution() } };\n \n \t\t/*\n \t\t * Store the raw format with the highest bits per pixel for\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",
        "2/3"
    ]
}