Show a patch.

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

{
    "id": 19073,
    "url": "https://patchwork.libcamera.org/api/patches/19073/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19073/",
    "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": "<20230921165550.50956-10-jacopo.mondi@ideasonboard.com>",
    "date": "2023-09-21T16:55:46",
    "name": "[libcamera-devel,v5,09/13] 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/people/143/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo.mondi@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19073/mbox/",
    "series": [
        {
            "id": 4034,
            "url": "https://patchwork.libcamera.org/api/series/4034/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4034",
            "date": "2023-09-21T16:55:37",
            "name": "libcamera: Introduce SensorConfiguration",
            "version": 5,
            "mbox": "https://patchwork.libcamera.org/series/4034/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19073/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19073/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 277BEBE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 Sep 2023 16:56:13 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9A73462953;\n\tThu, 21 Sep 2023 18:56:11 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 290826294D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Sep 2023 18:56:05 +0200 (CEST)",
            "from uno.lan (93-46-82-201.ip106.fastwebnet.it [93.46.82.201])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9D3E42F6C;\n\tThu, 21 Sep 2023 18:54:27 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1695315371;\n\tbh=feqIYvUqFwwlOexfM6mLCpiGUPOe/6b+Cl5NSJ5mV1c=;\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=NLH0uTLYpQPl9cO//UcbG46IQwJHHqoZb3X8HIyLX20SQ06M95nW/sWlQqYrb/YjE\n\tUlbUaYk1YnCbPNIjTZskEzYPIBmxPIH2pTZ86shqqOOzsZ0FWXiAM6eiBN+B1gQpwB\n\tHMcttO4LYuO3JAOHu63whGHbnU14/coTdX3Ce6d4DZHQXeTqwLPLLfx9WphoaBqAy6\n\tHe5JUrUO7P/Bs/XqfKudH9LUZ+rFpcVOW2h9i+40uqQomJadEESj7368bc9+J9ivGz\n\trxWpxxXu6/2lvjO0v5eH5QDYSodHN3bXCyUY2KHbA8uVyIJPrUUnZ91Y4wVAl1ECT2\n\t7S+bC0Ch2n0xA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1695315267;\n\tbh=feqIYvUqFwwlOexfM6mLCpiGUPOe/6b+Cl5NSJ5mV1c=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Vs9YiXGIyOkGnJFa71YMrMDVT5NclADtAiP7jtL9DxF6SjaIihH5l/tj/Zx7sEtss\n\tQt/HESz2VRU3UfTz/07Nj3nC2vCMqjsOqJcnPWdRLcGb1P137wndVbvgND0tqvkzDI\n\t9M3KblWll31xVP+9za+/+92NzuBxofOMraYOEeq8="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Vs9YiXGI\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 21 Sep 2023 18:55:46 +0200",
        "Message-ID": "<20230921165550.50956-10-jacopo.mondi@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.42.0",
        "In-Reply-To": "<20230921165550.50956-1-jacopo.mondi@ideasonboard.com>",
        "References": "<20230921165550.50956-1-jacopo.mondi@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v5 09/13] 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 e36bdce229b6..f9b67563af17 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -353,6 +353,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",
        "v5",
        "09/13"
    ]
}