Show a patch.

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

{
    "id": 26938,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/26938/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26938/",
    "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": "<20260618122245.946138-6-bryan.odonoghue@linaro.org>",
    "date": "2026-06-18T12:22:18",
    "name": "[05/30] libcamera: software_isp: gpu_pipeline_shader_pass: Add base class GpuPipelineShaderPass",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "2c4461f494c8e422ecc79e36045cc3fcd2872e86",
    "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/26938/mbox/",
    "series": [
        {
            "id": 6005,
            "url": "https://patchwork.libcamera.org/api/1.1/series/6005/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6005",
            "date": "2026-06-18T12:22:13",
            "name": "RFC/RFT: gpuisp: Multipass with speed optimisations on top",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/6005/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26938/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26938/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 E5ABBC3303\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Jun 2026 12:23:11 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CA52C62B40;\n\tThu, 18 Jun 2026 14:23:08 +0200 (CEST)",
            "from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 62AF3629E3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2026 14:23:01 +0200 (CEST)",
            "by mail-wm1-x32e.google.com with SMTP id\n\t5b1f17b1804b1-490ae94a89eso6312135e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2026 05:23:01 -0700 (PDT)",
            "from inspiron14p-linux ([109.76.144.236])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4922fa3a4easm275198015e9.3.2026.06.18.05.23.00\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 18 Jun 2026 05:23:00 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"LDM7INbL\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1781785381; x=1782390181;\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=oDBiA8HS3JX8yt0LRD4gcwtMzbFmINhfLsRnr0WONfg=;\n\tb=LDM7INbLkyCzNtMJbULJ64T5NHnvBS5P5Ew801Zv8eTQZHsIjWTl4vDj070Ups0NR9\n\tSr/QPpz3/bM+1yVwN/XEQpvfL3JL/m37l/nNWsdMY9YNuM++Sf+C1WMbMnLctOK8KPHv\n\tGftxdzh0s2optc/Q0O6tpiWfPk98P7uN2qXZ6PLvsjZVNbmQRfE82OHGZqn9YxAZZjyn\n\tVCkZLoWxlYjPWPEnzZiBvGUO0GHMlQX+q09vFIVY1/FfRpHhPgDe06nXxVOYMlenxE2C\n\tMFsflgzbQg45V80zoupl+MhOLXcSOxzMyS4A57VP85gZrUWVs6SPrm1+mmw6hrykLCXk\n\toj6Q==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1781785381; x=1782390181;\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=oDBiA8HS3JX8yt0LRD4gcwtMzbFmINhfLsRnr0WONfg=;\n\tb=efdnOrxdaXUT+3qWtgmPf/lr334AFCQ9pWerw8W/7nYzzK3CFXwcbP54xuObDmz+7t\n\tt11vj9+AxfiQo43Oech/IsvXOu2g0pxIruj96zSW6gRa5TS/20U7y26wgcyx4peK9idH\n\tMzbJPiQU/M2ULEkXZwOaBXm1E1WYzH5fzaJdRVl75DJYCXsj1rZa1liWtIhRCq6hoRNR\n\tq2eg/Jfmsg0zR9b12Rd97gZUMa2FzOT2uCtgMXPFJMVXfXT8ljTqtLPosk7/ZtwsbP+v\n\tUltPP3Io2xReKKVNmR2DxpxXMZsDemGclczqItfD22P0H4FBBGudIQkSFciN/njw9HEI\n\tvSDQ==",
        "X-Gm-Message-State": "AOJu0Yx0F2JXc8ieArI0+uLixi99CNRTjHVyEs8vX/TjsT/k3sHkBjX9\n\thoe2yJ0FvaW/rU1jWgG7WSG0z5OeF2PoeCIH8urETznFovMqCQ6lbqH12wXohzkX5TrUPmWBSml\n\ti/XzDUBg=",
        "X-Gm-Gg": "AfdE7ckaOBUYvvV+VbrUuuHqWQzySqIuOg2JUAkB9L8XcwxwhqywQIj/tGzeRI8pWY3\n\tg/k8z/jzKcLNZOoZayHnf1drIkNpJEpXvsoKBiwNOaGieZEeMqAtXiYQ4diQwX5TVchulEtGE9u\n\tYq6O2/oamHs4wNAu/nGQKxFmFYnrTITGeVRq53GqiRSw3pBYiWlm3fzONDPY4KN0paebVDrLJWs\n\tShFMcvD5zW728apVoj8aD6HQHvm00Xa29GGyBV1mleqoGU4dgl+Qh068sPNexVnWYRb/7cDVAK8\n\tLT/BrUZXx19z6EAyZ3pbA4JyX5NzQcq8Y7WsgIYgTAPVdv+KsEDySSrxpSTMvZPIm4RVP5j0I7u\n\t7ILqhpf7lWQvz51HL1w1OeWxREwzzfKwArkkHUZHDlQlKQINECn/UyIwFl3kPcZdPZS2yLRjsy6\n\t9H3nrt1Z9l8Rpcuzaw0xzfE6AMFix/",
        "X-Received": "by 2002:a05:600d:8486:10b0:490:6e12:542d with SMTP id\n\t5b1f17b1804b1-4923821b94emr41777835e9.19.1781785380904; \n\tThu, 18 Jun 2026 05:23:00 -0700 (PDT)",
        "From": "Bryan O'Donoghue <bryan.odonoghue@linaro.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "bryan.odonoghue@linaro.org,\n\tpavel@ucw.cz",
        "Subject": "[PATCH 05/30] libcamera: software_isp: gpu_pipeline_shader_pass: Add\n\tbase class GpuPipelineShaderPass",
        "Date": "Thu, 18 Jun 2026 13:22:18 +0100",
        "Message-ID": "<20260618122245.946138-6-bryan.odonoghue@linaro.org>",
        "X-Mailer": "git-send-email 2.54.0",
        "In-Reply-To": "<20260618122245.946138-1-bryan.odonoghue@linaro.org>",
        "References": "<20260618122245.946138-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": "Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n .../software_isp/gpu_pipeline_shader_pass.cpp | 74 +++++++++++++++++\n .../software_isp/gpu_pipeline_shader_pass.h   | 83 +++++++++++++++++++\n src/libcamera/software_isp/meson.build        |  1 +\n 3 files changed, 158 insertions(+)\n create mode 100644 src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp\n create mode 100644 src/libcamera/software_isp/gpu_pipeline_shader_pass.h",
    "diff": "diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp\nnew file mode 100644\nindex 000000000..669a1c1b6\n--- /dev/null\n+++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp\n@@ -0,0 +1,74 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2026, Linaro Ltd\n+ *\n+ * Simple software ISP implementation\n+ */\n+\n+#include <cmath>\n+#include <stdint.h>\n+#include <sys/mman.h>\n+#include <sys/types.h>\n+#include <unistd.h>\n+\n+#include <libcamera/base/log.h>\n+#include <libcamera/base/thread.h>\n+#include <libcamera/base/utils.h>\n+\n+#include <libcamera/controls.h>\n+#include <libcamera/formats.h>\n+#include <libcamera/stream.h>\n+\n+#include \"libcamera/internal/framebuffer.h\"\n+#include \"libcamera/internal/ipa_manager.h\"\n+#include \"libcamera/internal/software_isp/debayer_params.h\"\n+\n+#include \"gpu_pipeline_shader_pass.h\"\n+\n+/**\n+ * \\file software_isp.cpp\n+ * \\brief Simple software ISP implementation\n+ */\n+\n+namespace libcamera {\n+\n+LOG_DEFINE_CATEGORY(GpuShaderPass)\n+\n+int GpuIspShaderPass::process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint32_t width, uint32_t height, const DebayerParams &params)\n+{\n+\t/* Switch to the output framebuffer */\n+\tegl_.useProgram(programId_);\n+\tegl_.attachTextureToFBO(eglImageOut);\n+\n+\tsetShaderVariableValues(params, eglImageIn);\n+\tglViewport(0, 0, width, height);\n+\tglClear(GL_COLOR_BUFFER_BIT);\n+\tglDrawArrays(GL_TRIANGLE_FAN, 0, DEBAYER_OPENGL_COORDS);\n+\n+\tGLenum err = glGetError();\n+\tif (err != GL_NO_ERROR) {\n+\t\tLOG(GpuShaderPass, Error) << \"Drawing scene fail \" << err;\n+\t\treturn -ENODEV;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int GpuIspShaderPass::start()\n+{\n+\treturn 0;\n+}\n+\n+void GpuIspShaderPass::stop()\n+{\n+\tif (programId_)\n+\t\tglDeleteProgram(programId_);\n+}\n+\n+void GpuIspShaderPass::configure(const struct PassConfig &passInputCfg, const struct PassConfig &passOutputCfg)\n+{\n+\tpassInputCfg_ = passInputCfg;\n+\tpassOutputCfg_ = passOutputCfg;\n+}\n+\n+}\ndiff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h\nnew file mode 100644\nindex 000000000..d4d4cf34d\n--- /dev/null\n+++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h\n@@ -0,0 +1,83 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2026, Linaro Ltd\n+ *\n+ * Authors:\n+ * Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n+ *\n+ * GpuIspIspShaderPass base class\n+ */\n+\n+#pragma once\n+\n+#include <stdint.h>\n+\n+#include <libcamera/base/log.h>\n+#include <libcamera/base/object.h>\n+#include <libcamera/base/signal.h>\n+\n+#include <libcamera/geometry.h>\n+#include <libcamera/stream.h>\n+\n+#include \"libcamera/internal/egl.h\"\n+#include \"libcamera/internal/software_isp/debayer_params.h\"\n+\n+#include <EGL/egl.h>\n+#include <EGL/eglext.h>\n+#include <GLES3/gl32.h>\n+\n+#include \"../glsl_shaders.h\"\n+\n+namespace libcamera {\n+\n+#define DEBAYER_OPENGL_COORDS 4\n+\n+class FrameBuffer;\n+\n+struct PassConfig {\n+\tSize size;\n+\tunsigned int stride;\n+\tPixelFormat format;\n+\tRectangle window;\n+};\n+\n+class GpuIspShaderPass : public Object\n+{\n+public:\n+\tGpuIspShaderPass(eGL& egl) : egl_(egl) {}\n+\t~GpuIspShaderPass() {}\n+\n+\tvirtual int process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint32_t width, uint32_t height, const DebayerParams &params);\n+\tvirtual int start();\n+\tvirtual void stop();\n+\tvirtual void configure(const struct PassConfig &passInputCfg, const struct PassConfig &passOutputCfg);\n+\tvirtual int initShaders(PixelFormat inputFormat, PixelFormat outputFormat) = 0;\n+\tvirtual int getShaderVariableLocations(void) = 0;\n+\tvirtual void setShaderVariableValues(const DebayerParams &params, eGLImage &eglImageIn) = 0;\n+\tvirtual const char *name() const { return \"GpuIspShaderPass\"; }\n+\n+\tunsigned int getBytesPerPixel() { return bytesPerPixel_; };\n+\n+\t/* glFormat_ is a special case we are moving to one shader which will use GL_R\n+\t * so rather than do a hack make ShaderPasses do the Textrue allocation and thus have\n+\t * access to glFormat_. Make glFormat_ available to the upper level class.\n+\t * This variabile will be dropped at the end of the series anyway.\n+\t */\n+\tGLint glFormat_;\n+\n+protected:\n+\teGL& egl_;\n+\n+\t/* Shader calculates this getter provides ability to interrogate if needed */\n+\tunsigned int bytesPerPixel_;\n+\n+\t/* Shader program identifiers */\n+\tGLuint vertexShaderId_ = 0;\n+\tGLuint fragmentShaderId_ = 0;\n+\tGLuint programId_ = 0;\n+\n+\tstruct PassConfig passInputCfg_;\n+\tstruct PassConfig passOutputCfg_;\n+};\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/software_isp/meson.build b/src/libcamera/software_isp/meson.build\nindex 51cc6ac3e..f8bce5203 100644\n--- a/src/libcamera/software_isp/meson.build\n+++ b/src/libcamera/software_isp/meson.build\n@@ -32,6 +32,7 @@ if mesa_works\n     libcamera_internal_sources += files([\n         '../egl.cpp',\n         'software_isp_pipeline_gpu.cpp',\n+        'gpu_pipeline_shader_pass.cpp',\n     ])\n     libcamera_deps += [\n         libegl,\n",
    "prefixes": [
        "05/30"
    ]
}