Show a patch.

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

{
    "id": 14800,
    "url": "https://patchwork.libcamera.org/api/patches/14800/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14800/",
    "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": "<20211126104045.4756-5-david.plowman@raspberrypi.com>",
    "date": "2021-11-26T10:40:42",
    "name": "[libcamera-devel,v7,4/7] libcamera: Support passing ColorSpaces to V4L2 video devices",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2f0bfb63714ea8b0462c4c1fdc0c06944427fd07",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14800/mbox/",
    "series": [
        {
            "id": 2761,
            "url": "https://patchwork.libcamera.org/api/series/2761/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2761",
            "date": "2021-11-26T10:40:38",
            "name": "Colour spaces",
            "version": 7,
            "mbox": "https://patchwork.libcamera.org/series/2761/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14800/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14800/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 989A6BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Nov 2021 10:41:08 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 229A76056D;\n\tFri, 26 Nov 2021 11:41:07 +0100 (CET)",
            "from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 51528604FD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Nov 2021 11:41:02 +0100 (CET)",
            "by mail-wr1-x42a.google.com with SMTP id t9so714908wrx.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Nov 2021 02:41:02 -0800 (PST)",
            "from pi4-davidp.pitowers.org\n\t([2a00:1098:3142:14:e4a2:3070:eea4:e434])\n\tby smtp.gmail.com with ESMTPSA id\n\ty7sm5106795wrw.55.2021.11.26.02.41.01\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 26 Nov 2021 02:41:01 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"rOQjdL/U\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=wHD2U/BDIz9i1ybZ6mxu9fSHa6cLozW0JrsZbuoIEVw=;\n\tb=rOQjdL/UnFgmdMWb6Q03b+0mJxAtUhYyM0SATqBjXG70PoPPoGCuOoyxyfGKU8lZ4g\n\tOcnp8zHNwvc28R+L4C+2McIXM32GeqvVNBms1RERgSWOAH7ajus++g6gfIrXHgTnFCrH\n\tmCfNBkdIhyZPwNXxcTkv84rK4uh9POxZs1TblrVpr2+i1TOo4WNQCoyTcfXxeqsyvb5P\n\tYBySAWeM3c0Eb+WV702mOoj3enlu8T3b3ZBUv5ejgafptdHMFlQBLze8QB7qGHNMigFM\n\t+HI80d4lF5VpLPfp7KmvmpkrKRPMNe3PRsn8BiaXOG1Y6bbIhyJkluT+O44jh9ZMDGVH\n\tiFQQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=wHD2U/BDIz9i1ybZ6mxu9fSHa6cLozW0JrsZbuoIEVw=;\n\tb=m0y3ujLPwLal9Lz4ptDhg9BsgJqI6isWaqWHTDK4EL2DXTq5j5BTlHzOsQZTWUcFj+\n\tjZ2lnDPqJ9hs2VoBEyI1l6DRJotcbpFYOrmMSZJUeComrV+aqhC0SIoJ6Ip/eaFj5CcO\n\tE45sDIbmd7HAWeEH0UEEvJylj0KWPUjG0pduxtsoC0EJ8fV+q59MTPC7Qq04twNTQpKt\n\tTgl+l4SZEs4TewYs4VG9j2SMsJ7bNnvxVIoNEhzdAFunBIRnyDRuVrBZZh9JJlUySmF+\n\tDpw/Q2SumSnuWYB3CgACFIpNPfBVK1p2XvuV4xtNQDeN7keAgEdD+Rncw+1gHuzPjHKi\n\t6Z8w==",
        "X-Gm-Message-State": "AOAM530XkgTTosbIF6rFNfvOhnfWMvS/eRjZtP3SvCnIoDtpExJjuHG0\n\tHIMIzWWsXln5hSAa4a9I716JhA==",
        "X-Google-Smtp-Source": "ABdhPJz2GikRAstmh2iH/E8HkUA+esjGDJn6gHU5d/FalDl6mnU/yhc+sojYPJBxluVtg6eMqjoC9w==",
        "X-Received": "by 2002:a05:6000:18a7:: with SMTP id\n\tb7mr13408075wri.308.1637923261999; \n\tFri, 26 Nov 2021 02:41:01 -0800 (PST)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tHans Verkuil <hverkuil-cisco@xs4all.nl>, Tomasz Figa <tfiga@google.com>, \n\tJacopo Mondi <jacopo@jmondi.org>,\n\tNaushir Patuck <naush@raspberrypi.com>, \n\tlibcamera-devel@lists.libcamera.org",
        "Date": "Fri, 26 Nov 2021 10:40:42 +0000",
        "Message-Id": "<20211126104045.4756-5-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20211126104045.4756-1-david.plowman@raspberrypi.com>",
        "References": "<20211126104045.4756-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v7 4/7] libcamera: Support passing\n\tColorSpaces to V4L2 video devices",
        "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": "The ColorSpace from the StreamConfiguration is now handled\nappropriately in the V4L2VideoDevice.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/internal/v4l2_videodevice.h |  2 ++\n src/libcamera/v4l2_videodevice.cpp            | 32 +++++++++++++++++++\n 2 files changed, 34 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\nindex 4a44b7fd..602f40fb 100644\n--- a/include/libcamera/internal/v4l2_videodevice.h\n+++ b/include/libcamera/internal/v4l2_videodevice.h\n@@ -20,6 +20,7 @@\n #include <libcamera/base/log.h>\n #include <libcamera/base/signal.h>\n \n+#include <libcamera/color_space.h>\n #include <libcamera/framebuffer.h>\n #include <libcamera/geometry.h>\n #include <libcamera/pixel_format.h>\n@@ -167,6 +168,7 @@ public:\n \n \tV4L2PixelFormat fourcc;\n \tSize size;\n+\tstd::optional<ColorSpace> colorSpace;\n \n \tstd::array<Plane, 3> planes;\n \tunsigned int planesCount = 0;\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 4f04212d..c8f78602 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -383,6 +383,21 @@ bool V4L2BufferCache::Entry::operator==(const FrameBuffer &buffer) const\n  * that identifies the image format pixel encoding scheme.\n  */\n \n+/**\n+ * \\var V4L2DeviceFormat::colorSpace\n+ * \\brief The color space of the pixels\n+ *\n+ * The color space of the image. When setting the format this may be\n+ * unset, in which case the driver gets to use its default color space.\n+ * After being set, this value should contain the color space that\n+ * was actually used. If this value is unset, then the color space chosen\n+ * by the driver could not be represented by the ColorSpace class (and\n+ * should probably be added).\n+ *\n+ * It is up to the pipeline handler or application to check if the\n+ * resulting color space is acceptable.\n+ */\n+\n /**\n  * \\var V4L2DeviceFormat::planes\n  * \\brief The per-plane memory size information\n@@ -878,6 +893,7 @@ int V4L2VideoDevice::getFormatMultiplane(V4L2DeviceFormat *format)\n \tformat->size.height = pix->height;\n \tformat->fourcc = V4L2PixelFormat(pix->pixelformat);\n \tformat->planesCount = pix->num_planes;\n+\tformat->colorSpace = toColorSpace(*pix);\n \n \tfor (unsigned int i = 0; i < format->planesCount; ++i) {\n \t\tformat->planes[i].bpl = pix->plane_fmt[i].bytesperline;\n@@ -900,6 +916,12 @@ int V4L2VideoDevice::trySetFormatMultiplane(V4L2DeviceFormat *format, bool set)\n \tpix->num_planes = format->planesCount;\n \tpix->field = V4L2_FIELD_NONE;\n \n+\tret = fromColorSpace(format->colorSpace, *pix);\n+\tif (ret < 0)\n+\t\tLOG(V4L2, Warning)\n+\t\t\t<< \"Setting color space unrecognised by V4L2: \"\n+\t\t\t<< ColorSpace::toString(format->colorSpace);\n+\n \tASSERT(pix->num_planes <= std::size(pix->plane_fmt));\n \n \tfor (unsigned int i = 0; i < pix->num_planes; ++i) {\n@@ -927,6 +949,7 @@ int V4L2VideoDevice::trySetFormatMultiplane(V4L2DeviceFormat *format, bool set)\n \t\tformat->planes[i].bpl = pix->plane_fmt[i].bytesperline;\n \t\tformat->planes[i].size = pix->plane_fmt[i].sizeimage;\n \t}\n+\tformat->colorSpace = toColorSpace(*pix);\n \n \treturn 0;\n }\n@@ -950,6 +973,7 @@ int V4L2VideoDevice::getFormatSingleplane(V4L2DeviceFormat *format)\n \tformat->planesCount = 1;\n \tformat->planes[0].bpl = pix->bytesperline;\n \tformat->planes[0].size = pix->sizeimage;\n+\tformat->colorSpace = toColorSpace(*pix);\n \n \treturn 0;\n }\n@@ -966,6 +990,13 @@ int V4L2VideoDevice::trySetFormatSingleplane(V4L2DeviceFormat *format, bool set)\n \tpix->pixelformat = format->fourcc;\n \tpix->bytesperline = format->planes[0].bpl;\n \tpix->field = V4L2_FIELD_NONE;\n+\n+\tret = fromColorSpace(format->colorSpace, *pix);\n+\tif (ret < 0)\n+\t\tLOG(V4L2, Warning)\n+\t\t\t<< \"Set color space unrecognised by V4L2: \"\n+\t\t\t<< ColorSpace::toString(format->colorSpace);\n+\n \tret = ioctl(set ? VIDIOC_S_FMT : VIDIOC_TRY_FMT, &v4l2Format);\n \tif (ret) {\n \t\tLOG(V4L2, Error)\n@@ -984,6 +1015,7 @@ int V4L2VideoDevice::trySetFormatSingleplane(V4L2DeviceFormat *format, bool set)\n \tformat->planesCount = 1;\n \tformat->planes[0].bpl = pix->bytesperline;\n \tformat->planes[0].size = pix->sizeimage;\n+\tformat->colorSpace = toColorSpace(*pix);\n \n \treturn 0;\n }\n",
    "prefixes": [
        "libcamera-devel",
        "v7",
        "4/7"
    ]
}