Show a patch.

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

{
    "id": 16468,
    "url": "https://patchwork.libcamera.org/api/patches/16468/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16468/",
    "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": "<20220630133902.321099-11-jacopo@jmondi.org>",
    "date": "2022-06-30T13:38:49",
    "name": "[libcamera-devel,v3,10/23] libcamera: camera_sensor: Initialize delayed controls",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "68dba7049128e83635ac3c113cfedee974e314b1",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16468/mbox/",
    "series": [
        {
            "id": 3238,
            "url": "https://patchwork.libcamera.org/api/series/3238/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3238",
            "date": "2022-06-30T13:38:39",
            "name": "Internal controls, sensor delays and IPA rework",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/3238/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16468/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16468/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 838A1BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Jun 2022 13:39:35 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0C87A6569A;\n\tThu, 30 Jun 2022 15:39:35 +0200 (CEST)",
            "from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[217.70.183.193])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A3E1865633\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Jun 2022 15:39:30 +0200 (CEST)",
            "(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id DA3EB240005;\n\tThu, 30 Jun 2022 13:39:29 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656596375;\n\tbh=ENxgh+HpD1p1yd5Rr9RIkQiW7aCtBzXEuxUFTVVDPp0=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=ZkmVlCNUuxvWBoVIOswc0R7Cw9o/VgA2cCRRzAYsTev70HjBiZXGDNedwHpRcH0Qn\n\ty802fXqYbhUxpSXFE96DVDtqqcE1ZFAehYk6SjXHxU9xIeuxchApO5MByS6SDYRTts\n\tTpb2HxjDRgWYzZRejQst6DK3xs8cO6rTsAbYHdOuRQtmporCRpqXDL35t321uDJ4L2\n\t8z/N+sGzRB9fpF6RCBvFAU0uRT8IdI2kYCNqjF3+LwqL+xzupYH8JM1Ehkz0I0z9cf\n\t3uXL/Vnh8kNlAQoVYpO34iJhfJmaVWsmK7728ckGcBR/fFXKRwf0KFz7FBkhWI2U0K\n\tBkb7M6OzeeRdg==",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 30 Jun 2022 15:38:49 +0200",
        "Message-Id": "<20220630133902.321099-11-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.36.1",
        "In-Reply-To": "<20220630133902.321099-1-jacopo@jmondi.org>",
        "References": "<20220630133902.321099-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 10/23] libcamera: camera_sensor:\n\tInitialize delayed controls",
        "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>",
        "From": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Jacopo Mondi <jacopo@jmondi.org>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Add to the CameraSensor class an instance of the DelayedControls\nclass and initialize it using the sensor delays registered in camera\nsensor static properties.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/camera_sensor.h    |  3 ++\n src/libcamera/camera_sensor/camera_sensor.cpp | 41 +++++++++++++++++++\n 2 files changed, 44 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex 1eab5e9d53f0..bd5aa0dbc27d 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -21,6 +21,7 @@\n #include <libcamera/ipa/core_ipa_interface.h>\n \n #include \"libcamera/internal/camera_sensor_helper.h\"\n+#include \"libcamera/internal/delayed_controls.h\"\n #include \"libcamera/internal/formats.h\"\n #include \"libcamera/internal/v4l2_subdevice.h\"\n \n@@ -82,6 +83,7 @@ private:\n \tvoid initStaticProperties();\n \tvoid initTestPatternModes();\n \tint initProperties();\n+\tint initDelayedControls();\n \tint updateControls();\n \tint applyTestPatternMode(controls::draft::TestPatternModeEnum mode);\n \tint discoverAncillaryDevices();\n@@ -110,6 +112,7 @@ private:\n \n \tstd::unique_ptr<CameraLens> focusLens_;\n \tstd::unique_ptr<CameraSensorHelper> helper_;\n+\tstd::unique_ptr<DelayedControls> delayedCtrls_;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/camera_sensor/camera_sensor.cpp b/src/libcamera/camera_sensor/camera_sensor.cpp\nindex 976d34aaf876..211c7461f5c6 100644\n--- a/src/libcamera/camera_sensor/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor/camera_sensor.cpp\n@@ -189,6 +189,10 @@ int CameraSensor::init()\n \tif (ret)\n \t\treturn ret;\n \n+\tret = initDelayedControls();\n+\tif (ret)\n+\t\treturn ret;\n+\n \treturn applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff);\n }\n \n@@ -460,6 +464,43 @@ int CameraSensor::initProperties()\n \treturn 0;\n }\n \n+int CameraSensor::initDelayedControls()\n+{\n+\t/* If no static priorities are available, all controls have delay 0. */\n+\tstatic const CameraSensorProperties::SensorDelays noDelays{};\n+\tconst CameraSensorProperties::SensorDelays *delays = staticProps_\n+\t\t\t\t\t\t\t   ? &staticProps_->sensorDelays\n+\t\t\t\t\t\t\t   : &noDelays;\n+\n+\tconst std::map<uint32_t, const ControlId *> controlsMap{\n+\t\t{ V4L2_CID_ANALOGUE_GAIN, &controls::internal::AnalogueGain },\n+\t\t{ V4L2_CID_EXPOSURE, &controls::internal::ExposureTime },\n+\t\t{ V4L2_CID_VBLANK, &controls::internal::FrameDuration },\n+\t};\n+\n+\tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params;\n+\tfor (const auto &[v4l2Ctrl, ctrl] : controlsMap) {\n+\t\tuint32_t delay = 0;\n+\n+\t\t/*\n+\t\t * If the control is not registered in the delays map, assume 0\n+\t\t * as delay.\n+\t\t */\n+\t\tauto it = delays->find(ctrl);\n+\t\tif (it != delays->end())\n+\t\t\tdelay = it->second;\n+\n+\t\t/* VBLANK needs the priority flag set. */\n+\t\tbool priority = v4l2Ctrl == V4L2_CID_VBLANK ? true : false;\n+\n+\t\tparams[v4l2Ctrl] = { delay, priority };\n+\t}\n+\n+\tdelayedCtrls_ = std::make_unique<DelayedControls>(device(), params);\n+\n+\treturn 0;\n+}\n+\n int CameraSensor::updateControls()\n {\n \tif (!bayerFormat_)\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "10/23"
    ]
}