Show a patch.

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

{
    "id": 14728,
    "url": "https://patchwork.libcamera.org/api/patches/14728/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14728/",
    "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": "<20211123190812.69805-2-hiroh@chromium.org>",
    "date": "2021-11-23T19:08:10",
    "name": "[libcamera-devel,v7,1/3] libcamera: camera_sensor: Reference test pattern modes by enum type",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ded355e1f0fefcab4b34d29a0dd5a57d54f4cc5a",
    "submitter": {
        "id": 63,
        "url": "https://patchwork.libcamera.org/api/people/63/?format=api",
        "name": "Hirokazu Honda",
        "email": "hiroh@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14728/mbox/",
    "series": [
        {
            "id": 2748,
            "url": "https://patchwork.libcamera.org/api/series/2748/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2748",
            "date": "2021-11-23T19:08:09",
            "name": "Enable to apply test pattern mode in IPU3",
            "version": 7,
            "mbox": "https://patchwork.libcamera.org/series/2748/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14728/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14728/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 E8D40BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Nov 2021 19:08:24 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A25056038A;\n\tTue, 23 Nov 2021 20:08:24 +0100 (CET)",
            "from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com\n\t[IPv6:2607:f8b0:4864:20::42f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0B94D60228\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 20:08:23 +0100 (CET)",
            "by mail-pf1-x42f.google.com with SMTP id 8so224210pfo.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 11:08:22 -0800 (PST)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:cc8f:f5a6:5a9f:7275])\n\tby smtp.gmail.com with ESMTPSA id\n\tt4sm14550916pfq.163.2021.11.23.11.08.19\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 23 Nov 2021 11:08:20 -0800 (PST)"
        ],
        "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=\"ges1Q1+n\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=dU+ajapeoM9GAYlsiUIGsiZ8ATHPqNzBP0EXs7GoRcQ=;\n\tb=ges1Q1+nk3oFISRy5IqPjkE6D5stO/QPZjjGCx5a4by5bMrCc+sM2V/UtUW3U2hAFM\n\tAg/VLEFwRU9SjAS+z4NSkPVRUiFdZd5ZcrhcG0mR0q6HVdZpfi1ttT93ksRiHa4EsFKr\n\tbfxvWFpLoGQZ0vnjLeShrDo8zMaGF3lYfUTWQ=",
        "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:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=dU+ajapeoM9GAYlsiUIGsiZ8ATHPqNzBP0EXs7GoRcQ=;\n\tb=kivTzr1ESJt9BAFOJfd03ndukOOBvbzTJHkJAO1XfAstlgB/LNLJqmse2zMCDPA4QG\n\tFPovbqpmfYvymOZvCUp47b3BYvZiq5MEbtMxPtoRx9A2x7xAILdErJP1r7yI8VsKJ3L+\n\tFecDZZ5iUKM+s9O7BxeaFzuhxa5jIgAfKYR9FWqx2duwnjwTfh6oOKvbwgnA6sa5Bnz9\n\tWnMtxwgrjIMbSIFqeRPEIJfZ5n3buQtOsj1rOv7l/NI7/PU0kvyUhbHdvfFGw7J0Hxot\n\tcrn2iBloOleGL1mM/NmUa5C2hTSwy2n63rCfJYbFJXvW1ni9/tHj2nLU+qH/cF1726d1\n\tOUMg==",
        "X-Gm-Message-State": "AOAM5308aXlIKs5Ps/AfrYs/r4y/XDnHo/iyGEb7E0mjAtUD/VPOR0Y1\n\tvEjuMPKc4yHxwky9b70ezWZSEKCTKk9z+g==",
        "X-Google-Smtp-Source": "ABdhPJyrC4ihuWcdBXJpXDuT6OkwrcTwYcGCo2gh0XIVi1y3Vp971ztWvwZFuNu0dkpEjYZA7dI21A==",
        "X-Received": "by 2002:a62:7803:0:b0:494:64ef:7bd7 with SMTP id\n\tt3-20020a627803000000b0049464ef7bd7mr7235199pfc.85.1637694500905; \n\tTue, 23 Nov 2021 11:08:20 -0800 (PST)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 24 Nov 2021 04:08:10 +0900",
        "Message-Id": "<20211123190812.69805-2-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.34.0.rc2.393.gf8c9666880-goog",
        "In-Reply-To": "<20211123190812.69805-1-hiroh@chromium.org>",
        "References": "<20211123190812.69805-1-hiroh@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v7 1/3] libcamera: camera_sensor:\n\tReference test pattern modes by enum type",
        "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 CameraSensor stores TestPatternModes as an int32_t. This prevents\nthe compiler from verifying the usage against the defined enum types.\n\nFix references to the TestPatternMode to store the value as the\nTestPatternModeEnum type which is defined by the control generator.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/camera_sensor.h            | 10 +++++++---\n include/libcamera/internal/camera_sensor_properties.h |  3 ++-\n src/libcamera/camera_sensor.cpp                       |  4 ++--\n src/libcamera/pipeline/ipu3/ipu3.cpp                  |  7 ++++---\n 4 files changed, 15 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex d25a1165..edef2220 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -14,8 +14,10 @@\n #include <libcamera/base/class.h>\n #include <libcamera/base/log.h>\n \n+#include <libcamera/control_ids.h>\n #include <libcamera/controls.h>\n #include <libcamera/geometry.h>\n+\n #include <libcamera/ipa/core_ipa_interface.h>\n \n #include \"libcamera/internal/formats.h\"\n@@ -40,7 +42,8 @@ public:\n \tconst std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }\n \tconst std::vector<Size> sizes(unsigned int mbusCode) const;\n \tSize resolution() const;\n-\tconst std::vector<int32_t> &testPatternModes() const\n+\tconst std::vector<controls::draft::TestPatternModeEnum>\n+\t\t&testPatternModes() const\n \t{\n \t\treturn testPatternModes_;\n \t}\n@@ -71,7 +74,8 @@ private:\n \tvoid initVimcDefaultProperties();\n \tvoid initStaticProperties();\n \tvoid initTestPatternModes(\n-\t\tconst std::map<int32_t, int32_t> &testPatternModeMap);\n+\t\tconst std::map<controls::draft::TestPatternModeEnum, int32_t>\n+\t\t\t&testPatternModeMap);\n \tint initProperties();\n \n \tconst MediaEntity *entity_;\n@@ -84,7 +88,7 @@ private:\n \tV4L2Subdevice::Formats formats_;\n \tstd::vector<unsigned int> mbusCodes_;\n \tstd::vector<Size> sizes_;\n-\tstd::vector<int32_t> testPatternModes_;\n+\tstd::vector<controls::draft::TestPatternModeEnum> testPatternModes_;\n \n \tSize pixelArraySize_;\n \tRectangle activeArea_;\ndiff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h\nindex 67c77920..5c7e5e87 100644\n--- a/include/libcamera/internal/camera_sensor_properties.h\n+++ b/include/libcamera/internal/camera_sensor_properties.h\n@@ -10,6 +10,7 @@\n #include <map>\n #include <string>\n \n+#include <libcamera/control_ids.h>\n #include <libcamera/geometry.h>\n \n namespace libcamera {\n@@ -18,7 +19,7 @@ struct CameraSensorProperties {\n \tstatic const CameraSensorProperties *get(const std::string &sensor);\n \n \tSize unitCellSize;\n-\tstd::map<int32_t, int32_t> testPatternModes;\n+\tstd::map<controls::draft::TestPatternModeEnum, int32_t> testPatternModes;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 9fdb8c09..f0aa9f24 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -311,7 +311,7 @@ void CameraSensor::initStaticProperties()\n }\n \n void CameraSensor::initTestPatternModes(\n-\tconst std::map<int32_t, int32_t> &testPatternModes)\n+\tconst std::map<controls::draft::TestPatternModeEnum, int32_t> &testPatternModes)\n {\n \tconst auto &v4l2TestPattern = controls().find(V4L2_CID_TEST_PATTERN);\n \tif (v4l2TestPattern == controls().end()) {\n@@ -327,7 +327,7 @@ void CameraSensor::initTestPatternModes(\n \t * control index is supported in the below for loop that creates the\n \t * list of supported test patterns.\n \t */\n-\tstd::map<int32_t, int32_t> indexToTestPatternMode;\n+\tstd::map<int32_t, controls::draft::TestPatternModeEnum> indexToTestPatternMode;\n \tfor (const auto &it : testPatternModes)\n \t\tindexToTestPatternMode[it.second] = it.first;\n \ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex c65afdb2..25490dcf 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -982,13 +982,14 @@ int PipelineHandlerIPU3::updateControls(IPU3CameraData *data)\n \t\treturn ret;\n \n \tControlInfoMap::Map controls = IPU3Controls;\n-\tconst std::vector<int32_t> &testPatternModes = sensor->testPatternModes();\n+\tconst std::vector<controls::draft::TestPatternModeEnum>\n+\t\t&testPatternModes = sensor->testPatternModes();\n \tif (!testPatternModes.empty()) {\n \t\tstd::vector<ControlValue> values;\n \t\tvalues.reserve(testPatternModes.size());\n \n-\t\tfor (int32_t pattern : testPatternModes)\n-\t\t\tvalues.emplace_back(pattern);\n+\t\tfor (auto pattern : testPatternModes)\n+\t\t\tvalues.emplace_back(static_cast<int32_t>(pattern));\n \n \t\tcontrols[&controls::draft::TestPatternMode] = ControlInfo(values);\n \t}\n",
    "prefixes": [
        "libcamera-devel",
        "v7",
        "1/3"
    ]
}