Show a patch.

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

{
    "id": 24745,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/24745/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24745/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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-19-stefan.klug@ideasonboard.com>",
    "date": "2025-10-23T14:48:19",
    "name": "[v2,18/35] libcamera: converter_m2m: Make some parts protected",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "381c35b80d22aacfec47d635a05fd762628301e2",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/24745/mbox/",
    "series": [
        {
            "id": 5520,
            "url": "https://patchwork.libcamera.org/api/1.1/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/24745/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24745/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 03B18C333C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Oct 2025 14:49:41 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5DA3B6081D;\n\tThu, 23 Oct 2025 16:49:41 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A3F8B60805\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Oct 2025 16:49:40 +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 A3C7E591;\n\tThu, 23 Oct 2025 16:47:55 +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=\"Kr5+X9sk\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761230875;\n\tbh=pd+DFxuBTqdfIbDhvLPeoBe2m2oY+1pIzgQ0LsDtZz8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Kr5+X9skKniY8p7UGXojnuCkhkaXcwDeXJ8HxQ/M1+C6BiJAfEbBE47q0BicFVlP0\n\tUD08tIcLcuKqyrfwIgzKwUI3S0pzcg2FGoxA3qmJWqAqsKzuj7Jgee2yIdoyU8V3Hu\n\t9TnohXoiCRmb7uhMOiFOi0hR5wSoxCF6CEdF+TiU=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH v2 18/35] libcamera: converter_m2m: Make some parts protected",
        "Date": "Thu, 23 Oct 2025 16:48:19 +0200",
        "Message-ID": "<20251023144841.403689-19-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": "In order to derive from V4L2M2MConverter and also from V4L2M2MStream in\na subclass, raise the visibility of most of the private parts to\nprotected and document them.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n---\n\nChanges in v2:\n- Added this patch\n---\n .../internal/converter/converter_v4l2_m2m.h   |   7 +-\n .../converter/converter_v4l2_m2m.cpp          | 107 ++++++++++++++++++\n 2 files changed, 111 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h\nindex 2d6f361c17e1..79d008fc6918 100644\n--- a/include/libcamera/internal/converter/converter_v4l2_m2m.h\n+++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h\n@@ -81,7 +81,7 @@ public:\n \n \tbool supportsRequests();\n \n-private:\n+protected:\n \tclass V4L2M2MStream : protected Loggable\n \t{\n \tpublic:\n@@ -130,12 +130,13 @@ private:\n \tvirtual std::unique_ptr<V4L2M2MStream> makeStream(const Stream *stream);\n \n \tstd::unique_ptr<V4L2M2MDevice> m2m_;\n+\tstd::shared_ptr<MediaDevice> media_;\n \n \tstd::map<const Stream *, std::unique_ptr<V4L2M2MStream>> streams_;\n+\n+private:\n \tstd::map<FrameBuffer *, unsigned int> queue_;\n \tstd::pair<Rectangle, Rectangle> inputCropBounds_;\n-\n-\tstd::shared_ptr<MediaDevice> media_;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp\nindex 2e3966444361..3a05e45ac33c 100644\n--- a/src/libcamera/converter/converter_v4l2_m2m.cpp\n+++ b/src/libcamera/converter/converter_v4l2_m2m.cpp\n@@ -86,6 +86,28 @@ int getCropBounds(V4L2VideoDevice *device, Rectangle &minCrop,\n  * V4L2M2MConverter::V4L2M2MStream\n  */\n \n+/**\n+ * \\class libcamera::V4L2M2MConverter::V4L2M2MStream\n+ * \\brief The V4L2 M2M stream represents a stream in a V4L2M2MConverter\n+ *\n+ * The Converter interface allows to create multiple output image streams from\n+ * a single input image stream. This class represents one such stream.\n+ */\n+\n+/**\n+ * \\fn V4L2M2MConverter::V4L2M2MStream::isValid\n+ * \\brief Checks if the stream is valid\n+ *\n+ * This function checks if the underlying m2m device is valid.\n+ *\n+ * \\return True if the stream is valid, false otherwise\n+ */\n+\n+/**\n+ * \\brief Constructs a V4L2M2MStream\n+ * \\param[in] converter The converter this stream belongs to\n+ * \\param[in] stream The stream this V4L2M2MStream represents\n+ */\n V4L2M2MConverter::V4L2M2MStream::V4L2M2MStream(V4L2M2MConverter *converter, const Stream *stream)\n \t: converter_(converter), stream_(stream)\n {\n@@ -99,6 +121,13 @@ V4L2M2MConverter::V4L2M2MStream::V4L2M2MStream(V4L2M2MConverter *converter, cons\n \t\tm2m_.reset();\n }\n \n+/**\n+ * \\brief Configure the stream\n+ * \\param[in] inputCfg The input config\n+ * \\param[in] outputCfg The output config\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n int V4L2M2MConverter::V4L2M2MStream::configure(const StreamConfiguration &inputCfg,\n \t\t\t\t\t       const StreamConfiguration &outputCfg)\n {\n@@ -161,12 +190,24 @@ int V4L2M2MConverter::V4L2M2MStream::configure(const StreamConfiguration &inputC\n \treturn 0;\n }\n \n+/**\n+ * \\brief Export buffers\n+ * \\param[in] count The number of buffers\n+ * \\param[out] buffers The exported buffers\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n int V4L2M2MConverter::V4L2M2MStream::exportBuffers(unsigned int count,\n \t\t\t\t\t\t   std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n {\n \treturn m2m_->capture()->exportBuffers(count, buffers);\n }\n \n+/**\n+ * \\brief Start the stream\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n int V4L2M2MConverter::V4L2M2MStream::start()\n {\n \tint ret = m2m_->output()->importBuffers(inputBufferCount_);\n@@ -194,6 +235,9 @@ int V4L2M2MConverter::V4L2M2MStream::start()\n \treturn 0;\n }\n \n+/**\n+ * \\brief Stop the stream\n+ */\n void V4L2M2MConverter::V4L2M2MStream::stop()\n {\n \tm2m_->capture()->streamOff();\n@@ -202,6 +246,14 @@ void V4L2M2MConverter::V4L2M2MStream::stop()\n \tm2m_->output()->releaseBuffers();\n }\n \n+/**\n+ * \\brief Queue buffers\n+ * \\param[in] input The input buffer\n+ * \\param[in] output The output buffer\n+ * \\param[in] request An optional request\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n int V4L2M2MConverter::V4L2M2MStream::queueBuffers(FrameBuffer *input,\n \t\t\t\t\t\t  FrameBuffer *output,\n \t\t\t\t\t\t  const V4L2Request *request)\n@@ -217,16 +269,35 @@ int V4L2M2MConverter::V4L2M2MStream::queueBuffers(FrameBuffer *input,\n \treturn 0;\n }\n \n+/**\n+ * \\brief Get the input selection rectangle\n+ * \\param[in] target The selection target\n+ * \\param[out] rect The selection rectangle\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n int V4L2M2MConverter::V4L2M2MStream::getInputSelection(unsigned int target, Rectangle *rect)\n {\n \treturn m2m_->output()->getSelection(target, rect);\n }\n \n+/**\n+ * \\brief Set the input selection rectangle\n+ * \\param[in] target The selection target\n+ * \\param[in] rect The selection rectangle\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n int V4L2M2MConverter::V4L2M2MStream::setInputSelection(unsigned int target, Rectangle *rect)\n {\n \treturn m2m_->output()->setSelection(target, rect);\n }\n \n+/**\n+ * \\brief Get the input crop bounds\n+ *\n+ * \\return A pair of rectangles representing the min and max input crop bounds\n+ */\n std::pair<Rectangle, Rectangle> V4L2M2MConverter::V4L2M2MStream::inputCropBounds()\n {\n \treturn inputCropBounds_;\n@@ -461,6 +532,19 @@ Size V4L2M2MConverter::adjustOutputSize(const PixelFormat &pixFmt,\n \treturn adjustSizes(size, it->second, align);\n }\n \n+/**\n+ * \\brief Adjust the converter output \\a size to a valid value\n+ * \\param[in] cfgSize The requested size\n+ * \\param[in] ranges The possible sizes\n+ * \\param[in] align The desired alignment\n+ *\n+ * Selects the best fitting size from \\a ranges according to \\a align and\n+ * returns that.\n+ *\n+ * \\return The adjusted converter output size or a null Size if \\a size cannot\n+ * be adjusted\n+ * \\see libcamera::Converter::adjustOutputSize\n+ */\n Size V4L2M2MConverter::adjustSizes(const Size &cfgSize,\n \t\t\t\t   const std::vector<SizeRange> &ranges,\n \t\t\t\t   Alignment align)\n@@ -810,11 +894,34 @@ bool V4L2M2MConverter::supportsRequests()\n \treturn ret;\n }\n \n+/**\n+ * \\brief Create a V4L2M2MStream\n+ * \\param[in] stream The stream to wrap\n+ *\n+ * This function creates a new V4L2M2MConverter::V4L2M2MStream for this\n+ * converter and the provided \\a stream.\n+ *\n+ * This function can be overwritten by subclasses to be able provide their own\n+ * stream implementation.\n+ *\n+ * \\return The created V4L2M2MStream\n+ */\n std::unique_ptr<V4L2M2MConverter::V4L2M2MStream> V4L2M2MConverter::makeStream(const Stream *stream)\n {\n \treturn std::make_unique<V4L2M2MConverter::V4L2M2MStream>(this, stream);\n }\n \n+/**\n+ * \\var V4L2M2MConverter::m2m_\n+ * \\brief The underlying m2m device\n+ *\n+ * \\var V4L2M2MConverter::media_\n+ * \\brief The underlying media device\n+ *\n+ * \\var V4L2M2MConverter::streams_\n+ * \\brief Map of Stream pointers to V4L2M2MStream unique pointers\n+ */\n+\n /*\n  * \\todo This should be extended to include Feature::Flag to denote\n  * what each converter supports feature-wise.\n",
    "prefixes": [
        "v2",
        "18/35"
    ]
}