Patch Detail
Show a patch.
GET /api/patches/25315/?format=api
{ "id": 25315, "url": "https://patchwork.libcamera.org/api/patches/25315/?format=api", "web_url": "https://patchwork.libcamera.org/patch/25315/", "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": "<20251202134544.662446-7-bryan.odonoghue@linaro.org>", "date": "2025-12-02T13:45:26", "name": "[v6,06/24] libcamera: shaders: Extend debayer shaders to apply RGB gain values on output", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "3e8894e04ddf9a4e61feb6000701fa9f7c2bb1d3", "submitter": { "id": 175, "url": "https://patchwork.libcamera.org/api/people/175/?format=api", "name": "Bryan O'Donoghue", "email": "bryan.odonoghue@linaro.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/25315/mbox/", "series": [ { "id": 5631, "url": "https://patchwork.libcamera.org/api/series/5631/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5631", "date": "2025-12-02T13:45:20", "name": "Add GLES 2.0 GPUISP to libcamera", "version": 6, "mbox": "https://patchwork.libcamera.org/series/5631/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/25315/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/25315/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 47408C32E0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 2 Dec 2025 13:46:07 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3B4DB60D26;\n\tTue, 2 Dec 2025 14:46:06 +0100 (CET)", "from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com\n\t[IPv6:2a00:1450:4864:20::32a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 33E9B60C77\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 2 Dec 2025 14:46:01 +0100 (CET)", "by mail-wm1-x32a.google.com with SMTP id\n\t5b1f17b1804b1-477a219db05so35538735e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 02 Dec 2025 05:46:01 -0800 (PST)", "from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie.\n\t[188.141.3.146]) by smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-47926f0ec69sm19383375e9.1.2025.12.02.05.45.59\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 02 Dec 2025 05:45:59 -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=\"QGB2nxL7\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1764683160; x=1765287960;\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=Ar/9Plv8U/t5q9HLAAZVcFMeUCSIVj27Ri9+oiHLDzQ=;\n\tb=QGB2nxL7Z8VQgJeKQWrReu9wKIMGvRRfrSeaV9/6tL8lqJmZ+iCHYHf1mxvzRaVNgp\n\tHAQPRvHniLvdz/2+OegUBhmt2qnULraPdQNaNQjZBPqUI7sCrgSPc+69Ome/6IZ35uIN\n\t/i0/eN3V1VgwkYjONg4wICPCiqn6TZWo4NZvIGR2F6xjj5B97AYSlRUcnxfnwEGVUG6b\n\tCTP+9lt+/WmFPAj+bxvNClda/iXzBJmMuwmYGLJXniRBX9ex2ihWNdNLoZqISeijGDd9\n\t65ArydcWIwCk9XMrMZ3ya9LVGt2jb1DqhOA8+Y2IrFkrMa7rwQtgnoSm8NTq7MxKJl/V\n\tiRGg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1764683160; x=1765287960;\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=Ar/9Plv8U/t5q9HLAAZVcFMeUCSIVj27Ri9+oiHLDzQ=;\n\tb=IqmaFBePdFu0DmuQcNby2f4E6BzoT1F3p/zr/XjDI/y5CD70CtZnexVg/hxaWPA1Qb\n\tRadT24rmqKBzBZZECyAMsYBP3GeS/wiaXIXA81Vq50JGp+42xA7dFHat+97cot4dkblr\n\tLCEq4uuv3PUGOXzIxpo4bzewMlK4NvNOKcDdEpiCcZX0ZSKHFd04b2oKe3gg0HmjEYSy\n\tLgff1vG4Mr30ZaNXCu4HL3YSdokf0I3jOSd2Cx4JHfba5aF8Em/RPYzQoAvGWZVxcM8Q\n\t9CPz8mJqQPIMNz3I7L6BJ34JKBsbA0QPbsmfnLjvaA22vdmZeqJJwcj/IzxsRIxbmIei\n\tog8Q==", "X-Gm-Message-State": "AOJu0Ywl1eigpyUm4Rj2o12c30/8wAWa3jJoUz+yphZW1dgy6y/0BqFR\n\t4cMolXCmauByZHGz5O2l1UfSI5tuVuzhqPLsQUZ8FgcBIixF2mb6xnW8uC019mCuXTi1FGNuGEe\n\ta8aBj", "X-Gm-Gg": "ASbGncvEPgqW7wD2s6CgRtqOarfuJFYjPIQPOTveF9E4BfJygxmqhRLQJlkBE8JoGUB\n\t8MHO3wiWwIe7p4YmEXM1wfDGUhahbC6X1qGo7JD2PyJKK8RJwQBYrtQyq8MgAKbd77DtDIi2o5h\n\tiWxVQCOx/9313ZVJOp+2zn7KmIddVPuG0epqHL20gJYyXtu5WbyFdZPfY2/V2VuOnVkBTHMWIbv\n\twTrnZwJhWkUJUBxhwr3vilx2ykj0vlJElOUyKu4vM70yJDDt4uqMZYwRogSl7HTj8PptzpFHF/H\n\tPL+q6yeoxGWgjB9F7LXeOGII+HH5KLuFFeS8X2Q0xlpXTyHQ3bAQA+Ejwz+hvjKeKD19I3wzVwg\n\tXBsElBsc5R7WmnEem4fja0Pp62rHqiEckTrM7SLHP5XrtQ6QTLfr0DPjdGApQbxdlSIgd0ncI13\n\tOgTjjWzZpnwKZTVrRT88ioA+v+Pqly2aAk68Q3I/Pck7HrKC4UWxDOett0omAKX6TUFzmGCQWV8\n\tqQDfA==", "X-Google-Smtp-Source": "AGHT+IGVhzau5WJ5THeB6e3QlSM041Xe70HBvcou3dSZl47PJsnc7QYmtc1STMJZAxDl3kMIMrzF5g==", "X-Received": "by 2002:a05:600c:470a:b0:45d:dc85:c009 with SMTP id\n\t5b1f17b1804b1-477c10d49b5mr365686655e9.10.1764683160452; \n\tTue, 02 Dec 2025 05:46:00 -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 v6 06/24] libcamera: shaders: Extend debayer shaders to apply\n\tRGB gain values on output", "Date": "Tue, 2 Dec 2025 13:45:26 +0000", "Message-ID": "<20251202134544.662446-7-bryan.odonoghue@linaro.org>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20251202134544.662446-1-bryan.odonoghue@linaro.org>", "References": "<20251202134544.662446-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 out the bayer fragment shaders to take 3 x 256 byte inputs as\ntextures from the CPU.\n\nWe then use an index to the table to recover the colour-corrected values\nprovided by the SoftIPA thread.\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": [ "v6", "06/24" ] }