Show a patch.

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

{
    "id": 19028,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19028/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19028/",
    "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": "<20230915130650.35691-10-jacopo.mondi@ideasonboard.com>",
    "date": "2023-09-15T13:06:47",
    "name": "[libcamera-devel,v3,09/12] libcamera: rpi: Add some helpers to PipelineHandlerBase",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "adbeb113425b6230a0f067444217f5fd1769f9c6",
    "submitter": {
        "id": 143,
        "url": "https://patchwork.libcamera.org/api/1.1/people/143/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo.mondi@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19028/mbox/",
    "series": [
        {
            "id": 4025,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4025/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4025",
            "date": "2023-09-15T13:06:38",
            "name": "libcamera: Introduce SensorConfiguration",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/4025/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19028/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19028/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 8F90EC32B2\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Sep 2023 13:07:19 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3FD536292C;\n\tFri, 15 Sep 2023 15:07:19 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C1BD962911\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Sep 2023 15:07:11 +0200 (CEST)",
            "from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 596292D14;\n\tFri, 15 Sep 2023 15:05:38 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1694783239;\n\tbh=PtshK3Pj861tS2DXW6ssL2SOgjz+CtZH76Y5B/BzOOE=;\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:Cc:\n\tFrom;\n\tb=kHkLGId8/VDleMiBf5rJ5CXb5pwdc3G3pyT3PEPe73jJVWjuga6+sxDQxbyldLrA6\n\teQDRbMZXdIMuMlaOkOTWDMyupdrUl4eBuYmaMSTNMeXnDV7xRpd5da7Oz4FBa5xAAa\n\tI4oymmg8hklM9XpmJFIxlRE4LkSZVPHHxbQusvxoRb9wlWIkL9SeT8qQQgX6cqB/Wp\n\thE0lIIrCh8viiGYjVJhwvzQPC8nIMqZJON8IEqrSHMtT0zCsicA+bBHr3GSdGEcJHt\n\tw+K+GwY0WdmcAMyYxuW8srk664/UE8h/3yljECYgFOmUWVrl7wWGQI/33Y7jl+BRhs\n\tuoVkQxnhlrfqA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1694783138;\n\tbh=PtshK3Pj861tS2DXW6ssL2SOgjz+CtZH76Y5B/BzOOE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gIIOdFkfM8Q45l0hyBOjbxLFj3B0nDp5TrN9wRvSgA0ll63b7KaL+vhdZ8EioVDui\n\tOa6DJEr85z73Ml6qPbxQMzjjqUS0yyNN9euaqf9VJUwbWqf3FFpy1wrQcHhKWJL2zc\n\tvxXUopyGpwCGL9lH9OALu2qrtH/r++Zt7KwUj8Go="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"gIIOdFkf\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 15 Sep 2023 15:06:47 +0200",
        "Message-ID": "<20230915130650.35691-10-jacopo.mondi@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.42.0",
        "In-Reply-To": "<20230915130650.35691-1-jacopo.mondi@ideasonboard.com>",
        "References": "<20230915130650.35691-1-jacopo.mondi@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 09/12] libcamera: rpi: Add some helpers\n\tto PipelineHandlerBase",
        "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.mondi@ideasonboard.com>",
        "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: Naushir Patuck <naush@raspberrypi.com>\n\nAdd a helper updateStreamConfig() that updates the format related fields\nin a StreamConfiguration from a given V4L2DeviceFormat structure.\n\nAdd and override to the toV4L2DeviceFormat() helper that returns a\nV4L2DeviceFormat structure populated from the format related fields in\na StreamConfiguration.\n\nBoth these helper functions will be used in a future commit to simplify\nthe Raspberry Pi pipeline handler configuration/validation code.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n .../pipeline/rpi/common/pipeline_base.cpp     | 47 +++++++++++++++++++\n .../pipeline/rpi/common/pipeline_base.h       |  4 ++\n 2 files changed, 51 insertions(+)",
    "diff": "diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\nindex 0aa0c3a0fc7d..b523d560420a 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -349,6 +349,53 @@ bool PipelineHandlerBase::isRaw(const PixelFormat &pixFmt)\n \treturn BayerFormat::fromPixelFormat(pixFmt).isValid();\n }\n \n+/*\n+ * Adjust a StreamConfiguration fields to match a video device format.\n+ * Returns true if the StreamConfiguration has been adjusted.\n+ */\n+bool PipelineHandlerBase::updateStreamConfig(StreamConfiguration *stream,\n+\t\t\t\t\t     const V4L2DeviceFormat &format)\n+{\n+\tconst PixelFormat &pixFormat = format.fourcc.toPixelFormat();\n+\tbool adjusted = false;\n+\n+\tif (stream->pixelFormat != pixFormat || stream->size != format.size) {\n+\t\tstream->pixelFormat = pixFormat;\n+\t\tstream->size = format.size;\n+\t\tadjusted = true;\n+\t}\n+\n+\tif (stream->colorSpace != format.colorSpace) {\n+\t\tstream->colorSpace = format.colorSpace;\n+\t\tadjusted = true;\n+\t\tLOG(RPI, Debug)\n+\t\t\t<< \"Color space changed from \"\n+\t\t\t<< ColorSpace::toString(stream->colorSpace) << \" to \"\n+\t\t\t<< ColorSpace::toString(format.colorSpace);\n+\t}\n+\n+\tstream->stride = format.planes[0].bpl;\n+\tstream->frameSize = format.planes[0].size;\n+\n+\treturn adjusted;\n+}\n+\n+/*\n+ * Populate and return a video device format using a StreamConfiguration. */\n+V4L2DeviceFormat PipelineHandlerBase::toV4L2DeviceFormat(const V4L2VideoDevice *dev,\n+\t\t\t\t\t\t\t const StreamConfiguration *stream)\n+{\n+\tV4L2DeviceFormat deviceFormat;\n+\n+\tconst PixelFormatInfo &info = PixelFormatInfo::info(stream->pixelFormat);\n+\tdeviceFormat.planesCount = info.numPlanes();\n+\tdeviceFormat.fourcc = dev->toV4L2PixelFormat(stream->pixelFormat);\n+\tdeviceFormat.size = stream->size;\n+\tdeviceFormat.colorSpace = stream->colorSpace;\n+\n+\treturn deviceFormat;\n+}\n+\n V4L2DeviceFormat PipelineHandlerBase::toV4L2DeviceFormat(const V4L2VideoDevice *dev,\n \t\t\t\t\t\t\t const V4L2SubdeviceFormat &format,\n \t\t\t\t\t\t\t BayerFormat::Packing packingReq)\ndiff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.h b/src/libcamera/pipeline/rpi/common/pipeline_base.h\nindex 1a3a13dbb6cf..491c5e98c4a1 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.h\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.h\n@@ -198,6 +198,10 @@ public:\n \tstatic bool isYuv(const PixelFormat &pixFmt);\n \tstatic bool isRaw(const PixelFormat &pixFmt);\n \n+\tstatic bool updateStreamConfig(StreamConfiguration *stream,\n+\t\t\t\t       const V4L2DeviceFormat &format);\n+\tstatic V4L2DeviceFormat toV4L2DeviceFormat(const V4L2VideoDevice *dev,\n+\t\t\t\t\t\t   const StreamConfiguration *stream);\n \tstatic V4L2DeviceFormat toV4L2DeviceFormat(const V4L2VideoDevice *dev,\n \t\t\t\t\t\t   const V4L2SubdeviceFormat &format,\n \t\t\t\t\t\t   BayerFormat::Packing packingReq);\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "09/12"
    ]
}