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) { }