Show a patch.

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

{
    "id": 14033,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/14033/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14033/",
    "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": "<20211004065856.3512141-1-hiroh@chromium.org>",
    "date": "2021-10-04T06:58:56",
    "name": "[libcamera-devel] libcamera: camera_sensor: Reverse the key and value of test pattern mode map",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "f665478e1c9304e558c79f7fce96855c196db054",
    "submitter": {
        "id": 63,
        "url": "https://patchwork.libcamera.org/api/1.1/people/63/?format=api",
        "name": "Hirokazu Honda",
        "email": "hiroh@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14033/mbox/",
    "series": [
        {
            "id": 2594,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2594/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2594",
            "date": "2021-10-04T06:58:56",
            "name": "[libcamera-devel] libcamera: camera_sensor: Reverse the key and value of test pattern mode map",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2594/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14033/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14033/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 88D16BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  4 Oct 2021 06:59:07 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 23CD8691B9;\n\tMon,  4 Oct 2021 08:59:07 +0200 (CEST)",
            "from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com\n\t[IPv6:2607:f8b0:4864:20::62e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E98F96023E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  4 Oct 2021 08:59:05 +0200 (CEST)",
            "by mail-pl1-x62e.google.com with SMTP id w14so1111453pll.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 03 Oct 2021 23:59:05 -0700 (PDT)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:15ef:e4fd:2730:ca53])\n\tby smtp.gmail.com with ESMTPSA id\n\tl10sm12899336pff.119.2021.10.03.23.59.01\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 03 Oct 2021 23:59:03 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"RJfDEX+E\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=xQmaGeXiHTrah0AUxYVVDTLlXk3afoDbyWp6LDdsmaY=;\n\tb=RJfDEX+EQRLa9v37Wol7pcHbxdoL4KX+B7Fx1oYjRgs4+JOSikebL0H5Y57Cw/BD98\n\txcFsOYy5Bsv6SoFAyfQrfc6JdiwE48bCZn+Fey0Bs1AdCXPIhQtPNjF7Hde3JLCQu4Hg\n\tHCjgfWGk+QQ8zu2yN/y8Y3l5gjzUaSK46Zr3s=",
        "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=xQmaGeXiHTrah0AUxYVVDTLlXk3afoDbyWp6LDdsmaY=;\n\tb=aMlzAeIBgnDtJLDsDqVcKiFodvZcq7fxffat7bvykPIUp3eq+OHNj4gm7qsB4uTz3S\n\tSWumENyC+YIh8DWrHSXkhi8B9EI0HFVvnDtO3Dm7ptBWzTTsJ8zUv1iIIClRZ+Kz3pCx\n\tMRqnJjGhSsk7014K8u7Dgn0pbEgmCDX6LrGh/tDRdu4kGCmiwGR8HDTAq+A6Y3XEBOUe\n\thxk4PhxhIztkRBRjAAG0+cGlvIWNXi4Hrai6Fkvj1UtJE5O3zG8fQLcUrQGV2FHPUuP/\n\tlSCUKfzk4qkzilYOKIsUJg2Z33YcJsbtgLGVbqySDrFYFK159XB/dU8zq07YD68JtxM6\n\tyObA==",
        "X-Gm-Message-State": "AOAM532M+yWb99dVFxetzgjCabHKOLxUuiKr2xTawPp0+i8jXLshBzrS\n\tcOnYWEgfUP+jmEIWNc4HrhSbit+n+FDvug==",
        "X-Google-Smtp-Source": "ABdhPJwO8b6ntMqMu8Jr856ujwq9B7yJCcL2FuqV4tsW4djjQ8MNHCWUX11xKkAVUaVgX2KaG4CAuw==",
        "X-Received": "by 2002:a17:902:dacf:b0:13e:ab53:87dc with SMTP id\n\tq15-20020a170902dacf00b0013eab5387dcmr8020872plx.78.1633330743715; \n\tSun, 03 Oct 2021 23:59:03 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon,  4 Oct 2021 15:58:56 +0900",
        "Message-Id": "<20211004065856.3512141-1-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.33.0.800.g4c38ced690-goog",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH] libcamera: camera_sensor: Reverse the key\n\tand value of test pattern mode map",
        "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": "The key and value of the test pattern mode are originally the index of\nv4l2 control and the corresponding test pattern mode control value.\nThis key and value are useful in the initialization for reporting\navailable test pattern modes. However, the map of the reversed key and\nvalue is much more useful in applying a requested test pattern mode.\nReverses the key and value of the map as the initialization is one\ntime but the test pattern mode request will be multiple times.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/camera_sensor.cpp            | 15 ++++++-\n src/libcamera/camera_sensor_properties.cpp | 52 +++++++++++-----------\n 2 files changed, 39 insertions(+), 28 deletions(-)",
    "diff": "diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 87668509..e5844c04 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -320,11 +320,22 @@ void CameraSensor::initTestPatternModes(\n \t\treturn;\n \t}\n \n+        /*\n+         * Create a map that associates the V4L2 control index to the test\n+\t * pattern mode by reversing the testPatternModes map provided by the\n+\t * camera sensor properties. This makes it easier to verify if the\n+\t * control index is supported in the below for loop that creates the\n+\t * list of supported test patterns.\n+         */\n+\tstd::map<int32_t, int32_t> indexToTestPatternMode;\n+\tfor (const auto& it : testPatternModes)\n+\t\tindexToTestPatternMode[it.second] = it.first;\n+\n \tfor (const ControlValue &value : v4l2TestPattern->second.values()) {\n \t\tconst int32_t index = value.get<int32_t>();\n \n-\t\tconst auto it = testPatternModes.find(index);\n-\t\tif (it == testPatternModes.end()) {\n+\t\tconst auto it = indexToTestPatternMode.find(index);\n+\t\tif (it == indexToTestPatternMode.end()) {\n \t\t\tLOG(CameraSensor, Debug)\n \t\t\t\t<< \"Test pattern mode \" << index << \" ignored\";\n \t\t\tcontinue;\ndiff --git a/src/libcamera/camera_sensor_properties.cpp b/src/libcamera/camera_sensor_properties.cpp\nindex 39bb282d..48305ac4 100644\n--- a/src/libcamera/camera_sensor_properties.cpp\n+++ b/src/libcamera/camera_sensor_properties.cpp\n@@ -38,9 +38,9 @@ LOG_DEFINE_CATEGORY(CameraSensorProperties)\n  * \\brief The physical size of a pixel, including pixel edges, in nanometers.\n  *\n  * \\var CameraSensorProperties::testPatternModes\n- * \\brief Map that associates the indexes of the sensor test pattern modes as\n- * returned by V4L2_CID_TEST_PATTERN with the corresponding TestPattern\n- * control value\n+ * \\brief Map that associates the TestPattern control value with the indexes of\n+ * the corresponding sensor test pattern modes as returned by\n+ * V4L2_CID_TEST_PATTERN.\n  */\n \n /**\n@@ -55,11 +55,11 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen\n \t\t{ \"hi846\", {\n \t\t\t.unitCellSize = { 1120, 1120 },\n \t\t\t.testPatternModes = {\n-\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n-\t\t\t\t{ 1, controls::draft::TestPatternModeSolidColor },\n-\t\t\t\t{ 2, controls::draft::TestPatternModeColorBars },\n-\t\t\t\t{ 3, controls::draft::TestPatternModeColorBarsFadeToGray },\n-\t\t\t\t{ 4, controls::draft::TestPatternModePn9 },\n+\t\t\t\t{ controls::draft::TestPatternModeOff, 0 },\n+\t\t\t\t{ controls::draft::TestPatternModeSolidColor, 1 },\n+\t\t\t\t{ controls::draft::TestPatternModeColorBars, 2 },\n+\t\t\t\t{ controls::draft::TestPatternModeColorBarsFadeToGray, 3 },\n+\t\t\t\t{ controls::draft::TestPatternModePn9, 4 },\n \t\t\t\t/*\n \t\t\t\t * No corresponding test pattern mode for:\n \t\t\t\t * 5: \"Gradient Horizontal\"\n@@ -73,21 +73,21 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen\n \t\t{ \"imx219\", {\n \t\t\t.unitCellSize = { 1120, 1120 },\n \t\t\t.testPatternModes = {\n-\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n-\t\t\t\t{ 1, controls::draft::TestPatternModeColorBars },\n-\t\t\t\t{ 2, controls::draft::TestPatternModeSolidColor },\n-\t\t\t\t{ 3, controls::draft::TestPatternModeColorBarsFadeToGray },\n-\t\t\t\t{ 4, controls::draft::TestPatternModePn9 },\n+\t\t\t\t{ controls::draft::TestPatternModeOff, 0 },\n+\t\t\t\t{ controls::draft::TestPatternModeColorBars, 1 },\n+\t\t\t\t{ controls::draft::TestPatternModeSolidColor, 2 },\n+\t\t\t\t{ controls::draft::TestPatternModeColorBarsFadeToGray, 3 },\n+\t\t\t\t{ controls::draft::TestPatternModePn9, 4 },\n \t\t\t},\n \t\t} },\n \t\t{ \"imx258\", {\n \t\t\t.unitCellSize = { 1120, 1120 },\n \t\t\t.testPatternModes = {\n-\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n-\t\t\t\t{ 1, controls::draft::TestPatternModeSolidColor },\n-\t\t\t\t{ 2, controls::draft::TestPatternModeColorBars },\n-\t\t\t\t{ 3, controls::draft::TestPatternModeColorBarsFadeToGray },\n-\t\t\t\t{ 4, controls::draft::TestPatternModePn9 },\n+\t\t\t\t{ controls::draft::TestPatternModeOff, 0 },\n+\t\t\t\t{ controls::draft::TestPatternModeSolidColor, 1 },\n+\t\t\t\t{ controls::draft::TestPatternModeColorBars, 2 },\n+\t\t\t\t{ controls::draft::TestPatternModeColorBarsFadeToGray, 3 },\n+\t\t\t\t{ controls::draft::TestPatternModePn9, 4 },\n \t\t\t},\n \t\t} },\n \t\t{ \"ov5647\", {\n@@ -97,15 +97,15 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen\n \t\t{ \"ov5670\", {\n \t\t\t.unitCellSize = { 1120, 1120 },\n \t\t\t.testPatternModes = {\n-\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n-\t\t\t\t{ 1, controls::draft::TestPatternModeColorBars },\n+\t\t\t\t{ controls::draft::TestPatternModeOff, 0 },\n+\t\t\t\t{ controls::draft::TestPatternModeColorBars, 1 },\n \t\t\t},\n \t\t} },\n \t\t{ \"ov5693\", {\n \t\t\t.unitCellSize = { 1400, 1400 },\n \t\t\t.testPatternModes = {\n-\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n-\t\t\t\t{ 2, controls::draft::TestPatternModeColorBars },\n+\t\t\t\t{ controls::draft::TestPatternModeOff, 0 },\n+\t\t\t\t{ controls::draft::TestPatternModeColorBars, 2 },\n \t\t\t\t/*\n \t\t\t\t * No corresponding test pattern mode for\n \t\t\t\t * 1: \"Random data\" and 3: \"Colour Bars with\n@@ -116,8 +116,8 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen\n \t\t{ \"ov8865\", {\n \t\t\t.unitCellSize = { 1400, 1400 },\n \t\t\t.testPatternModes = {\n-\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n-\t\t\t\t{ 2, controls::draft::TestPatternModeColorBars },\n+\t\t\t\t{ controls::draft::TestPatternModeOff, 0 },\n+\t\t\t\t{ controls::draft::TestPatternModeColorBars, 2 },\n \t\t\t\t/*\n \t\t\t\t * No corresponding test pattern mode for:\n \t\t\t\t * 1: \"Random data\"\n@@ -130,8 +130,8 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen\n \t\t{ \"ov13858\", {\n \t\t\t.unitCellSize = { 1120, 1120 },\n \t\t\t.testPatternModes =  {\n-\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n-\t\t\t\t{ 1, controls::draft::TestPatternModeColorBars },\n+\t\t\t\t{ controls::draft::TestPatternModeOff, 0 },\n+\t\t\t\t{ controls::draft::TestPatternModeColorBars, 1 },\n \t\t\t},\n \t\t} },\n \t};\n",
    "prefixes": [
        "libcamera-devel"
    ]
}