From patchwork Tue Nov 3 10:41:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: GuyliandeJong X-Patchwork-Id: 28767 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 5AB8FC3358 for ; Tue, 3 Nov 2026 12:04:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3E3926A7B0; Tue, 3 Nov 2026 13:04:27 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=proton.me header.i=@proton.me header.b="xRfwwPsF"; dkim-atps=neutral Received: from mail-43100.protonmail.ch (mail-43100.protonmail.ch [185.70.43.100]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D42E26935F for ; Tue, 3 Nov 2026 11:41:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail2; t=1793702514; x=1793961714; bh=nyJ9XBk/SI0rfVQYAXQoIbE/Dtl4lHNg/Y7nm1+ktb8=; h=Date:To:From:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=xRfwwPsFJ3C0Gp34AznwA5YGkEgmazmBsghbxAWt/K281GcS+6014DKBMEy882RQr Y4npYl60hk2GmrzLiZgF2ERyl2/cbIzxv2SA/fOWj9wmwzOULDgzFWr6cRyJviZ9lX qL3ZkYbdP5atlcl/5TKg+552ylS/KWqHKKwnYPrPQ78kRvggJTkxL/rVC60IsfWLnV jVn4W3bG3PSp7Dl30vyMg3a6OTq5oM/+Nxk4iOhWZJnNEtfpLmFFFlxM1LxjW0Apcd 9LIqkz0/FylUvhRx5BRmmB81JM5W/asJvFl6fJ3lOn0zZh/rFcVx1d4olLfTvRE8Fs xvy4ZQddACWVA== Date: Tue, 03 Nov 2026 10:41:52 +0000 To: libcamera-devel@lists.libcamera.org From: GuyliandeJong Subject: [PATCH 2/3] libcamera: camera_sensor: Initialize test pattern mode Message-ID: <20261103104131.87331-3-guyliandejong@proton.me> In-Reply-To: <20261103104131.87331-1-guyliandejong@proton.me> References: <20261103104131.87331-1-guyliandejong@proton.me> Feedback-ID: 112452169:user:proton X-Pm-Message-ID: ecd08c87084ccf902fa182a07f21d0053cb740ba MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 03 Nov 2026 13:04:24 +0100 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 --- 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) { }