Show a patch.

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

{
    "id": 24740,
    "url": "https://patchwork.libcamera.org/api/patches/24740/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24740/",
    "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": "<20251023144841.403689-13-stefan.klug@ideasonboard.com>",
    "date": "2025-10-23T14:48:13",
    "name": "[v2,12/35] libcamera: converter_v4l2_m2m: Add helper to apply controls",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "7384fdf63475df695e5e10660cdbe367a9ef9e81",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/24740/mbox/",
    "series": [
        {
            "id": 5520,
            "url": "https://patchwork.libcamera.org/api/series/5520/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5520",
            "date": "2025-10-23T14:48:01",
            "name": "Full dewarper support on imx8mp",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5520/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24740/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24740/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 0FD40C3331\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Oct 2025 14:49:25 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AB5C360811;\n\tThu, 23 Oct 2025 16:49:24 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 43AD160803\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Oct 2025 16:49:22 +0200 (CEST)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:7328:357b:4ce1:72b6])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 4E2F2EFE;\n\tThu, 23 Oct 2025 16:47:37 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Rnk0QDZh\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761230857;\n\tbh=7FkM8Y3TcCjkciHfIi7EET5p0hjejxGMzSOiDuFEngA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Rnk0QDZhyoMM2QxolnXI9z16eiDPYShX9nRbW5qLf+9LdXfgBQp/P6+XaA+NT214m\n\tsEM6FVQA9oV3D1ZcJMFgSIAO963POVR4I33gGdIRPGQBE6fzPiKFeMu7fxW7e5IVuH\n\tCTRVvkEmo3yxlfXjJV2GYjntKEzqJVkyEzGW/cb4=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>,\n\tUmang Jain <umang.jain@ideasonboard.com>",
        "Subject": "[PATCH v2 12/35] libcamera: converter_v4l2_m2m: Add helper to apply\n\tcontrols",
        "Date": "Thu, 23 Oct 2025 16:48:13 +0200",
        "Message-ID": "<20251023144841.403689-13-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.48.1",
        "In-Reply-To": "<20251023144841.403689-1-stefan.klug@ideasonboard.com>",
        "References": "<20251023144841.403689-1-stefan.klug@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "From: Umang Jain <umang.jain@ideasonboard.com>\n\nAdd applyControls() helper to apply controls for a stream.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n---\n\nChanges in v2:\n- Removed stray semicolon\n- Added documentation\n\nChanges in v0.9\n- Include request support in applyControls\n---\n .../internal/converter/converter_v4l2_m2m.h   |  5 +++\n .../converter/converter_v4l2_m2m.cpp          | 34 +++++++++++++++++++\n 2 files changed, 39 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h\nindex bc85bff7a07b..6d2453bb9e06 100644\n--- a/include/libcamera/internal/converter/converter_v4l2_m2m.h\n+++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h\n@@ -24,6 +24,7 @@\n \n namespace libcamera {\n \n+class ControlList;\n class FrameBuffer;\n class MediaDevice;\n class Size;\n@@ -73,6 +74,8 @@ public:\n \tstd::pair<Rectangle, Rectangle> inputCropBounds() override { return inputCropBounds_; }\n \tstd::pair<Rectangle, Rectangle> inputCropBounds(const Stream *stream) override;\n \n+\tint applyControls(const Stream *stream, ControlList &ctrls, const V4L2Request *request = nullptr);\n+\n \tint allocateRequests(unsigned int count,\n \t\t\t     std::vector<std::unique_ptr<V4L2Request>> *requests);\n \n@@ -94,6 +97,8 @@ private:\n \t\tint start();\n \t\tvoid stop();\n \n+\t\tint applyControls(ControlList &ctrls, const V4L2Request *request = nullptr);\n+\n \t\tint queueBuffers(FrameBuffer *input, FrameBuffer *output,\n \t\t\t\t const V4L2Request *request = nullptr);\n \ndiff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp\nindex e57db8a438ab..48e49f143cf1 100644\n--- a/src/libcamera/converter/converter_v4l2_m2m.cpp\n+++ b/src/libcamera/converter/converter_v4l2_m2m.cpp\n@@ -18,6 +18,7 @@\n #include <libcamera/base/signal.h>\n #include <libcamera/base/utils.h>\n \n+#include <libcamera/controls.h>\n #include <libcamera/framebuffer.h>\n #include <libcamera/geometry.h>\n #include <libcamera/stream.h>\n@@ -251,6 +252,20 @@ void V4L2M2MConverter::V4L2M2MStream::captureBufferReady(FrameBuffer *buffer)\n \tconverter_->outputBufferReady.emit(buffer);\n }\n \n+/**\n+ * \\brief Apply controls\n+ * \\param[in] ctrls The controls to apply\n+ * \\param[in] request An optional request\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ * \\see V4L2Device::setControls()\n+ */\n+int V4L2M2MConverter::V4L2M2MStream::applyControls(ControlList &ctrls,\n+\t\t\t\t\t\t   const V4L2Request *request)\n+{\n+\treturn m2m_->capture()->setControls(&ctrls, request);\n+}\n+\n /* -----------------------------------------------------------------------------\n  * V4L2M2MConverter\n  */\n@@ -744,6 +759,25 @@ int V4L2M2MConverter::queueBuffers(FrameBuffer *input,\n \treturn 0;\n }\n \n+/**\n+ * \\brief Apply controls\n+ * \\param[in] stream The stream on which to apply the controls\n+ * \\param[in] ctrls The controls to apply\n+ * \\param[in] request An optional request\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ * \\see V4L2Device::setControls()\n+ */\n+int V4L2M2MConverter::applyControls(const Stream *stream, ControlList &ctrls,\n+\t\t\t\t    const V4L2Request *request)\n+{\n+\tauto iter = streams_.find(stream);\n+\tif (iter == streams_.end())\n+\t\treturn -EINVAL;\n+\n+\treturn iter->second->applyControls(ctrls, request);\n+}\n+\n /**\n  * \\copydoc libcamera::MediaDevice::allocateRequests\n  */\n",
    "prefixes": [
        "v2",
        "12/35"
    ]
}