Show a patch.

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

{
    "id": 23067,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/23067/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23067/",
    "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": "<20250324171900.40326-1-mzamazal@redhat.com>",
    "date": "2025-03-24T17:19:00",
    "name": "[RFC,v2] libcamera: software_isp: Assign colour spaces in configurations",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "6eae24ed946c940cd46336074ccf8239bd2b4259",
    "submitter": {
        "id": 177,
        "url": "https://patchwork.libcamera.org/api/1.1/people/177/?format=api",
        "name": "Milan Zamazal",
        "email": "mzamazal@redhat.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/23067/mbox/",
    "series": [
        {
            "id": 5090,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5090/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5090",
            "date": "2025-03-24T17:19:00",
            "name": "[RFC,v2] libcamera: software_isp: Assign colour spaces in configurations",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5090/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23067/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23067/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<kieran.bingham@ideasonboard.com>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": [
            "parsemail@patchwork.libcamera.org",
            "kbingham@ideasonboard.com"
        ],
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id ED890C3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Mar 2025 06:28:38 +0000 (UTC)",
            "from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net\n\t[86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AA16275A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Mar 2025 07:26:49 +0100 (CET)",
            "from perceval.ideasonboard.com\n\tby perceval.ideasonboard.com with LMTP id lHwbN6OT4WdIQykA4E0KoQ\n\t(envelope-from <mzamazal@redhat.com>)\n\tfor <kbingham@ideasonboard.com>; Mon, 24 Mar 2025 18:17:23 +0100",
            "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\tby\n\tperceval.ideasonboard.com (Postfix) with ESMTPS id 7B6F1455\tfor\n\t<kieran.bingham@ideasonboard.com>;\n\tMon, 24 Mar 2025 18:17:23 +0100 (CET)",
            "from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-689-LUXVWzYNNUiLvuTq9KOD5Q-1;\n\tMon, 24 Mar 2025 13:19:06 -0400",
            "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.17])\t(using\n\tTLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\t\n\tkey-exchange\n\tX25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)\t(No\n\tclient certificate requested)\tby\n\tmx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with\n\tESMTPS id 95889196B370;\tMon, 24 Mar 2025 17:19:05 +0000 (UTC)",
            "from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.32.57])\tby\n\tmx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with\n\tESMTP id AD77F195609D;\tMon, 24 Mar 2025 17:19:03 +0000 (UTC)"
        ],
        "Authentication-Results": "perceval.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.a=rsa-sha256 header.s=mimecast20190719\n\theader.b=HUFl0FC3; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1742836748;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding;\n\tbh=U5p1J2Myt0hmDumGIUWRtDZP6cS9g9LunBS4ApCi9PY=;\n\tb=HUFl0FC3du7a6hOF/fxO01YTaTDaLRyBMu2ZU0QU/hblSn2MAJI7+DsSMvgXtyCeE5C8Az\n\t5Evjq/awiqGrN4/Tvz5iDk0+Kyf5DDOnWrNlFRl0M+gNx8iijfgq51a65Crblvskzy5q5K\n\tRaaHduON9oqE+SPw0eHiSIw1IAAgdUQ=",
        "X-MC-Unique": "LUXVWzYNNUiLvuTq9KOD5Q-1",
        "X-Mimecast-MFC-AGG-ID": "LUXVWzYNNUiLvuTq9KOD5Q_1742836745",
        "From": "Milan Zamazal <mzamazal@redhat.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Milan Zamazal <mzamazal@redhat.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>",
        "Subject": "[RFC PATCH v2] libcamera: software_isp: Assign colour spaces in\n\tconfigurations",
        "Date": "Mon, 24 Mar 2025 18:19:00 +0100",
        "Message-ID": "<20250324171900.40326-1-mzamazal@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.17",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "guMEstSvIA5xZmBzYwDQs7oyd4GRGUkqlyHnjUZ7znM_1742836745",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "content-type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "X-TUID": "Zeak12mRiBzp",
        "Resent-From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "Resent-To": "parsemail@patchwork.libcamera.org"
    },
    "content": "StreamConfiguration's should have colorSpace set.  This is not the case\nin the simple pipeline.  Let's set it there.  This also fixes a crash in\n`cam' due to accessing an unset colorSpace.\n\nThe colour space is assigned as follows:\n\n- If raw role is requested, then the colour space must be raw.\n- Otherwise, if software ISP is used, the default colour space is\n  set to Srgb (YcbcrEncoding::None, Range::Full).\n- Otherwise, if a converter is used, the default colour space is left\n  unset.\n- Then in configuration validation, if the pixel format is changed, the\n  colour space is set according to the new pixel format.\n- If the colour space is still unset, it is set according to the\n  resulting pixel format.\n\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\n---\n src/libcamera/pipeline/simple/simple.cpp | 25 +++++++++++++++++++++++-\n 1 file changed, 24 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 6e039bf3..07cf7c11 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -25,6 +25,7 @@\n #include <libcamera/base/log.h>\n \n #include <libcamera/camera.h>\n+#include <libcamera/color_space.h>\n #include <libcamera/control_ids.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n@@ -35,6 +36,7 @@\n #include \"libcamera/internal/converter.h\"\n #include \"libcamera/internal/delayed_controls.h\"\n #include \"libcamera/internal/device_enumerator.h\"\n+#include \"libcamera/internal/formats.h\"\n #include \"libcamera/internal/media_device.h\"\n #include \"libcamera/internal/pipeline_handler.h\"\n #include \"libcamera/internal/software_isp/software_isp.h\"\n@@ -1088,8 +1090,24 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n \t\tif (cfg.pixelFormat != pixelFormat) {\n \t\t\tLOG(SimplePipeline, Debug) << \"Adjusting pixel format\";\n \t\t\tcfg.pixelFormat = pixelFormat;\n+\t\t\tif (cfg.colorSpace && cfg.colorSpace != ColorSpace::Raw)\n+\t\t\t\tcfg.colorSpace->adjust(pixelFormat);\n \t\t\tstatus = Adjusted;\n \t\t}\n+\t\tif (!cfg.colorSpace) {\n+\t\t\tconst PixelFormatInfo &info = PixelFormatInfo::info(pixelFormat);\n+\t\t\tswitch (info.colourEncoding) {\n+\t\t\tcase PixelFormatInfo::ColourEncodingRGB:\n+\t\t\t\tcfg.colorSpace = ColorSpace::Srgb;\n+\t\t\t\tbreak;\n+\t\t\tcase libcamera::PixelFormatInfo::ColourEncodingYUV:\n+\t\t\t\tcfg.colorSpace = ColorSpace::Sycc;\n+\t\t\t\tbreak;\n+\t\t\tdefault:\n+\t\t\t\tcfg.colorSpace = ColorSpace::Raw;\n+\t\t\t}\n+\t\t\tcfg.colorSpace->adjust(pixelFormat);\n+\t\t}\n \n \t\tif (!pipeConfig_->outputSizes.contains(cfg.size)) {\n \t\t\tSize adjustedSize = pipeConfig_->captureSize;\n@@ -1196,11 +1214,16 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo\n \t *\n \t * \\todo Implement a better way to pick the default format\n \t */\n-\tfor ([[maybe_unused]] StreamRole role : roles) {\n+\tfor (StreamRole role : roles) {\n \t\tStreamConfiguration cfg{ StreamFormats{ formats } };\n \t\tcfg.pixelFormat = formats.begin()->first;\n \t\tcfg.size = formats.begin()->second[0].max;\n \n+\t\tif (role == StreamRole::Raw)\n+\t\t\tcfg.colorSpace = ColorSpace::Raw;\n+\t\telse if (data->swIsp_)\n+\t\t\tcfg.colorSpace = ColorSpace::Srgb;\n+\n \t\tconfig->addConfiguration(cfg);\n \t}\n \n",
    "prefixes": [
        "RFC",
        "v2"
    ]
}