Show a patch.

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

{
    "id": 15274,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15274/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15274/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20220112092758.4726-1-david.plowman@raspberrypi.com>",
    "date": "2022-01-12T09:27:58",
    "name": "[libcamera-devel] pipeline: raspberrypi: Fix calculation of sensor's native Bayer order",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "1c221d82bb5bbb580ddff84b920fa47ec0bb5b72",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15274/mbox/",
    "series": [
        {
            "id": 2891,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2891/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2891",
            "date": "2022-01-12T09:27:58",
            "name": "[libcamera-devel] pipeline: raspberrypi: Fix calculation of sensor's native Bayer order",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2891/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15274/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15274/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 25606BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 Jan 2022 09:28:10 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6A0206021A;\n\tWed, 12 Jan 2022 10:28:09 +0100 (CET)",
            "from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 908E86017F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Jan 2022 10:28:07 +0100 (CET)",
            "by mail-wr1-x42a.google.com with SMTP id k30so2991444wrd.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Jan 2022 01:28:07 -0800 (PST)",
            "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tm1sm994901wrp.81.2022.01.12.01.28.06\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 12 Jan 2022 01:28:06 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"Yc9UjF97\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=gZAC2Lz05eFBKK7Ypc3hgH3kMVoPSHbH61oPuuXgT7w=;\n\tb=Yc9UjF97Bd3hpYUumx8TrzUeX0PMCjeBHNg8uoomOn9peGqJRhuyBBbrnsfEkR7R0q\n\tNNFNoJKDCs8OQIg0FHdoNu0/GXWro6cEnth6D85Bb0nfchvCUkjhjhbeNleFOdgsyK++\n\tBi70ri4TpIRv/wF42XbDAQrVwPjSygjRmigzfjgIeQumz2B5zaZ4+9zhfUGgAXX5zTRn\n\tpd7l601E288jaJyeaBX/Tu4uon5WgbTjYHJPxOWr2aINKGLnE4IW/uMncqSyiqi3f3KV\n\tRkkFb57DQGtUySa37RziRSNCPJwNQhTcpkPSqYNg3gRoDvHkDZMseJSc2/VI/yM+EhHy\n\t10VA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=gZAC2Lz05eFBKK7Ypc3hgH3kMVoPSHbH61oPuuXgT7w=;\n\tb=iez0Aim9ICMCvkUdctZQEhn111BpKgia6XUcU2yl6FN7RSSVZhy5Xvg7qmqA36Q9zS\n\tbohewp8pSrOPtYLHIpF1d5BpOgveRKao9AFz0tr9GxZ0UEiN2IB7CEeM+nbFrg1ugwid\n\tdeo4XIZW8XHIUf8boTcneXisKDAHZRiQGaM12+4189wucOOj13xl3eBu/sQe21splgRF\n\txgEbMUHFeGT+YMA51EEHKahVUzex4T8HVd/+clizv9UPNKEMmH0Vw3+sBZMRcixakug9\n\tsQ+ZLlcDf1x2iuGrcU/Znv5hD1teZet+hRx1Ho6gej2yewRgO/GNACu/vJm8y9n/McNd\n\tQG7Q==",
        "X-Gm-Message-State": "AOAM530JaWpMMu9OnRn2rtzzNcOrBHrmdPtC8q9O3h/MqEJCgEl6mRGX\n\tyPsuC0WKXB9J390zauNoTcFQwy+HMWAQ6Gno",
        "X-Google-Smtp-Source": "ABdhPJzqhBNIQwX5ZIUh4hNNhJTPABHyMUOmSX7L7m9SFKKbuRYhbAzJcU4HmDNvvEai7C815jraSw==",
        "X-Received": "by 2002:adf:f784:: with SMTP id q4mr7612070wrp.655.1641979686917;\n\tWed, 12 Jan 2022 01:28:06 -0800 (PST)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 12 Jan 2022 09:27:58 +0000",
        "Message-Id": "<20220112092758.4726-1-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH] pipeline: raspberrypi: Fix calculation of\n\tsensor's native Bayer order",
        "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": "This bug crept in when the pipeline handler was converted to use media\ncontroller.\n\nPreviously the sensor's hflip and vflip were being cleared before\nquerying the sensor for its \"native\" Bayer order. Now, though, the\nsensor's available formats are cached before we can clear these bits.\n\nInstead, we deduce the transform equivalent to the current hflip and\nvflip settings, and apply its inverse to the Bayer formats that we now\nhave, thereby giving us the untransformed Bayer order that we want.\n\nThe practical consequence of this was that the Bayer order stored in\nDNG files was frequently wrong.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nFixes: 83a512816189 (\"pipeline: raspberrypi: Convert the pipeline handler to use media controller\")\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 21 ++++++++++++-------\n 1 file changed, 14 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 49d7ff23..c1fb9666 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1279,20 +1279,24 @@ int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, Me\n \t * Thirdly, what is the \"native\" Bayer order, when no transforms are\n \t * applied?\n \t *\n-\t * As part of answering the final question, we reset the camera to\n-\t * no transform at all.\n+\t * We note that the format list has already been populated with\n+\t * whatever flips are currently set, so to answer the final question\n+\t * we get the current Bayer order and undo the transform implied by\n+\t * the current flip settings.\n \t */\n \tconst V4L2Subdevice *sensor = data->sensor_->device();\n \tconst struct v4l2_query_ext_ctrl *hflipCtrl = sensor->controlInfo(V4L2_CID_HFLIP);\n+\tTransform currentTransform = Transform::Identity;\n \tif (hflipCtrl) {\n \t\t/* We assume it will support vflips too... */\n \t\tdata->supportsFlips_ = true;\n \t\tdata->flipsAlterBayerOrder_ = hflipCtrl->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT;\n \n-\t\tControlList ctrls(data->sensor_->controls());\n-\t\tctrls.set(V4L2_CID_HFLIP, 0);\n-\t\tctrls.set(V4L2_CID_VFLIP, 0);\n-\t\tdata->setSensorControls(ctrls);\n+\t\tControlList ctrls = data->sensor_->getControls({ V4L2_CID_HFLIP, V4L2_CID_VFLIP });\n+\t\tif (ctrls.get(V4L2_CID_HFLIP).get<int32_t>())\n+\t\t\tcurrentTransform ^= Transform::HFlip;\n+\t\tif (ctrls.get(V4L2_CID_VFLIP).get<int32_t>())\n+\t\t\tcurrentTransform ^= Transform::VFlip;\n \t}\n \n \t/* Look for a valid Bayer format. */\n@@ -1307,7 +1311,10 @@ int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, Me\n \t\tLOG(RPI, Error) << \"No Bayer format found\";\n \t\treturn -EINVAL;\n \t}\n-\tdata->nativeBayerOrder_ = bayerFormat.order;\n+\t/* Applying the inverse transform will give us the native order. */\n+\tBayerFormat nativeBayerFormat = bayerFormat.transform(-currentTransform);\n+\tdata->nativeBayerOrder_ = nativeBayerFormat.order;\n+\tLOG(RPI, Debug) << \"Native Bayer format is \" << nativeBayerFormat.toString();\n \n \t/*\n \t * List the available streams an application may request. At present, we\n",
    "prefixes": [
        "libcamera-devel"
    ]
}