Show a patch.

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

{
    "id": 15095,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15095/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15095/",
    "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": "<20211209101245.6187-6-david.plowman@raspberrypi.com>",
    "date": "2021-12-09T10:12:42",
    "name": "[libcamera-devel,v10,5/8] libcamera: v4l2_subdevice: Add colorSpace field to V4L2SubdeviceFormat",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "daec64e622a4bc0084107027d067af689e80f35f",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15095/mbox/",
    "series": [
        {
            "id": 2830,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2830/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2830",
            "date": "2021-12-09T10:12:37",
            "name": "Colour spaces",
            "version": 10,
            "mbox": "https://patchwork.libcamera.org/series/2830/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15095/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15095/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 EABFAC3258\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  9 Dec 2021 10:13:38 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 862FE60882;\n\tThu,  9 Dec 2021 11:13:38 +0100 (CET)",
            "from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com\n\t[IPv6:2a00:1450:4864:20::42c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CD2B46088B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  9 Dec 2021 11:13:34 +0100 (CET)",
            "by mail-wr1-x42c.google.com with SMTP id t18so8714103wrg.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 09 Dec 2021 02:13:34 -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\tj8sm5079449wrh.16.2021.12.09.02.13.33\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 09 Dec 2021 02:13:33 -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=\"sG7dYNOk\"; 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=XppW0uYN/+TM2EogMDHujEnG3QJ6JaZY9LDGXon35AQ=;\n\tb=sG7dYNOkcr32NYdv19RKc+f0z1Z5wU/k9BgnL1kFmGbtpbqjPnJmdvXojzGLdmRL8V\n\tTogY2z6KIRdLZOD0xMe6a1lyeYCh1zm1ysc2GlMKX+w+BRCJAS4vtdASGAtIA9ZIfu7L\n\tDr4hehso2Bxa9n7BUjPVuHy0Q7nco02pWnwA9YlTs4XhGGAO9LmMVZJmj7ikgIHL284L\n\tLXPKY+fam6VjTN1hSKBWQkR4CUu+4ypQn/m0zb+RgDxL+w5AmaQkWLlAzRMwMHK0SbdO\n\tZcs+JDTjnyaV6TNAmmoO3YWy6ZwOJ85JyhDC8dyEH0mOi7vhtY6VnKjQl/EzUQXjiI8A\n\trgtA==",
        "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=XppW0uYN/+TM2EogMDHujEnG3QJ6JaZY9LDGXon35AQ=;\n\tb=414kjcZKCZIQtCQwklLfiT4yggd5Ig9u+N6VrFe0V1ppvgEH80RhRn9Ng6NIuoLWYD\n\tLFQaYcFVj08dMOkAJBiwhnXXbBl7TNMM7c+Pfeg9uMrUtsuk47MRVZuy7Q5XzYCALXJc\n\tlQzTs2/kg4b4lUwJbrwfgqbaWrdc7VR+A/s6TsjrfCysf6U8gtq3e+nVS3jpYhZMhRQ5\n\thaJezAQosB45KE6RP/QefwxHLcm0YUaLkx6ZzlHaxLfQUa9wBy7VMUgkkfvwZGKO3d7i\n\tE2crJq75jHHcQsS8YI3yQJf+ArhkgNLdh0SYlbnl4aYxYQ0wW8Nyt6l3eNCFqowO/OJ2\n\txvdA==",
        "X-Gm-Message-State": "AOAM531L+zOxB0nP/uNgJu6yN1mNMTErvW9lWi9V5VtCVS8+wjr87vWm\n\tDiz/LLEGFMAniZcnBQliFuw4nbCUnIj1r48v",
        "X-Google-Smtp-Source": "ABdhPJyG/cn1pfam9n4DYe/VtwBuogFRolDEKj1wnJfGZ5ZJwB4PtuY6ToJV/deaPv4Jcnn69d/m6w==",
        "X-Received": "by 2002:a05:6000:1201:: with SMTP id\n\te1mr5580352wrx.298.1639044814333; \n\tThu, 09 Dec 2021 02:13:34 -0800 (PST)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org,\n\tLaurent 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>, Naushir Patuck <naush@raspberrypi.com>",
        "Date": "Thu,  9 Dec 2021 10:12:42 +0000",
        "Message-Id": "<20211209101245.6187-6-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20211209101245.6187-1-david.plowman@raspberrypi.com>",
        "References": "<20211209101245.6187-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v10 5/8] libcamera: v4l2_subdevice: Add\n\tcolorSpace field to V4L2SubdeviceFormat",
        "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": "This adds a ColorSpace field to the V4L2SubdeviceFormat so that we can\nset and request particular color spaces from V4L2.\n\nThis commit simply adds the field and fixes some occurrences of brace\ninitializers that would otherwise be broken. A subsequent commit will\npass and retrieve the value correctly to/from V4l2 itself.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/v4l2_subdevice.h |  3 +++\n src/libcamera/camera_sensor.cpp             |  1 +\n src/libcamera/pipeline/ipu3/cio2.cpp        |  7 +++----\n src/libcamera/pipeline/simple/simple.cpp    |  8 ++++++--\n src/libcamera/v4l2_subdevice.cpp            | 15 +++++++++++++++\n 5 files changed, 28 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\nindex a6873b67..58d1e511 100644\n--- a/include/libcamera/internal/v4l2_subdevice.h\n+++ b/include/libcamera/internal/v4l2_subdevice.h\n@@ -8,12 +8,14 @@\n #pragma once\n \n #include <memory>\n+#include <optional>\n #include <string>\n #include <vector>\n \n #include <libcamera/base/class.h>\n #include <libcamera/base/log.h>\n \n+#include <libcamera/color_space.h>\n #include <libcamera/geometry.h>\n \n #include \"libcamera/internal/formats.h\"\n@@ -27,6 +29,7 @@ class MediaDevice;\n struct V4L2SubdeviceFormat {\n \tuint32_t mbus_code;\n \tSize size;\n+\tstd::optional<ColorSpace> colorSpace;\n \n \tconst std::string toString() const;\n \tuint8_t bitsPerPixel() const;\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 7bb39b1e..c3999d35 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -642,6 +642,7 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector<unsigned int> &mbu\n \tV4L2SubdeviceFormat format{\n \t\t.mbus_code = bestCode,\n \t\t.size = *bestSize,\n+\t\t.colorSpace = ColorSpace::Raw,\n \t};\n \n \treturn format;\ndiff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\nindex 59dda56b..f4e8c663 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.cpp\n+++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n@@ -322,10 +322,9 @@ V4L2SubdeviceFormat CIO2Device::getSensorFormat(const std::vector<unsigned int>\n \t\treturn {};\n \t}\n \n-\tV4L2SubdeviceFormat format{\n-\t\t.mbus_code = bestCode,\n-\t\t.size = bestSize,\n-\t};\n+\tV4L2SubdeviceFormat format{};\n+\tformat.mbus_code = bestCode;\n+\tformat.size = bestSize;\n \n \treturn format;\n }\ndiff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 701fb4be..a3108fc0 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -457,7 +457,9 @@ int SimpleCameraData::init()\n \t * formats on the video node.\n \t */\n \tfor (unsigned int code : sensor_->mbusCodes()) {\n-\t\tV4L2SubdeviceFormat format{ code, sensor_->resolution() };\n+\t\tV4L2SubdeviceFormat format{};\n+\t\tformat.mbus_code = code;\n+\t\tformat.size = sensor_->resolution();\n \n \t\tret = setupFormats(&format, V4L2Subdevice::TryFormat);\n \t\tif (ret < 0) {\n@@ -908,7 +910,9 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n \t\treturn ret;\n \n \tconst SimpleCameraData::Configuration *pipeConfig = config->pipeConfig();\n-\tV4L2SubdeviceFormat format{ pipeConfig->code, data->sensor_->resolution() };\n+\tV4L2SubdeviceFormat format{};\n+\tformat.mbus_code = pipeConfig->code;\n+\tformat.size = data->sensor_->resolution();\n \n \tret = data->setupFormats(&format, V4L2Subdevice::ActiveFormat);\n \tif (ret < 0)\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 61e15b69..b782325a 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -169,6 +169,21 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {\n  * \\brief The image size in pixels\n  */\n \n+/**\n+ * \\var V4L2SubdeviceFormat::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  * \\brief Assemble and return a string describing the format\n  * \\return A string describing the V4L2SubdeviceFormat\n",
    "prefixes": [
        "libcamera-devel",
        "v10",
        "5/8"
    ]
}