Patch Detail
Show a patch.
GET /api/patches/23852/?format=api
{ "id": 23852, "url": "https://patchwork.libcamera.org/api/patches/23852/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23852/", "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": "<20250718143205.1934-1-uajain@igalia.com>", "date": "2025-07-18T14:32:05", "name": "[v3,1/1] libcamera: simple: Detect Bayer pattern change during configure()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "023d61491bfbbdc7f037d4e399385a186e4894d6", "submitter": { "id": 232, "url": "https://patchwork.libcamera.org/api/people/232/?format=api", "name": "Umang Jain", "email": "uajain@igalia.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23852/mbox/", "series": [ { "id": 5299, "url": "https://patchwork.libcamera.org/api/series/5299/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5299", "date": "2025-07-18T14:32:05", "name": "[v3,1/1] libcamera: simple: Detect Bayer pattern change during configure()", "version": 3, "mbox": "https://patchwork.libcamera.org/series/5299/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23852/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23852/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 CB101C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Jul 2025 14:32:13 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8C1A268FA9;\n\tFri, 18 Jul 2025 16:32:12 +0200 (CEST)", "from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C97FC6150F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Jul 2025 16:32:10 +0200 (CEST)", "from [49.36.71.87] (helo=uajain) by fanzine2.igalia.com with\n\tesmtpsa \n\t(Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)\n\t(Exim) id 1ucm89-000bcD-LJ; Fri, 18 Jul 2025 16:32:10 +0200" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=igalia.com header.i=@igalia.com\n\theader.b=\"a/0WqSXi\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com;\n\ts=20170329;\n\th=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:\n\tCc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tIn-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n\tList-Post:List-Owner:List-Archive;\n\tbh=7hBkufjEziUvS5mNVPz4SBUtT7/+E8t7Y4FH0ab0X0M=;\n\tb=a/0WqSXi1W0Hy8wml6me98zCBV\n\tY2EKOaqvjJV8dSf2VIvh3ZinuX/848awzAwEPxcBw+AxixDMi2b0pY90kPsZgSFhMvo/1R+ou/DDC\n\tWEMkxSyavJeinLEp/MGM6h2OVgtK0MhcSVv+0Gmbn7ELTWhzwzX5YVUeCw0eutXCDI6t/d8mNujf0\n\tx2AdqEJuGGeYpL/4EKW1H2HMpuLOSM0N1tXYp0QbSiD1BHGC6nb2IefETNoUWUq2v1Xcc/+LwQ32g\n\tLgsZ4zqLDEIvq1Bj0x0GvPVmoxVSZfIdX5wkN7OMlPdPKvEFtzxbt0JyNSC+/e57XKTMjNb3iHm/D\n\t+06wa1mw==;", "From": "Umang Jain <uajain@igalia.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Milan Zamazal <mzamazal@redhat.com>,\n\tUmang Jain <uajain@igalia.com>", "Subject": "[PATCH v3 1/1] libcamera: simple: Detect Bayer pattern change during\n\tconfigure()", "Date": "Fri, 18 Jul 2025 20:02:05 +0530", "Message-ID": "<20250718143205.1934-1-uajain@igalia.com>", "X-Mailer": "git-send-email 2.50.0", "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": "Bayer pattern on the sensor can change while configuring it with the\nintended capture format. This is due to the transform being applied on\nthe sensor which supports [v/h]flips.\n\nDuring configure(), the simple pipeline handler does not detect any\nbayer pattern changes that can arise due to the transformations being\napplied via SimpleCameraData:setupFormats(). In such cases, the video\nnode will be configured in-correctly, without realising the bayer\npattern has changed on the sensor, for the given capture format.\n\nThis patch detects the bayer pattern change after the sensor has\nbeen configured and retrieves the corresponding V4L2 pixel format\nto correctly configure the video node and the input to converter or\nSoft-ISP.\n\nSigned-off-by: Umang Jain <uajain@igalia.com>\n---\n \nChanges in v3: \n- Drop addition of 'unicam' in supportedDevices[]. This could be enabled through\n a global configuration file. \n \nChanges in v2: \n- Pass the updated format(Bayer applied with transforms) to the \n converter/SoftISP input configuration as well to configure them \n correctly.\n\n---\n src/libcamera/pipeline/simple/simple.cpp | 18 +++++++++++++++---\n 1 file changed, 15 insertions(+), 3 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex efb07051..11d56873 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -1353,8 +1353,20 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n \tif (ret < 0)\n \t\treturn ret;\n \n-\t/* Configure the video node. */\n-\tV4L2PixelFormat videoFormat = video->toV4L2PixelFormat(pipeConfig->captureFormat);\n+\t/* Configure the video node, taking into account any Bayer pattern change. */\n+\tV4L2PixelFormat videoFormat;\n+\tif (format.code == pipeConfig->code) {\n+\t\tvideoFormat = video->toV4L2PixelFormat(pipeConfig->captureFormat);\n+\t} else {\n+\t\t/*\n+\t\t * Bayer pattern has changed because of the transform that was applied on\n+\t\t * the sensor. Get the V4L2PixelFormat corresponding to the configured Bayer\n+\t\t * pattern.\n+\t\t */\n+\t\tBayerFormat cfgBayer = BayerFormat::fromPixelFormat(pipeConfig->captureFormat);\n+\t\tcfgBayer.order = data->sensor_->bayerOrder(config->combinedTransform());\n+\t\tvideoFormat = cfgBayer.toV4L2PixelFormat();\n+\t}\n \n \tV4L2DeviceFormat captureFormat;\n \tcaptureFormat.fourcc = videoFormat;\n@@ -1396,7 +1408,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n \t\treturn 0;\n \n \tStreamConfiguration inputCfg;\n-\tinputCfg.pixelFormat = pipeConfig->captureFormat;\n+\tinputCfg.pixelFormat = videoFormat.toPixelFormat();\n \tinputCfg.size = pipeConfig->captureSize;\n \tinputCfg.stride = captureFormat.planes[0].bpl;\n \tinputCfg.bufferCount = kNumInternalBuffers;\n", "prefixes": [ "v3", "1/1" ] }