From patchwork Thu Nov 12 08:52:09 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: GuyliandeJong X-Patchwork-Id: 28870 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 0E321C3304 for ; Thu, 12 Nov 2026 08:52:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8C00C6918C; Thu, 12 Nov 2026 09:52:15 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=proton.me header.i=@proton.me header.b="juQFhx7R"; dkim-atps=neutral Received: from mail-10628.protonmail.ch (mail-10628.protonmail.ch [79.135.106.28]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 490AD690E6 for ; Thu, 12 Nov 2026 09:52:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail2; t=1794473533; x=1794732733; bh=PNpONXnew8YED7h5Cp6mW71stPQG6imxNLQipOwnes8=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=juQFhx7RI7y0DAgGhtAO4dqhGmJ6xwlLZWag8dB89WFaqYnsUDya0jlo05doltDhX 6M/2q10qKlE15KRfod5eu3P83ZsXT00r2sbGgvSdo2ofreE54N7Bsy4eNjV4vonUo+ vyOFtx+iJEZfTqtuQRy7Aho/CXcSN6Qy0WeLBOtufLNROqNs8DFjvIjJc9czScGq9q JaAL0xgzrX5qUB5YBCFpQ0FRG98OA1KwgBWdDEz+NeSkgCUZui56xu5Qp2Hwwcc1Oj vierUxq+qZMguFoyBkkBP6zgMb3+0+HtWl9WIYpR504p1J2f1g13TlBhKCx9Q1iPv8 EfHMMWm6jRkDQ== Date: Thu, 12 Nov 2026 08:52:09 +0000 To: libcamera-devel@lists.libcamera.org From: GuyliandeJong Cc: Barnabas Pocze , Afonso Figuinha Subject: [PATCH v2 1/3] libipa: camera_sensor_helper: Add OV9734 Message-ID: <20261112085159.14289-2-guyliandejong@proton.me> In-Reply-To: <20261112085159.14289-1-guyliandejong@proton.me> References: <20261103104131.87331-1-guyliandejong@proton.me> <20261112085159.14289-1-guyliandejong@proton.me> Feedback-ID: 112452169:user:proton X-Pm-Message-ID: cb4eed86d6f27c4e3b3bfb8500209c596c8d5fc3 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" Add a camera sensor helper for the OmniVision OV9734, used as the front camera of the Microsoft Surface Laptop 2. The kernel ov9734 driver writes V4L2_CID_ANALOGUE_GAIN directly to the 0x350a gain register, with a range of 16 to 248. The register is a Q4 fixed point value, so 16 is unity gain, giving a linear model of gain = code / 16. The driver doesn't program the black level calibration target, so the sensor default of 0x10 at 10 bits applies, which is 1024 at 16 bits. This matches raw frames captured with the lens covered, which average 16.7 to 17.0 in all four Bayer channels at minimum exposure and unity gain. Without a helper the IPU3 IPA can't be used with this sensor. Signed-off-by: GuyliandeJong Tested-by: Afonso Figuinha --- src/ipa/libipa/camera_sensor_helper.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp index 608937d4..4de1a1f3 100644 --- a/src/ipa/libipa/camera_sensor_helper.cpp +++ b/src/ipa/libipa/camera_sensor_helper.cpp @@ -942,6 +942,19 @@ public: }; REGISTER_CAMERA_SENSOR_HELPER("ov8865", CameraSensorHelperOv8865) +class CameraSensorHelperOv9734 : public CameraSensorHelper +{ +public: + CameraSensorHelperOv9734() + { + /* Sensor default black level target: 0x10 at 10 bits. */ + blackLevel_ = 1024; + /* Analogue gain is a Q4 value, 16 is unity gain. */ + gain_ = AnalogueGainLinear{ 1, 0, 0, 16 }; + } +}; +REGISTER_CAMERA_SENSOR_HELPER("ov9734", CameraSensorHelperOv9734) + class CameraSensorHelperOv13858 : public CameraSensorHelper { public: From patchwork Thu Nov 12 08:52:12 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: GuyliandeJong X-Patchwork-Id: 28871 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 2BF58C3304 for ; Thu, 12 Nov 2026 08:52:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B3097691C1; Thu, 12 Nov 2026 09:52:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=proton.me header.i=@proton.me header.b="Z9ka+fje"; dkim-atps=neutral Received: from mail-106120.protonmail.ch (mail-106120.protonmail.ch [79.135.106.120]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1DD296912D for ; Thu, 12 Nov 2026 09:52:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail2; t=1794473538; x=1794732738; bh=4Ainmoy558xGpP9Z9BaOtaFQSFORuGEOECRXdPRlEQc=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=Z9ka+fjeJtrEw1n3S0s6yfIQ/U01Z8h7rpR5piN5uhEqLpHKMGwg3nbX8M8sszLnI eYnbAzQNjkqtSkPQRZOXTj6Ve17oZ9Cku99a8FzRgUtVQOQTHenAcpa2fC7ZpjgEPE wa5F0iYLhDM/sdtAh9/yez5XBPNoAAVTA3zRRc+tl3faTGsAVb0ci3f8joS/DLuTYb y2TET6py0P+DNTrXEWXUsi6kq6G4LGDqlSLFt1+j6WN6aUdoFNIbNagyqqI/PTgcdh OCtYCZJrYW3gq7OODmU/4/gOWA+SLNuYGtpVQyf693KxELbnodSjYtBfdNFFTbaygT cdfWEKp6lMOHg== Date: Thu, 12 Nov 2026 08:52:12 +0000 To: libcamera-devel@lists.libcamera.org From: GuyliandeJong Cc: Barnabas Pocze , Afonso Figuinha Subject: [PATCH v2 2/3] libcamera: camera_sensor: Initialize test pattern mode Message-ID: <20261112085159.14289-3-guyliandejong@proton.me> In-Reply-To: <20261112085159.14289-1-guyliandejong@proton.me> References: <20261103104131.87331-1-guyliandejong@proton.me> <20261112085159.14289-1-guyliandejong@proton.me> Feedback-ID: 112452169:user:proton X-Pm-Message-ID: 53be9cb4bad74157de6d704460f1a3931a0f4ff7 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" The testPatternMode_ member of CameraSensorLegacy and CameraSensorRaw is never initialized in the constructors. It is only assigned by applyTestPatternMode(), which returns early without touching it when the sensor has no test pattern modes. The IPU3 pipeline handler calls setTestPatternMode(TestPatternModeOff) in start(). For a sensor without test pattern modes, setTestPatternMode() compares the mode with the uninitialized value and, if they differ, returns -EINVAL as the sensor doesn't support test patterns. Camera start then fails at random, depending on the content of the memory. This was seen with the OV9734 on a Surface Laptop 2, which has no entry in the camera sensor properties database. Initialize testPatternMode_ to TestPatternModeOff, which matches the state that init() puts the sensor in. Signed-off-by: GuyliandeJong Reviewed-by: Barnabás Pőcze Tested-by: Afonso Figuinha --- src/libcamera/sensor/camera_sensor_legacy.cpp | 1 + src/libcamera/sensor/camera_sensor_raw.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp index 792e4b09..fe5664e0 100644 --- a/src/libcamera/sensor/camera_sensor_legacy.cpp +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp @@ -156,6 +156,7 @@ private: CameraSensorLegacy::CameraSensorLegacy(const MediaEntity *entity) : entity_(entity), pad_(UINT_MAX), staticProps_(nullptr), + testPatternMode_(controls::draft::TestPatternModeOff), bayerFormat_(nullptr), supportHFlips_(false), supportVFlips_(false), flipsAlterBayerOrder_(false), properties_(properties::properties) { diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp index 55b386ce..b87ec0eb 100644 --- a/src/libcamera/sensor/camera_sensor_raw.cpp +++ b/src/libcamera/sensor/camera_sensor_raw.cpp @@ -164,8 +164,10 @@ private: */ CameraSensorRaw::CameraSensorRaw(const MediaEntity *entity) - : entity_(entity), staticProps_(nullptr), supportHFlips_(false), - supportVFlips_(false), flipsAlterBayerOrder_(false), + : entity_(entity), staticProps_(nullptr), + testPatternMode_(controls::draft::TestPatternModeOff), + supportHFlips_(false), supportVFlips_(false), + flipsAlterBayerOrder_(false), properties_(properties::properties) { } From patchwork Thu Nov 12 08:52:15 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: GuyliandeJong X-Patchwork-Id: 28872 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 95BDCC3304 for ; Thu, 12 Nov 2026 08:52:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 388BC69213; Thu, 12 Nov 2026 09:52:23 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=proton.me header.i=@proton.me header.b="X03Rf7dt"; dkim-atps=neutral Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6625069146 for ; Thu, 12 Nov 2026 09:52:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail2; t=1794473538; x=1794732738; bh=8Vab2uQuuErvYy+k5NJTMeSyvaqorBkp9aRt2DNoLJw=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=X03Rf7dtb2XOL9GS392M1G7mwp6b0JvFERX9BroQzD8rgkaA4OaEMaYkxdqNQP4Kz EOt17tx32YmNkecwH1kVHFLpLSatU8HXzxzDNzOfyUHiODFA+QctkeG3npuiromEe6 vFBhgou63QhRCXLtkD3nFvXOPqKFSzIXOLcMoYkSlO/RONRJkEwitJYRRpVmY2hEqI //Oc85dZI3sV0mMqsWoTIu91CoEvzrzJINx4+mxubGoUp7YZ1eih66aniBr8mc8ToR 0U58+i4/Y1SWlgLZPZQ5sV2izgg49xpN33M9NPbBpKJ4FrBMMlUW30xL/KpJ/omXOW YsOezMrwI2hQw== Date: Thu, 12 Nov 2026 08:52:15 +0000 To: libcamera-devel@lists.libcamera.org From: GuyliandeJong Cc: Barnabas Pocze , Afonso Figuinha Subject: [PATCH v2 3/3] libcamera: pipeline: ipu3: Bound viewfinder size to the ImgU limits Message-ID: <20261112085159.14289-4-guyliandejong@proton.me> In-Reply-To: <20261112085159.14289-1-guyliandejong@proton.me> References: <20261103104131.87331-1-guyliandejong@proton.me> <20261112085159.14289-1-guyliandejong@proton.me> Feedback-ID: 112452169:user:proton X-Pm-Message-ID: e1827460abe99e7c83bfc799136fb42faf1afdb3 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" The default size of the Viewfinder and VideoRecording streams is 1280x720, bounded by the sensor resolution. It is also used as the maximum size of the StreamFormats ranges reported for these roles. validate() requires the ImgU outputs to be strictly smaller than the CIO2 output, aligned down to 64x32. For a sensor no wider than 1280 pixels or no taller than 736 lines, the default size is then larger than what validate() accepts. With the OV9734 (1296x734) on a Surface Laptop 2, 1280x720 is reported while validate() adjusts it to 1280x704. Applications that pick sizes from StreamFormats, such as PipeWire, get configurations adjusted behind their back, which made WirePlumber abort. Apply the same margin to the sensor resolution as validate() and as the StillCapture role already does, before bounding it to 1280x720. Larger sensors are not affected. Signed-off-by: GuyliandeJong Tested-by: Afonso Figuinha --- src/libcamera/pipeline/ipu3/ipu3.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 46af776e..df493819 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -444,10 +444,14 @@ PipelineHandlerIPU3::generateConfiguration(Camera *camera, std::span