Patch Detail
Show a patch.
GET /api/patches/14042/?format=api
{ "id": 14042, "url": "https://patchwork.libcamera.org/api/patches/14042/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14042/", "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": "<20211005043723.568685-1-hiroh@chromium.org>", "date": "2021-10-05T04:37:23", "name": "[libcamera-devel] libcamera: camera_sensor: Enable to set a test pattern mode", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "b64344f26764a2f550e8a58ef521ba106a409623", "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/14042/mbox/", "series": [ { "id": 2600, "url": "https://patchwork.libcamera.org/api/series/2600/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2600", "date": "2021-10-05T04:37:23", "name": "[libcamera-devel] libcamera: camera_sensor: Enable to set a test pattern mode", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2600/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14042/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14042/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 556E1BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 5 Oct 2021 04:37:34 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A8B98691B6;\n\tTue, 5 Oct 2021 06:37:33 +0200 (CEST)", "from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com\n\t[IPv6:2607:f8b0:4864:20::102b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4F0126023D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 5 Oct 2021 06:37:32 +0200 (CEST)", "by mail-pj1-x102b.google.com with SMTP id v19so13124905pjh.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 04 Oct 2021 21:37:32 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:debc:d0db:3bd8:f961])\n\tby smtp.gmail.com with ESMTPSA id\n\tr8sm15776115pgp.30.2021.10.04.21.37.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 04 Oct 2021 21:37:29 -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=\"Q3YcqKy2\"; 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=wm9CI0zTYdCP1fcomBHQZ5l/2I8oLhDLJiJKKnThUss=;\n\tb=Q3YcqKy2bAcE/0lI4Xa17M/mAEJ5hc+rfYf+xBboTWMKxCsmsQCHbKYa+H3XYaVOFb\n\txIFtHtdidUOy8LxiVckC+CSZr2APynI4pJP6HZed7lUu2g+K85NNvyUCyVP4to3BSd0N\n\tf0rL9eiZLL6sKLqMnk6AlEvKGu8npIcNNSf4g=", "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=wm9CI0zTYdCP1fcomBHQZ5l/2I8oLhDLJiJKKnThUss=;\n\tb=CXSrfb59FIifjrEXQa9VItfl0SCD3TG54rlppek2m6zUOFMgEXTW3A8ypL2faBvZRe\n\twEnqeJ4/FPd37Tf+cqAPglr4NFSh5Qrl2bgd31Q6pDr5lSX8/6A3LaiR7L8t3Ev5d6mv\n\tjWVTKxlJOoC7cdzCOzEdO+DwRLC7mNd00e8LoueuKWHE7Kv2vorORuEjGVT/UGFeyHWu\n\t3eZs8qxHRvhlnCKSUshOTm1fH98Kn7tySjwCnF2v86B07uTY8qVmKNLQ1DxEb0+2nAcP\n\tkkvo9A/eqRwnha3U0sVFZqXsz3IGYQqJBHUhV7fnx3sQXMN+eL/4mMvgQnxm0RA9+kz0\n\tSAAQ==", "X-Gm-Message-State": "AOAM5309bYTc9BeMs73VXz9gs6yvDSd6JTzO6rDBWpqlDl+1n8DDsmE8\n\tMrSV6zJB0AmjO6uBOUNq9in83fh+j9c67Q==", "X-Google-Smtp-Source": "ABdhPJxRUccZ94sblXCsfrZd0lLq+oJyRSr1ePjmAdL/aJXSz+7zpH+uQrIin66rMSaVUi6hYv+I5w==", "X-Received": "by 2002:a17:902:8307:b0:13c:ac55:5e1d with SMTP id\n\tbd7-20020a170902830700b0013cac555e1dmr3274951plb.56.1633408649952; \n\tMon, 04 Oct 2021 21:37:29 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 5 Oct 2021 13:37:23 +0900", "Message-Id": "<20211005043723.568685-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: Enable to set a\n\ttest 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": "This adds a function to set a camera sensor driver a test pattern\nmode.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/internal/camera_sensor.h | 5 +++\n src/libcamera/camera_sensor.cpp | 46 +++++++++++++++++++---\n 2 files changed, 45 insertions(+), 6 deletions(-)", "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex d25a1165..df35df74 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -24,6 +24,7 @@\n namespace libcamera {\n \n class BayerFormat;\n+struct CameraSensorProperties;\n class MediaEntity;\n \n class CameraSensor : protected Loggable\n@@ -44,6 +45,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@@ -78,6 +80,8 @@ private:\n \tstd::unique_ptr<V4L2Subdevice> subdev_;\n \tunsigned int pad_;\n \n+\tconst CameraSensorProperties *props_;\n+\n \tstd::string model_;\n \tstd::string id_;\n \n@@ -85,6 +89,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 9fdb8c09..25b8c626 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@@ -300,14 +300,14 @@ void CameraSensor::initVimcDefaultProperties()\n \n void CameraSensor::initStaticProperties()\n {\n-\tconst CameraSensorProperties *props = CameraSensorProperties::get(model_);\n-\tif (!props)\n+\tprops_ = CameraSensorProperties::get(model_);\n+\tif (!props_)\n \t\treturn;\n \n \t/* Register the properties retrieved from the sensor database. */\n-\tproperties_.set(properties::UnitCellSize, props->unitCellSize);\n+\tproperties_.set(properties::UnitCellSize, props_->unitCellSize);\n \n-\tinitTestPatternModes(props->testPatternModes);\n+\tinitTestPatternModes(props_->testPatternModes);\n }\n \n void CameraSensor::initTestPatternModes(\n@@ -531,6 +531,40 @@ 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+\tif (!props_)\n+\t\treturn -EINVAL;\n+\n+\tauto it = props_->testPatternModes.find(testPatternMode);\n+\tif (it == props_->testPatternModes.end()) {\n+\t\tLOG(CameraSensor, Error) << \"Unsupported test pattern mode: \"\n+\t\t\t\t\t << testPatternMode;\n+\t\treturn -EINVAL;\n+\t}\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" ] }