Show a patch.

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

{
    "id": 24092,
    "url": "https://patchwork.libcamera.org/api/patches/24092/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24092/",
    "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": "<20250812073055.5579-1-uajain@igalia.com>",
    "date": "2025-08-12T07:30:55",
    "name": "[v4] libcamera: simple: Detect Bayer pattern change during configure()",
    "commit_ref": "7e8c274d18a77540e11d4565406fd72c0194e775",
    "pull_url": null,
    "state": "accepted",
    "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/24092/mbox/",
    "series": [
        {
            "id": 5367,
            "url": "https://patchwork.libcamera.org/api/series/5367/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5367",
            "date": "2025-08-12T07:30:55",
            "name": "[v4] libcamera: simple: Detect Bayer pattern change during configure()",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/5367/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24092/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24092/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 DF0B3BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 Aug 2025 07:30:48 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8628961462;\n\tTue, 12 Aug 2025 09:30:47 +0200 (CEST)",
            "from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B123261462\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Aug 2025 09:30:44 +0200 (CEST)",
            "from [49.36.71.143] (helo=uajain)\n\tby fanzine2.igalia.com with esmtpsa \n\t(Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)\n\t(Exim) id 1uljT1-00D89M-L4; Tue, 12 Aug 2025 09:30:44 +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=\"d7CD1NqG\"; 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=Aw6v+kyy1745CUgmI5r21i1Vr8wdv4G0U57PfWZxLoY=;\n\tb=d7CD1NqG0cBOzP03R+jAqCmXUi\n\tc30oxgsjG1StzAot9iH63LTA1QhJnmdjq+bKkIMn8OWIXPaUyij0/RTo/YQvOG/uqQZUjIX3igai3\n\tQqs3A/TF/41wmcaqYMMURbh64MwwYkXlkBL/Bxr8oyaZtSePKY8mSWcG7SR3wL+bsLn0Rq+1Go/Zw\n\tmc3Zif5Hxn64lXDAuAPrF2jp8dZWrHcNKfRB0pENgUFjsv2J++kEaXHWxmjyQ4RiPcxLj/xpBvfU3\n\tbWf4DIHeZRolR/daeEMajAhSlI0hlnFWpyBSNSHpD+Lj7QrtSiML8foQO+tJ0aH6q8pITsM8UzxJS\n\tB3FJQkGA==;",
        "From": "Umang Jain <uajain@igalia.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Umang Jain <uajain@igalia.com>",
        "Subject": "[PATCH v4] libcamera: simple: Detect Bayer pattern change during\n\tconfigure()",
        "Date": "Tue, 12 Aug 2025 13:00:55 +0530",
        "Message-ID": "<20250812073055.5579-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---\nchanges in v4:\n- Just rebase over new release v0.6.2 test and resend\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 4323472e..66606a41 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -1356,8 +1356,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@@ -1399,7 +1411,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": [
        "v4"
    ]
}