Show a patch.

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

{
    "id": 12497,
    "url": "https://patchwork.libcamera.org/api/patches/12497/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12497/",
    "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": "<20210607011402.55331-4-hiroh@chromium.org>",
    "date": "2021-06-07T01:14:00",
    "name": "[libcamera-devel,v7,4/6] libcamera: CameraSensor: Enable retrieving supported test pattern modes",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "bc7912573ff78649a97cb57434fb3822bad9deed",
    "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/12497/mbox/",
    "series": [
        {
            "id": 2105,
            "url": "https://patchwork.libcamera.org/api/series/2105/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2105",
            "date": "2021-06-07T01:13:57",
            "name": "[libcamera-devel,v7,1/6] libcamera: controls: Add sensor test pattern mode",
            "version": 7,
            "mbox": "https://patchwork.libcamera.org/series/2105/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12497/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12497/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 CC742C320B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  7 Jun 2021 01:14:16 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 88F336892E;\n\tMon,  7 Jun 2021 03:14:16 +0200 (CEST)",
            "from mail-pg1-x529.google.com (mail-pg1-x529.google.com\n\t[IPv6:2607:f8b0:4864:20::529])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BE42268926\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  7 Jun 2021 03:14:13 +0200 (CEST)",
            "by mail-pg1-x529.google.com with SMTP id 6so12570891pgk.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 06 Jun 2021 18:14:13 -0700 (PDT)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:6eb1:2d91:79ee:2043])\n\tby smtp.gmail.com with ESMTPSA id\n\th12sm7303655pgn.54.2021.06.06.18.14.10\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 06 Jun 2021 18:14:11 -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=\"fa5fgOa7\"; 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=9K5PveEwZBbwwCEIhfIir0TSqZrkTwudduhTEgwn/MQ=;\n\tb=fa5fgOa7KHxQ1wgyMgKnAKT9O8tLHBGVLI8rZkoZjx6j7wx3B3zXfxoOCSYTu1de2J\n\txFtF8ZVTCH8+wSR4+xw86P0I4CcG/a0hsCHIw5E/MLB5xap0orNJoDv9MY4mXJJUuC6n\n\txkzXYIcH/btC1y4RTWCayCvJB6s966GCAqr4U=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\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=9K5PveEwZBbwwCEIhfIir0TSqZrkTwudduhTEgwn/MQ=;\n\tb=QFsr2FyxmJqAJk0S8ZxBifaUPhXu4TIdw2QSiwDs0g7SRkzm0eYRCiMT5LOlP8K5Y8\n\t3riKh7y4K4b3ZVyEW1ZPziqmOzNAsEXmFc8TDYke46zYq2lapz8zEVbAF6EbNuRTwTCw\n\tYKr9TRwCPb1GoSk1Bg7hHlI5GmFw+uC6T4ivKwg13Tgsg65AviZoWsM0mvKg1yQmMAxV\n\tg3AQAOb8wNk03BVjKsxflPNJhahmKX2F75IKxAER19Y4VooNibLfGa6VGJ7BJtPX+XQN\n\tYZ3fTPTWJxoCWfMoEL+cMYsa41xSX5Y2IDIFglXEc6lW7iDGKOTXSORpLdLJvfrJoKNF\n\t/FEQ==",
        "X-Gm-Message-State": "AOAM531ywTzHZAGg9qBNmbtzEmjHFn7ChcBoY3IDY4lwuk7sPqIilDHn\n\thTxM3754vTkndFwzL+OZX7QDr8zFoSmBJm4+",
        "X-Google-Smtp-Source": "ABdhPJxJqj+AaOP8r4T499LtOJnmYYcYcDzzScuZ30bt+wmif7kpX1ugP0gtOm6+CQOetA/dXSig4Q==",
        "X-Received": "by 2002:aa7:8e5a:0:b029:2e9:10d3:376f with SMTP id\n\td26-20020aa78e5a0000b02902e910d3376fmr15039237pfr.19.1623028452238; \n\tSun, 06 Jun 2021 18:14:12 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon,  7 Jun 2021 10:14:00 +0900",
        "Message-Id": "<20210607011402.55331-4-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.32.0.rc1.229.g3e70b5a671-goog",
        "In-Reply-To": "<20210607011402.55331-1-hiroh@chromium.org>",
        "References": "<20210607011402.55331-1-hiroh@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v7 4/6] libcamera: CameraSensor: Enable\n\tretrieving supported test pattern modes",
        "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 enables retrieving supported test pattern modes through\nCameraSensorInfo.\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 include/libcamera/internal/camera_sensor.h |  7 +++++\n src/libcamera/camera_sensor.cpp            | 34 ++++++++++++++++++++++\n 2 files changed, 41 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex cf6c1c1e..e133ebf4 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -39,6 +39,10 @@ public:\n \tconst std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }\n \tconst std::vector<Size> &sizes() const { return sizes_; }\n \tSize resolution() const;\n+\tconst std::vector<int32_t> &testPatternModes() const\n+\t{\n+\t\treturn testPatternModes_;\n+\t}\n \n \tV4L2SubdeviceFormat getFormat(const std::vector<unsigned int> &mbusCodes,\n \t\t\t\t      const Size &size) const;\n@@ -65,6 +69,8 @@ private:\n \tint validateSensorDriver();\n \tvoid initVimcDefaultProperties();\n \tvoid initStaticProperties();\n+\tvoid initTestPatternModes(\n+\t\tconst std::map<int32_t, int32_t> &testPatternModeMap);\n \tint initProperties();\n \n \tconst MediaEntity *entity_;\n@@ -77,6 +83,7 @@ private:\n \tV4L2Subdevice::Formats formats_;\n \tstd::vector<unsigned int> mbusCodes_;\n \tstd::vector<Size> sizes_;\n+\tstd::vector<int32_t> testPatternModes_;\n \n \tSize pixelArraySize_;\n \tRectangle activeArea_;\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 0fb8a258..3e135353 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -305,6 +305,32 @@ void CameraSensor::initStaticProperties()\n \n \t/* Register the properties retrieved from the sensor database. */\n \tproperties_.set(properties::UnitCellSize, props->unitCellSize);\n+\n+\tinitTestPatternModes(props->testPatternModes);\n+}\n+\n+void CameraSensor::initTestPatternModes(\n+\tconst std::map<int32_t, int32_t> &testPatternModes)\n+{\n+\tconst auto &v4l2TestPattern = controls().find(V4L2_CID_TEST_PATTERN);\n+\tif (v4l2TestPattern == controls().end()) {\n+\t\tLOG(CameraSensor, Debug) << \"No static test pattern map for \\'\"\n+\t\t\t\t\t << model() << \"\\'\";\n+\t\treturn;\n+\t}\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\t\tLOG(CameraSensor, Debug)\n+\t\t\t\t<< \"Test pattern mode \" << index << \" ignored\";\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\ttestPatternModes_.push_back(it->second);\n+\t}\n }\n \n int CameraSensor::initProperties()\n@@ -469,6 +495,14 @@ Size CameraSensor::resolution() const\n \treturn std::min(sizes_.back(), activeArea_.size());\n }\n \n+/**\n+ * \\fn CameraSensor::testPatternModes()\n+ * \\brief Retrieve all the supported test pattern modes of the camera sensor\n+ * The test pattern mode values correspond to the controls::TestPattern control.\n+ *\n+ * \\return The list of test pattern modes\n+ */\n+\n /**\n  * \\brief Retrieve the best sensor format for a desired output\n  * \\param[in] mbusCodes The list of acceptable media bus codes\n",
    "prefixes": [
        "libcamera-devel",
        "v7",
        "4/6"
    ]
}