Show a patch.

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

{
    "id": 12730,
    "url": "https://patchwork.libcamera.org/api/patches/12730/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12730/",
    "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": "<20210628163237.3194582-3-hiroh@chromium.org>",
    "date": "2021-06-28T16:32:37",
    "name": "[libcamera-devel,2/2] libcamera: camera_sensor: Enable to set a test pattern mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "f4ab2fd19b4625b59e5de8de08acf829ce99fb4b",
    "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/12730/mbox/",
    "series": [
        {
            "id": 2186,
            "url": "https://patchwork.libcamera.org/api/series/2186/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2186",
            "date": "2021-06-28T16:32:35",
            "name": "Add CameraSensor a function to set test pattern mode",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2186/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12730/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12730/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 74E7EC3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Jun 2021 16:32:55 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DB2A8684D6;\n\tMon, 28 Jun 2021 18:32:54 +0200 (CEST)",
            "from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com\n\t[IPv6:2607:f8b0:4864:20::1029])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2375560508\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Jun 2021 18:32:53 +0200 (CEST)",
            "by mail-pj1-x1029.google.com with SMTP id kt19so2582356pjb.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Jun 2021 09:32:53 -0700 (PDT)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:a147:1cb:e226:4ed9])\n\tby smtp.gmail.com with ESMTPSA id\n\tgg5sm5134201pjb.42.2021.06.28.09.32.50\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 28 Jun 2021 09:32:50 -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=\"ACOlRrJf\"; 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=w8tjquK+IcBSMPTy8zTwYyPWYtVo4Tqk+xeA6vSCsBM=;\n\tb=ACOlRrJfG+FqoBLb5YvR9IQRzb+NebHuDKpaviod0k9C1ZNSDGf2GObtmvKGnuXwVg\n\tQc42xzA/7Y7pTIp6ZhLH0MuF9JtERkxsuheEaZh+52jSrQfyGUScZ+JEmt1EzQg6dMGA\n\tNFbEZGnXmR4F5o2sKaPbD/OoNtZWVGQ+2OzmU=",
        "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=w8tjquK+IcBSMPTy8zTwYyPWYtVo4Tqk+xeA6vSCsBM=;\n\tb=kYkfQBxNBF9wEe3vUgRyxlbi5V9J1W5SHzrqUc50/tD+NnR7gWCMknAS2Lu5E3CYhs\n\tSL0LYtODkdiCfQPrAe7ZAFFLNrMwADdP/2tjOfZbo1oYePg3NIVEjRvSJJf52rIpQQjV\n\t586lnRYFMMeqzSvUcO1NHrCdZwLOxm2GdjOhL6OTxBIypP1j5exXC7U5z2UorzCAuJPM\n\tXzDcv4pJAtsH6doT7m2AM5qTcx/YcUlONCaMWp1YyezMGQ2Kyg9QODiIOpGGKyy8ejHJ\n\tDxX8HjSKk+6kfn9u5zTyYGLcV4usPQcwqYpa644rp3WQX+brMi8j+PGoRaYIdcwXbA2Y\n\tciBg==",
        "X-Gm-Message-State": "AOAM5316CXwOYFcjDIEns08ih6u91Xm8H9MXKV7l1yPZFBcE3DtLpvni\n\tmJdqkCUtr7EVKwBaLKRcYp5107AGuT+y6A==",
        "X-Google-Smtp-Source": "ABdhPJwohq1jfVlAV1EHbip3KsfUXjHZHE3yl1i03yM9E+cattKFPEwWCcCw1Zcqmf/WsB3EOcMbNg==",
        "X-Received": "by 2002:a17:902:aa0a:b029:128:c224:4f0a with SMTP id\n\tbe10-20020a170902aa0ab0290128c2244f0amr10741423plb.58.1624897971406; \n\tMon, 28 Jun 2021 09:32:51 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 29 Jun 2021 01:32:37 +0900",
        "Message-Id": "<20210628163237.3194582-3-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.32.0.93.g670b81a890-goog",
        "In-Reply-To": "<20210628163237.3194582-1-hiroh@chromium.org>",
        "References": "<20210628163237.3194582-1-hiroh@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 2/2] libcamera: camera_sensor: Enable to\n\tset a test pattern mode",
        "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": "Provides a function to set the camera sensor a test pattern mode.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/internal/camera_sensor.h |  2 ++\n src/libcamera/camera_sensor.cpp            | 35 ++++++++++++++++++++--\n 2 files changed, 35 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex db12b07e..4ecce6c9 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -44,6 +44,7 @@ public:\n \t{\n \t\treturn testPatternModes_;\n \t}\n+\tint setTestPatternMode(int32_t testPatternMode);\n \n \tV4L2SubdeviceFormat getFormat(const std::vector<unsigned int> &mbusCodes,\n \t\t\t\t      const Size &size) const;\n@@ -85,6 +86,7 @@ private:\n \tstd::vector<unsigned int> mbusCodes_;\n \tstd::vector<Size> sizes_;\n \tstd::vector<int32_t> testPatternModes_;\n+\tint32_t testPatternMode_;\n \n \tSize pixelArraySize_;\n \tRectangle activeArea_;\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex ee53adf3..be2d32e3 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -54,8 +54,8 @@ LOG_DEFINE_CATEGORY(CameraSensor)\n  * Once constructed the instance must be initialized with init().\n  */\n CameraSensor::CameraSensor(const MediaEntity *entity)\n-\t: entity_(entity), pad_(UINT_MAX), bayerFormat_(nullptr),\n-\t  properties_(properties::properties)\n+\t: entity_(entity), pad_(UINT_MAX), testPatternMode_(-1),\n+\t  bayerFormat_(nullptr), properties_(properties::properties)\n {\n }\n \n@@ -515,6 +515,37 @@ Size CameraSensor::resolution() const\n  * \\return The list of test pattern modes\n  */\n \n+/**\n+ * \\brief Set the camera sensor a specified controls::TestPatternMode\n+ * \\param[in] testPatternMode test pattern mode control value to set the camera\n+ * sensor\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n+int CameraSensor::setTestPatternMode(int32_t testPatternMode)\n+{\n+\tif (testPatternMode_ == testPatternMode)\n+\t\treturn 0;\n+\n+\tconst CameraSensorProperties *props = CameraSensorProperties::get(model_);\n+\tif (!props)\n+\t\treturn -EINVAL;\n+\n+\tauto it = props->testPatternModes.find(testPatternMode);\n+\tASSERT(it != props->testPatternModes.end());\n+\n+\tControlList ctrls{ controls() };\n+\tctrls.set(V4L2_CID_TEST_PATTERN, it->second);\n+\n+\tint ret = setControls(&ctrls);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\ttestPatternMode_ = testPatternMode;\n+\n+\treturn 0;\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",
        "2/2"
    ]
}