Show a patch.

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

{
    "id": 25521,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/25521/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25521/",
    "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": "<20251212002937.3118-7-bryan.odonoghue@linaro.org>",
    "date": "2025-12-12T00:29:17",
    "name": "[v8,06/26] libcamera: shaders: Extend debayer shaders to apply CCM gains",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "3e8894e04ddf9a4e61feb6000701fa9f7c2bb1d3",
    "submitter": {
        "id": 175,
        "url": "https://patchwork.libcamera.org/api/1.1/people/175/?format=api",
        "name": "Bryan O'Donoghue",
        "email": "bryan.odonoghue@linaro.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/25521/mbox/",
    "series": [
        {
            "id": 5657,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5657/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5657",
            "date": "2025-12-12T00:29:11",
            "name": "Add GLES 2.0 GPUISP to libcamera",
            "version": 8,
            "mbox": "https://patchwork.libcamera.org/series/5657/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/25521/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25521/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 4906EBD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 12 Dec 2025 00:33:44 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 103BF61635;\n\tFri, 12 Dec 2025 01:33:44 +0100 (CET)",
            "from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com\n\t[IPv6:2607:f8b0:4864:20::42f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0031F61635\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Dec 2025 01:33:41 +0100 (CET)",
            "by mail-pf1-x42f.google.com with SMTP id\n\td2e1a72fcca58-7c66822dd6dso319338b3a.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Dec 2025 16:33:41 -0800 (PST)",
            "from inspiron14p-linux (p99250-ipoefx.ipoe.ocn.ne.jp.\n\t[153.246.134.249]) by smtp.gmail.com with ESMTPSA id\n\t41be03b00d2f7-c0c26eb0f6bsm3317282a12.14.2025.12.11.16.33.37\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 11 Dec 2025 16:33:39 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"zLUyt7r8\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1765499620; x=1766104420;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=Zkzu0tqbzAOlMWvnkw6w2p9R2Nid+3zoTkR/m4lKMgE=;\n\tb=zLUyt7r8h2WbEJlIa28BQ19Geegxn1w/seiUlg6COsvoKiO/KH0wEWdg0i0LsoD2CP\n\tsekiWqDWsejT+Ej332hOYKLj9G52A1l/2/X2smcgid9ZXjJeLkG/K9p9VAgNKzrI/qtW\n\tpHPnOhl7C/I6byYQdAHKoPF57ZwpS6Y2DBEdscVcdLOHRhpm64NwYmK/FLZDbm8mB+M3\n\tze2c8bCPh0YYc8c1zcReKidbU5AT1eUQbKHuy0PXD0ETee7bQZY0ordwO6FRLXR2N5T1\n\tT02utBvKfPKtYaQIQc/v75k/8gLrCUhAhTRhwZF0OdLh0KhDckcQROz9xP/lEFT3dVGE\n\tAhHQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1765499620; x=1766104420;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=Zkzu0tqbzAOlMWvnkw6w2p9R2Nid+3zoTkR/m4lKMgE=;\n\tb=LohoCzSsKhCEzFxQz4UKJisl3UG8zE15XnVX6rcZ690UfK6/eM0iyOGw4FvI+7DOFE\n\tMRegbq8D1/ZpI3BiBfgwv4Zkn/69qcfeVMJmk5kauaMHFtgsDmhdVf7qvlDic9hD5bkd\n\tJ1VSuPlxoxkhyjbyeTdW9ceRp6dkZhdlSGb8ZPZaRBl/manHneD3N04/shXIWH4JkX31\n\tVjPK05NoFE/Pa5maVAeoX85SAtcFklovEpmNInJYiUUxnwqgG6IYmnvYO5VjiFhgL/on\n\tPklv48CeWxgpJrWz1z6Ld7+i7oPWOpg2Vs8u3q33+jH1l8n5xXYXbNrd23j4HHGVkswV\n\tzErA==",
        "X-Gm-Message-State": "AOJu0YzsgsLdnAt65CI/9MS4aROXZT/ge9PeyPVQp7Kn+n715gxpVLPk\n\t9qO+bibHmIs5sC73b6sZ5lJ7SI3q0od4Azl7nkB27v6gdeCKIRbteXUgs+wuLMRU4DKwsNVtFoZ\n\tS1ZA5",
        "X-Gm-Gg": "AY/fxX6uWJbj+rekotGGSvEy96cjoshd47g8wa1H/kIC68nx5bzqaa2I4RtDraTRbzy\n\tEoQVnoNENdAJAlpa5fZ9VTX9dFMtpP0kbq5RBVzm9ZGQYM8forFyXEnFAsne03WvgY0H3E0yzNL\n\tkjWlSy52cl27ugc0flyXypnaWGLQHAJQC7dd6Md/RnM6yg28V5XZIDyiq0E7KmzJJ9yKhOFkYIg\n\tRB5xTAERjoezBxk5kFW03+YAL3p+scyoo++1wdB6RK0jXn+KVoSqJftcRnFVPy/zVgdNOIbg7qE\n\t8qNG7ESF28xwW2vxyO68dqFD4nep6pBOEuyDA662KaEotKbYB59nIrjFCRPhmlT1ULz3VwG5W/c\n\t55EERy7m/+NDk7u8V81oKXtDkb7ih4seJ12HxIGzvxcu+rqSHmrJ3XmGezKRebigipRsCtBugM7\n\tzBle0RngObfPNQh7b2rIpI2E8Xszy0zu+YsuAUKnhq6c150clBENdyMK37VJI=",
        "X-Google-Smtp-Source": "AGHT+IGbB0YnSVpvwEyvcMRlLd5rVt5PKMwmgQaD6pvORp0rHSk/5draKAB+exmK07bhIXGl5ICRVA==",
        "X-Received": "by 2002:a05:6a20:72aa:b0:35e:b02b:4efd with SMTP id\n\tadf61e73a8af0-368594b7cc0mr3840158637.27.1765499620247; \n\tThu, 11 Dec 2025 16:33:40 -0800 (PST)",
        "From": "Bryan O'Donoghue <bryan.odonoghue@linaro.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "pavel@ucw.cz, Bryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tMilan Zamazal <mzamazal@redhat.com>",
        "Subject": "[PATCH v8 06/26] libcamera: shaders: Extend debayer shaders to apply\n\tCCM gains",
        "Date": "Fri, 12 Dec 2025 00:29:17 +0000",
        "Message-ID": "<20251212002937.3118-7-bryan.odonoghue@linaro.org>",
        "X-Mailer": "git-send-email 2.52.0",
        "In-Reply-To": "<20251212002937.3118-1-bryan.odonoghue@linaro.org>",
        "References": "<20251212002937.3118-1-bryan.odonoghue@linaro.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "Extend Bayer shaders to support application of a passed CCM table.\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n src/libcamera/shaders/bayer_1x_packed.frag | 45 +++++++++++++++++++\n src/libcamera/shaders/bayer_unpacked.frag  | 51 +++++++++++++++++++++-\n 2 files changed, 95 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/libcamera/shaders/bayer_1x_packed.frag b/src/libcamera/shaders/bayer_1x_packed.frag\nindex 19b13ad08..171a928c2 100644\n--- a/src/libcamera/shaders/bayer_1x_packed.frag\n+++ b/src/libcamera/shaders/bayer_1x_packed.frag\n@@ -65,6 +65,7 @@ uniform vec2 tex_step;\n uniform vec2 tex_bayer_first_red;\n \n uniform sampler2D tex_y;\n+uniform mat3 ccm;\n \n void main(void)\n {\n@@ -212,5 +213,49 @@ void main(void)\n \t\t\tvec3(patterns.y, C, patterns.x) :\n \t\t\tvec3(patterns.wz, C));\n \n+\t/*\n+\t *   CCM is a 3x3 in the format\n+\t *\n+\t *   +--------------+----------------+---------------+\n+\t *   | RedRedGain   | RedGreenGain   | RedBlueGain   |\n+\t *   +--------------+----------------+---------------+\n+\t *   | GreenRedGain | GreenGreenGain | GreenBlueGain |\n+\t *   +--------------+----------------+---------------+\n+\t *   | BlueRedGain  |  BlueGreenGain | BlueBlueGain  |\n+\t *   +--------------+----------------+---------------+\n+\t *\n+\t *   Rout = RedRedGain * Rin + RedGreenGain * Gin + RedBlueGain * Bin\n+\t *   Gout = GreenRedGain * Rin + GreenGreenGain * Gin + GreenBlueGain * Bin\n+\t *   Bout = BlueRedGain * Rin + BlueGreenGain * Gin + BlueBlueGain * Bin\n+\t *\n+\t *   We upload to the GPU without transposition glUniformMatrix3f(.., .., GL_FALSE, ccm);\n+\t *\n+\t *   CPU\n+\t *   float ccm [] = {\n+\t *             RedRedGain,   RedGreenGain,   RedBlueGain,\n+\t *             GreenRedGain, GreenGreenGain, GreenBlueGain,\n+\t *             BlueRedGain,  BlueGreenGain,  BlueBlueGain,\n+\t *   };\n+\t *\n+\t *   GPU\n+\t *   ccm = {\n+\t *             RedRedGain,   GreenRedGain,   BlueRedGain,\n+\t *             RedGreenGain, GreenGreenGain, BlueGreenGain,\n+\t *             RedBlueGain,  GreenBlueGain,  BlueBlueGain,\n+\t *   }\n+\t *\n+\t *   However the indexing for the mat data-type is column major hence\n+\t *   ccm[0][0] = RedRedGain, ccm[0][1] = RedGreenGain, ccm[0][2] = RedBlueGain\n+\t *\n+\t */\n+\tfloat rin, gin, bin;\n+\trin = rgb.r;\n+\tgin = rgb.g;\n+\tbin = rgb.b;\n+\n+\trgb.r = (rin * ccm[0][0]) + (gin * ccm[0][1]) + (bin * ccm[0][2]);\n+\trgb.g = (rin * ccm[1][0]) + (gin * ccm[1][1]) + (bin * ccm[1][2]);\n+\trgb.b = (rin * ccm[2][0]) + (gin * ccm[2][1]) + (bin * ccm[2][2]);\n+\n \tgl_FragColor = vec4(rgb, 1.0);\n }\ndiff --git a/src/libcamera/shaders/bayer_unpacked.frag b/src/libcamera/shaders/bayer_unpacked.frag\nindex aa7a1b004..c41d72f4f 100644\n--- a/src/libcamera/shaders/bayer_unpacked.frag\n+++ b/src/libcamera/shaders/bayer_unpacked.frag\n@@ -24,8 +24,11 @@ uniform sampler2D       tex_y;\n varying vec4            center;\n varying vec4            yCoord;\n varying vec4            xCoord;\n+uniform mat3            ccm;\n \n void main(void) {\n+    vec3 rgb;\n+\n     #define fetch(x, y) texture2D(tex_y, vec2(x, y)).r\n \n     float C = texture2D(tex_y, center.xy).r; // ( 0, 0)\n@@ -97,11 +100,57 @@ void main(void) {\n     PATTERN.xw  += kB.xw * B;\n     PATTERN.xz  += kF.xz * F;\n \n-    gl_FragColor.rgb = (alternate.y == 0.0) ?\n+    rgb =  (alternate.y == 0.0) ?\n         ((alternate.x == 0.0) ?\n             vec3(C, PATTERN.xy) :\n             vec3(PATTERN.z, C, PATTERN.w)) :\n         ((alternate.x == 0.0) ?\n             vec3(PATTERN.w, C, PATTERN.z) :\n             vec3(PATTERN.yx, C));\n+\n+    /*\n+     *   CCM is a 3x3 in the format\n+     *\n+     *   +--------------+----------------+---------------+\n+     *   | RedRedGain   | RedGreenGain   | RedBlueGain   |\n+     *   +--------------+----------------+---------------+\n+     *   | GreenRedGain | GreenGreenGain | GreenBlueGain |\n+     *   +--------------+----------------+---------------+\n+     *   | BlueRedGain  |  BlueGreenGain | BlueBlueGain  |\n+     *   +--------------+----------------+---------------+\n+     *\n+     *   Rout = RedRedGain * Rin + RedGreenGain * Gin + RedBlueGain * Bin\n+     *   Gout = GreenRedGain * Rin + GreenGreenGain * Gin + GreenBlueGain * Bin\n+     *   Bout = BlueRedGain * Rin + BlueGreenGain * Gin + BlueBlueGain * Bin\n+     *\n+     *   We upload to the GPU without transposition glUniformMatrix3f(.., .., GL_FALSE, ccm);\n+     *\n+     *   CPU\n+     *   float ccm [] = {\n+     *             RedRedGain,   RedGreenGain,   RedBlueGain,\n+     *             GreenRedGain, GreenGreenGain, GreenBlueGain,\n+     *             BlueRedGain,  BlueGreenGain,  BlueBlueGain,\n+     *   };\n+     *\n+     *   GPU\n+     *   ccm = {\n+     *             RedRedGain,   GreenRedGain,   BlueRedGain,\n+     *             RedGreenGain, GreenGreenGain, BlueGreenGain,\n+     *             RedBlueGain,  GreenBlueGain,  BlueBlueGain,\n+     *   }\n+     *\n+     *   However the indexing for the mat data-type is column major hence\n+     *   ccm[0][0] = RedRedGain, ccm[0][1] = RedGreenGain, ccm[0][2] = RedBlueGain\n+     *\n+     */\n+    float rin, gin, bin;\n+    rin = rgb.r;\n+    gin = rgb.g;\n+    bin = rgb.b;\n+\n+    rgb.r = (rin * ccm[0][0]) + (gin * ccm[0][1]) + (bin * ccm[0][2]);\n+    rgb.g = (rin * ccm[1][0]) + (gin * ccm[1][1]) + (bin * ccm[1][2]);\n+    rgb.b = (rin * ccm[2][0]) + (gin * ccm[2][1]) + (bin * ccm[2][2]);\n+\n+    gl_FragColor.rgb = rgb;\n }\n",
    "prefixes": [
        "v8",
        "06/26"
    ]
}