Patch Detail
Show a patch.
GET /api/patches/22024/?format=api
{ "id": 22024, "url": "https://patchwork.libcamera.org/api/patches/22024/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22024/", "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": "<20241120085753.1993436-3-stefan.klug@ideasonboard.com>", "date": "2024-11-20T08:57:41", "name": "[2/7] libcamera: rkisp1: Keep aspect ratio on imx8mp", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "3e82f465d86669bfc32ec137ca90a5bfe492548a", "submitter": { "id": 184, "url": "https://patchwork.libcamera.org/api/people/184/?format=api", "name": "Stefan Klug", "email": "stefan.klug@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/22024/mbox/", "series": [ { "id": 4807, "url": "https://patchwork.libcamera.org/api/series/4807/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4807", "date": "2024-11-20T08:57:39", "name": "rkisp1: Fix aspect ratio and ScalerCrop", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4807/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22024/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22024/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 A0B48C32F9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 20 Nov 2024 08:58:06 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6516165F3F;\n\tWed, 20 Nov 2024 09:58:05 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A688665F39\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Nov 2024 09:58:03 +0100 (CET)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:bbd:82cc:f3f3:e12e])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B205275A;\n\tWed, 20 Nov 2024 09:57:45 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"E5eAK/26\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1732093065;\n\tbh=F2YyGqPGMui8INijisWJh3kDevPUX8Q9wzEnmljIx6U=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=E5eAK/26f+HhPHNFwp5MCs4aKxJ6Y6Ban971zmxrZ+C6Ff/a4nGxowTPZKDHNYFev\n\tHIw2aetc11d6PzKQqVzjT2+JADv754vKb09iC8IswaoaOGzd+g3u9Bt8oQJfrEwCRe\n\tijaM0BbIlvIVPLxz0EH2xU4zZsBBNVY9drf49rwQ=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>", "Subject": "[PATCH 2/7] libcamera: rkisp1: Keep aspect ratio on imx8mp", "Date": "Wed, 20 Nov 2024 09:57:41 +0100", "Message-ID": "<20241120085753.1993436-3-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20241120085753.1993436-1-stefan.klug@ideasonboard.com>", "References": "<20241120085753.1993436-1-stefan.klug@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "In the current code, the input stage of the image resizer is used to\napply a crop to keep the aspect ratio in cases where the requested\noutput aspect ratio differs from the one of the selected sensor mode. On\nthe imx8mp the resizer hardware is not capable of cropping (for\nreference see also rkisp1-resizer.c:rkisp1_rsz_set_sink_crop() in the\nlinux kernel v6.10).\n\nTherefore apply the necessary cropping on the output of the ISP (on the\nimage stabilization block). The cropping code on the image resizer\ndoesn't need modifications as the requested crop gets ignored by the\nkernel.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 15 +++++++++++++++\n src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 6 ++++++\n 2 files changed, 21 insertions(+)", "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 5ffcfbce56be..9d36554cec6e 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -811,6 +811,21 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \tif (!isRaw_)\n \t\tformat.code = MEDIA_BUS_FMT_YUYV8_2X8;\n \n+\t/*\n+\t * On devices without DUAL_CROP (like the imx8mp) cropping needs to be\n+\t * done on the ISP/IS output.\n+\t */\n+\tif (media_->hwRevision() == RKISP1_V_IMX8MP) {\n+\t\tconst auto &cfg = config->at(0);\n+\t\tSize ispCrop = format.size.boundedToAspectRatio(cfg.size)\n+\t\t\t\t .alignedUpTo(2, 2);\n+\t\trect = ispCrop.centeredTo(Rectangle(format.size).center());\n+\t\tif (ispCrop != format.size)\n+\t\t\tLOG(RkISP1, Info) << \"ISP output needs to be cropped to \"\n+\t\t\t\t\t << rect;\n+\t\tformat.size = ispCrop;\n+\t}\n+\n \tLOG(RkISP1, Debug)\n \t\t<< \"Configuring ISP output pad with \" << format\n \t\t<< \" crop \" << rect;\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\nindex 236d05af7a2f..0651de464907 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n@@ -417,6 +417,12 @@ int RkISP1Path::configure(const StreamConfiguration &config,\n \t/*\n \t * Crop on the resizer input to maintain FOV before downscaling.\n \t *\n+\t * Note that this does not apply on the imx8mp, where the cropping needs\n+\t * to be done on the ImageStabilizer output and therefore is configured\n+\t * before this stage. For simplicity we still set the crop. This gets\n+\t * ignored by the kernel driver because the hardware is missing the\n+\t * capability.\n+\t *\n \t * \\todo The alignment to a multiple of 2 pixels is required but may\n \t * change the aspect ratio very slightly. A more advanced algorithm to\n \t * compute the resizer input crop rectangle is needed, and it should\n", "prefixes": [ "2/7" ] }