From patchwork Sun Nov 29 15:24:10 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alain_Cousini=C3=A9?= X-Patchwork-Id: 29101 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 52DCDC3355 for ; Sun, 29 Nov 2026 15:24:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B3D556AA34; Sun, 29 Nov 2026 16:24:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=laposte.net header.i=@laposte.net header.b="tewYAICp"; dkim-atps=neutral Received: from smtp-outgoing-2001.laposte.net (smtp-outgoing-2001.laposte.net [160.92.124.108]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 721DA6AA2B for ; Sun, 29 Nov 2026 16:24:18 +0100 (CET) X-mail-filterd: {"version":"1.9.7", "queueID":"4jcrXx00Wpz10MQQ", "contextId": "02d92389-db3b-4123-86cc-eaa1c4bbc8c2"} Received: from outgoing-mail.laposte.net (localhost.localdomain [127.0.0.1]) by mlpnf0120.laposte.net (SMTP Server) with ESMTP id 4jcrXx00Wpz10MQQ; Sun, 29 Nov 2026 16:24:17 +0100 (CET) X-mail-filterd: {"version":"1.9.7", "queueID":"4jcrXw4P7zz10MQ4", "contextId": "713989ea-8bcf-4a20-b503-66f22ec4c6a2"} X-lpn-mailing: LEGIT X-lpn-spamrating: 36 X-lpn-spamlevel: not-spam Received: from debian.home (m-dj.hd.free.fr [82.67.82.126]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mlpnf0120.laposte.net (SMTP Server) with ESMTPSA id 4jcrXw4P7zz10MQ4; Sun, 29 Nov 2026 16:24:16 +0100 (CET) From: =?utf-8?q?Alain_Cousini=C3=A9?= To: libcamera-devel@lists.libcamera.org, Milan Zamazal Cc: Hans de Goede , Bryan O'Donoghue , =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= , Laurent Pinchart , Jai Luthra Subject: [PATCH v8 0/6] libcamera: software_isp: Add support for raw monochrome formats Date: Sun, 29 Nov 2026 16:24:10 +0100 Message-ID: <20261129152416.174279-1-alain.cousinie@laposte.net> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laposte.net; s=lpn-wlmd; t=1795965858; bh=zRKDVo9IG+ChMCxmPUPQh0WDH3WCB+jZkAePkOQP154=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; b=tewYAICpIKJh8I9uSEBlgwvcMgfzteEQ9lKPoXvAW8Q847ImEVTm3ebX+kwi/L9FXknnR7tjaaYjtVemlCN4atcNJ3tzo5K77bg6+o0kfA4uNhBuEijObNNPaFamj0n2pH9jzyKZFKLqmMiFclT+JuCmljd4z4JM8USqsH49j0WKsMYrRgmLNoH8g1GJxlROkV2SVtg6FXKYaiyjCQf3Zwslyk5T9+j9XZ1z2Ci7Z4QGHmL0klfNOxRdY26s0vm7PeTM6+RK9bikVoMDBr/wnFN1/xVI4Wioj5Mu7matkPYIUtyz+zWehSeHjhPONtA/yYti0p1ITn0aP3k4WdI8ww==; 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 This series adds support for raw monochrome formats to the software ISP, in both the CPU debayer and the GPU (EGL) debayer. A monochrome sensor has no colour channels: debayering becomes a grey-level conversion, the colour correction matrix (CCM) is skipped and the statistics are computed directly on the pixel values. Supported formats: R8, R10, R12, R16 (unpacked), R10 and R12 (CSI-2 packed). Changes from v7 to v8 (following Milan's review): - A single mono.frag, reusing identity.vert, replaces mono.vert and the two monochrome fragment shaders, as discussed in v6. The LSB_SIZE and LSB_MASK_VAL defines are gone. - GPU: width_ is used as the shader stride for packed formats, as for the Bayer shaders, and the CCM uniform is set whenever the shader declares it. - SoftwareIsp no longer forces ccmEnabled_ and lscEnabled_: only the CCM is skipped for monochrome, Bayer is untouched. - R14 support is dropped, as DRM_FORMAT_R14 does not exist in the Linux kernel headers. It can be added if the kernel evolves. - The commit messages explain each change. Test status: - Real hardware: OmniVision OG0VA1B sensor (monochrome, 640x480, Y10 only, supported by the og0ve1b driver in Linux 7.4) on Intel IPU6. - Other formats (R8, R10P, R12, R12P, R16): patch 6 converts the real R10 stream on the fly to the format selected by LIBCAMERA_SOFTISP_SIM_MONO, so the whole chain (capture, stats, debayer) runs on each layout. I checked with qcam that each format works, with both the CPU and the GPU debayers. - Not tested on real hardware: packed formats, R8, R12 and R16. Tests on other monochrome sensors would be very welcome. Patch 6 is a test patch, not meant to be merged. Known difference between CPU and GPU when the output is smaller than the input. The CPU debayer crops a centred area of the image, at the native resolution (window_). The GPU debayer sets the projection with a scale factor equal to the ratio between the output size and the native size from sizes(): it resizes the whole image. With the same configuration, the visible field therefore differs: on a 640x480 monochrome sensor with a 320x240 output (qcam -s width=320,height=240), the GPU shows the whole scene reduced by half, while the CPU shows the central half at the native size. This projection code is not modified by the series. I am leaving this behaviour as it is. --- Alain CousiniƩ (6): libcamera: software_isp: Add support for monochrome formats - Shader libcamera: software_isp: Add support for monochrome formats - Stats libcamera: software_isp: Add support for monochrome formats - CPU libcamera: software_isp: Add support for monochrome formats - GPU libcamera: software_isp: Add support for monochrome formats - SOFT libcamera: software_isp: Add support for monochrome formats - TEST NO PROD .../internal/software_isp/swstats_cpu.h | 13 ++ src/libcamera/pipeline/simple/simple.cpp | 6 +- src/libcamera/shaders/meson.build | 1 + src/libcamera/shaders/mono.frag | 168 ++++++++++++++ src/libcamera/software_isp/debayer.cpp | 205 +++++++++++++++++- src/libcamera/software_isp/debayer.h | 18 ++ src/libcamera/software_isp/debayer_cpu.cpp | 178 ++++++++++++++- src/libcamera/software_isp/debayer_cpu.h | 19 ++ src/libcamera/software_isp/debayer_egl.cpp | 88 +++++++- src/libcamera/software_isp/software_isp.cpp | 13 +- src/libcamera/software_isp/swstats_cpu.cpp | 184 ++++++++++++++++ 11 files changed, 875 insertions(+), 18 deletions(-) create mode 100644 src/libcamera/shaders/mono.frag