From patchwork Wed Dec 17 10:01:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 25573 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D1C0BC3257 for ; Wed, 17 Dec 2025 10:01:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1EDB161A3C; Wed, 17 Dec 2025 11:01:44 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="GWmHjUBs"; dkim-atps=neutral Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6BFA0609DE for ; Wed, 17 Dec 2025 11:01:42 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-47795f6f5c0so35711465e9.1 for ; Wed, 17 Dec 2025 02:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765965701; x=1766570501; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=EoLlFY32Jrv1ny0kxUYYCZeg1ZGU6gp4kq3UCa9UFUw=; b=GWmHjUBs6uyHEnVFnCfIfroHurCvYCQIlJL/PAadoS8l7RdoBtYeo3DdgIMD2YNy10 YiX9PLxuqFamRSTlvQDawER3Sw0oowAgB6o+eHNtxRtETMlQsEk3M5VRbcZQdUswqdBq kkMWnC9X90LvYfhWUgQVSViYsPxRm7kdjCUK1btewFk6nJl1JH20t3MZD7Vm2sFtlK+o rLTMWZ6LhneO9SjkKYGQhjcyVguA/K0nSrVLjSvhH/j2tLdUJWI0sXTOI//DGs8/era2 D8XwBB0ifzVdSxaHQGAVvWzFw3wh1xevRfPlTdDN5qDngeVFi/iPVsHaUzl48AphS4z4 eLBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765965701; x=1766570501; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EoLlFY32Jrv1ny0kxUYYCZeg1ZGU6gp4kq3UCa9UFUw=; b=OqJ5BIXJq0ur2vT4snQxGLEdwZsN2L9MykCUqdcUgFXIUi6+1ULPgDIxPoN+Gc5Wqa l56IPkhq/97l7iywTuEqX3v0J23ZwcS9DAtvJQtrWKRRZD5bEFUCvJO/jD17pR1h7Rq2 Wkl/6LXUbI3gw2c/EIsnQZ02dMgbjTcxISky9lRrSPqU4AxNH1+rOKhMtDs0b/eSkVzn 0iCee0hbSv+hx47ux9tcryV6qv/SCYS8WcTSvuICBOzAUo1ul7ZrChiEjSa5lvIC57KB cDQlcS8qGdxnVFscjnyiI7Q/0rkv+Ix8o5WE2fFB6F+BPciqVQByOd/piRstPbUYeiVg /bjA== X-Gm-Message-State: AOJu0YyMdNT8yO0sUJL9AlgsL7r41b2KvD4h0xMkj9WNKYy3QMCffesz AK52d0BF8V7ff4dUTpd9VoHb4n1fcPTVv5zbGPacyLGgij4fLlzUdWP18LBLa3oMyYGbmZEeV0I wMk62 X-Gm-Gg: AY/fxX4hitITBHbdxSZaEI+oXrfrhPX+DYn6tE5n1J3fWsY6tYi5zhsFziuXj1Yx8pB 31SMcwx2DlQDfQN2CrTUQAMUMRag+/UVRE7Xpjtlk/7eqPeb9UByoD8CbEdxyxVoy6sGckxwvje p8zp0yApR9XKyyBE18hCd2ba+JpeHDCCxEk/pOLNLrUFTML2vQAFRuqcjjGyL24+H+suVvIS/xQ bA48Ul2TB7HV1iex1wuzNCLYGOh8XM1FT531DU09SwVkRCzKAI/fHik5O+iTvadizv99yTL/PbS P9KG9O1mBS1ws3elySBBFAipWuPiXwRgPzFJPCGo70K75a6XZs9CrV3eTNqPboUoTWxIy2hO2XK MzHlVftsf/56AMAjfkqR8gE6kXD5Nx98JnHE1DM9xfU9fjtot0dg+gqpGf+kX/Rn7uGP+ZHFowj eHBsudOphCYiy7333+K1EPtx5bk6p9/KotjXug2jrNiHEZooIZCyad5G9byXstFxqPies= X-Google-Smtp-Source: AGHT+IGCWi3eNnhw/tEBoL1Qf/LZ8OG5xmfGdd5BMbK/zctHA9VJx8r9Uw3QVfgLe/noEQzLSYxZMw== X-Received: by 2002:a05:600c:4751:b0:477:7b9a:bb0a with SMTP id 5b1f17b1804b1-47a8f907e5dmr177069685e9.21.1765965701374; Wed, 17 Dec 2025 02:01:41 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47bdc1583fbsm32292585e9.0.2025.12.17.02.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Dec 2025 02:01:40 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue Subject: [PATCH v9 00/26] Add GLES 2.0 GPUISP to libcamera Date: Wed, 17 Dec 2025 10:01:12 +0000 Message-ID: <20251217100138.82525-1-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" v9: - Rebase on 0.6.0-tip including precursor now merged _______ | YAY! | |_______| ||| /|||\ / ||| \ / ||| \ | / \ / \ - Number of fixes from the formatter now that I'm aware of its existence/use - Bryan/Milan - Includes Robert's changes for the projection matrix - Fixes the case where the uncalibrated.yaml file is enabled. Iterates through list of loaded algorithms matching Ccm. - Milan/Bryan v8: A small number of updates. I'll copy and paste my change notes directly. - gbm patch - \todo, nullptr comments addressed - Milan - Left fail - meant fail - Changed cleanup flow - // namespace libcamera -> /* namespace libcamera */ - Dropped HAVE_GBM - Contrast patch Passed contrastExp as argument to apply_contrast() - Milan - Dropped "invalid." for "invalid" Left "it makes sense" not sure of "let's try" was a suggested commit log comment but - "it makes sense" to me :) - Milan - Changes CCM init to Matrix identityMatrix = Matrix::identity(); Amends commit log - Milan - Fixes the identity CCM commit log Old commit log not updated on review changes - Milan - Changed selfEnumerating to use common code Milan left a comment on not having copied code so I created a helper function and moved a much as I thought I could - Milan - todo - rewriging -> rewiring. onomatopoeic error ! - manging -> managing v7: - Takes Laurent's question on doing egl init in start() instead of configure() and implements it. Tested with repeated start()/stop() from qcam. - A few supporting patches to get data we require in configure() into start() has been added as a result. - Bayer object now has a start() and a stop() - introduced in the precursor series. - Dropped overloaded algorith init() function as Milan seemed to prefer a flag in context_ over an overloaded init(). - Small tidy up on the use of TEXTURE1 instead of TEXTURE4 now that the RGB lookup tables have been dropped too. - Updates the todo list - The one thing not done is passing the complex contrast into the fragment shader per frame, instead of having it calculated per-pixel. I'd rather get the current series out/merged than add this extra bit right now. v6: - Rebases on 0.6.0 - Removes conditional compilation for lookup-table v CCM. The conditional compile to switch the ordering of blue is kept. - Laurent - Removes Bayer lookup table code from shaders and debayer_egl logic Disussed with Laurent and agree it can be dropped now - Adds a patch to pass no-op values to the debayer shaders when running those shaders in qcam. Confirmed this works by switching the true/false flag in simple.cpp and recompiling. Once the raw-streams stuff gets merged changing simple.cpp shouldn't be required. This lets us continue to support the original behaviour of the debayer shaders in Qcam while also reusing those shaders with our extensions in softisp. - Re-orders the patches a bit to group changes a bit more logically especially on more recently added patches. CI is still happy with building as progressive changes. - Drops the patch to make isStandardBayerOrder static as this logic has been squashed into the precursor series. Barnabas v5: - Takes in a fix from Hans for the unpacked center bytes. I opted to have separate stride values passed to the shaders to maintain consistency with qcam - Implements the unique_ptr change Barnabas suggested - Changes to glFinish instead of eglWaitSyncKHR - Milan/Robert - Fixes interface to pass gpuIspEnabled as a parameter - Barnabas - Makes it an error if you request GPUISP but object instantiation fails - Barnabas - Fixes indentation splat in unpacked shader - I love whitespace :( - Laurent - Leaves the upload tables in place - I thought we noted to do this in weekly meeting I'm open/happy to drop this code though its not really necessary now. - Leaves conditional compilation in shaders. The reason being with conditional compilation we can still run the original unmodifed shaders - which gives a nice base to mess with the demosiac phase in isolation. v4: - Drops AWB since the CCM contains it already - Includes Gamma - Includes Contrast - testable via camshark - Includes Saturation - testable via camshark - Includes a scaler from Robert - Includes synch changes from Robert - Includes all feedback incorporated from Pavel - Generates a default 65k CCM if none is supplied - Various Doxygen torments fixed along the way - And is the "top half" of the precursor series as the GPUISP series becomes 44 patches long this is an unreasonable number to merge in one go. - Full testable branch Link: https://gitlab.freedesktop.org/camera/libcamera-softisp/-/tree/v0.5.2-gpuisp-v4e?ref_type=heads - The first part of the series is in the precurso here Link: https://gitlab.freedesktop.org/camera/libcamera-softisp/-/commits/v0.5.2-gpuisp-v4e-split That precursor is just a tag about half way through the integrated series. Bryan O'Donoghue (23): libcamera: software_isp: gbm: Add a GBM helper class for GPU surface access libcamera: software_isp: egl: Add a eGL base helper class qcam: viewfinder_gl: Set no-op Bayer shader values libcamera: shaders: Use highp not mediump for float precision libcamera: shaders: Extend debayer shaders to apply CCM gains libcamera: shaders: Extend bayer shaders to support swapping R and B on output libcamera: shaders: Add support for black level compensation libcamera: shaders: Add support for Gamma libcamera: shaders: Add support for contrast libcamera: software_isp: Add member variables to track selected input/output pixelFormat libcamera: software_isp: Add a Size_ member variable to pass to eGL later libcamera: software_isp: debayer_egl: Add an eGL Debayer class libcamera: software_isp: debayer_cpu: Make getInputConfig and getOutputConfig static libcamera: software_isp: debayer_egl: Make DebayerEGL an environment option libcamera: software_isp: debayer_egl: Make gpuisp default softisp mode ipa: software_isp: Add a selfInitialising flag to IPAContext libcamera: software_isp: ccm: Add self-initialising identity CCM to Ccm::init ipa: libipa: module: Add createSelfEnumeratingAlgorithm ipa: simple: Add a flag to indicate gpuIspEnabled ipa: software_isp: Call createSelfEnumeratingAlgorithm() to statically instantiate CCM algo libcamera: software_isp: lut: Skip calculation lookup tables if gpuIspEnabled is true libcamera: software_isp: lut: Change default Gamma to 1.0/2.2 libcamera: software_isp: Add a gpuisp todo list Hans de Goede (1): libcamera: shaders: Fix input sampling when width != stride Milan Zamazal (2): libcamera: shaders: Rename bayer_8 to bayer_unpacked libcamera: software_isp: GPU support for unpacked 10/12-bit formats include/libcamera/internal/egl.h | 185 +++++ include/libcamera/internal/gbm.h | 39 ++ include/libcamera/internal/meson.build | 1 + include/libcamera/ipa/soft.mojom | 3 +- src/apps/qcam/assets/shader/shaders.qrc | 4 +- src/apps/qcam/viewfinder_gl.cpp | 42 +- src/apps/qcam/viewfinder_gl.h | 12 + src/ipa/libipa/module.cpp | 34 + src/ipa/libipa/module.h | 46 +- src/ipa/simple/algorithms/ccm.cpp | 22 +- src/ipa/simple/algorithms/lut.cpp | 72 +- src/ipa/simple/ipa_context.h | 2 + src/ipa/simple/soft_simple.cpp | 17 + src/libcamera/egl.cpp | 612 +++++++++++++++++ src/libcamera/gbm.cpp | 130 ++++ src/libcamera/meson.build | 33 + src/libcamera/shaders/RGB.frag | 2 +- src/libcamera/shaders/YUV_2_planes.frag | 2 +- src/libcamera/shaders/YUV_3_planes.frag | 2 +- src/libcamera/shaders/YUV_packed.frag | 2 +- src/libcamera/shaders/bayer_1x_packed.frag | 79 ++- .../{bayer_8.frag => bayer_unpacked.frag} | 95 ++- .../{bayer_8.vert => bayer_unpacked.vert} | 6 +- src/libcamera/shaders/meson.build | 4 +- src/libcamera/software_isp/debayer.cpp | 15 + src/libcamera/software_isp/debayer.h | 3 + src/libcamera/software_isp/debayer_cpu.h | 4 +- src/libcamera/software_isp/debayer_egl.cpp | 650 ++++++++++++++++++ src/libcamera/software_isp/debayer_egl.h | 141 ++++ src/libcamera/software_isp/gpuisp-todo.txt | 40 ++ src/libcamera/software_isp/meson.build | 8 + src/libcamera/software_isp/software_isp.cpp | 37 +- 32 files changed, 2266 insertions(+), 78 deletions(-) create mode 100644 include/libcamera/internal/egl.h create mode 100644 include/libcamera/internal/gbm.h create mode 100644 src/libcamera/egl.cpp create mode 100644 src/libcamera/gbm.cpp rename src/libcamera/shaders/{bayer_8.frag => bayer_unpacked.frag} (51%) rename src/libcamera/shaders/{bayer_8.vert => bayer_unpacked.vert} (90%) create mode 100644 src/libcamera/software_isp/debayer_egl.cpp create mode 100644 src/libcamera/software_isp/debayer_egl.h create mode 100644 src/libcamera/software_isp/gpuisp-todo.txt