Show a patch.

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

{
    "id": 19047,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19047/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19047/",
    "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": "<20230916121930.29490-10-jacopo.mondi@ideasonboard.com>",
    "date": "2023-09-16T12:19:27",
    "name": "[libcamera-devel,v4,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/19047/mbox/",
    "series": [
        {
            "id": 4027,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4027/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4027",
            "date": "2023-09-16T12:19:18",
            "name": "libcamera: Introduce SensorConfiguration",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/4027/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19047/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19047/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 CEDFEC32B1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 16 Sep 2023 12:19:49 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5C2E462924;\n\tSat, 16 Sep 2023 14:19:49 +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 3DE2D62929\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 16 Sep 2023 14:19:41 +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 277461536;\n\tSat, 16 Sep 2023 14:18:07 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1694866789;\n\tbh=/ln7JqqBJ30qhFJf6xExSqV9yCyElhc+wER0kQIz3MI=;\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=gemnU+XvwySnPCDpomvVflJ71WX70mD92xDROfT5yDfXgVhp4JYqpWbI5I1pi0wxG\n\tm1ei7iJJh9NXmCUvR0/ax96KCO3gN1QTfAt4oU750U/hvmAJkC10tJ14jpYzYuAios\n\tC5mbH+YGnVmxaY9hO4p791tICBXslkCxkgaRO7VlTMK693lYD6Wgz+OeEjfwvpUTnQ\n\teq+r+0GOcTFkrKJ5hz1YOx9O/6eI9Zz0/4hJwr8/dmQfrOFZyHLUC0ALXUFR2vk9Vd\n\t1idXn42bru3HlS+Kbl74vTi5Jz6Yfu55eUAI8qbK1FO51+KOHpars8jgm55yUyGAZq\n\tsq58cHox0Xh2w==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1694866687;\n\tbh=/ln7JqqBJ30qhFJf6xExSqV9yCyElhc+wER0kQIz3MI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=kveqQFe6bZRWxbIFeLAd/aoP4LWCtpZyimpdSfVWsBAoFNvy2iXbguSDHB0siYNyq\n\toS5I1yT3taOp8yNzsfISImepryKGPRDi13GaLqbvRN9DcywXVYUMCDVx+LELe9A90m\n\tGDGCCITtcg2q4xErXljgdq/zpyb1EpSu7GeyU3Dc="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"kveqQFe6\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 16 Sep 2023 14:19:27 +0200",
        "Message-ID": "<20230916121930.29490-10-jacopo.mondi@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.42.0",
        "In-Reply-To": "<20230916121930.29490-1-jacopo.mondi@ideasonboard.com>",
        "References": "<20230916121930.29490-1-jacopo.mondi@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 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 e7fedca7cc8d..93779556fd81 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",
        "v4",
        "09/12"
    ]
}