From patchwork Thu Nov 5 23:07:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Afonso Figuinha X-Patchwork-Id: 28784 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 D6165C335C for ; Fri, 6 Nov 2026 06:12:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7AF8F6914B; Fri, 6 Nov 2026 07:12:10 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="zqs2igf0"; dkim-atps=neutral Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 93AAC6A7C1 for ; Fri, 6 Nov 2026 00:07:20 +0100 (CET) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4a5177d78c7so448955e9.2 for ; Thu, 05 Nov 2026 15:07:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793920040; x=1794524840; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=dx+ZV6Okd+V6CKZfa9pMXnFOdf8oMGb0/UQlyrCbwHY=; b=zqs2igf0eCRJp7EGfS/y0uz9upLQUOcdG9Lk3hujwHGaBoTzAPdUran1q5noAiCVSc QgF8b3pdkNhS16u3c4t3V3hFuXi/UbYUK3cm0deTItqtF8kg9UoyXr+/WZSyg5JFIrQf gt2n615xnxe0l9cefyhVHJTAbD9ZmIYzFOoAVSwR7DF+r/kjMmwtO9/0GNG7Zj1JnSKl E1z7vyRS/WE42tyKo/ZqK/T0bonF3bDSP0kDs+ImAoubkSlxSD4cTaZ+95BS9Siv0XIt 6U3KoCFR6MAjn22Fc75dShoCfWPdf09vvimcusWvgZ1gFodXWIHkB2tNflsheS5gZUDx 3WYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793920040; x=1794524840; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=dx+ZV6Okd+V6CKZfa9pMXnFOdf8oMGb0/UQlyrCbwHY=; b=Y1R1ILS2pLpTNv06msBHzWGt98rCbsKBGJMARSPc0U74Mb7C1d1QXBDtD+78wkOzc9 iBFNlwhH4J+C3xMrNE6c8UJZ/M9q5SAcBzq6+aPDMGk+OlJ3+Ya1txMyHntE9qSx1RJf B7IpK+PYb9AtfWJB2R70R1rX8iHj4qw6vSSNzozrPTCSwpZcyMyjyZbd66LvO9Xt40H8 Z7xveHOf6DmVggqf5aVMabeqYd6akBorCJk5Xzph+meJayyJKgReGUYGot4gh08yWkpM SOi6fM8E1jaW85kZ0V3pFb/6wpydbBbC2Hesijax9wrgDqMhBEkkEaofAu/Pfx+Aa6xb dlvQ== X-Gm-Message-State: APuU4Z9hlbi5UBwEVRdbGb6GzZNg4hIyuT/9xWGe47UKfXpE2FxnLnDK mNLoejStns/jlk8qMhDJur8wqHsMUqKck9xqSOYs+wBM0cLcjHCPGg+DaDzu85Hr X-Gm-Gg: AYBFou1i8jmGxGybSaGNrsnPBK2f8cQtzEwyw1dHCKk6KtfRfluwxRIL/ja4OCdL6Fv nwaYt92Q5gevPqAFwpVcLGkuIWLPxerMY/C3XX0Ndc9tIv5tioB8nntmARCD6BWMSTjLrimgwA1 gydWlrsFkqh86OCj17LTiBLwLHEpdLRHKfL+dmAlDqWcmXgHTlfJiFeVli18f7RNcMU5ikB5stm 6F+xnuBYYd2LpGTlBq+3jwDfBTed6jPT8YHUg0r2I5cqo2it3TSO7juEq2wcWDUv40+qN25tXOv 7+xioFhxp+NzPNA+HT/ZfpG1Bwj1HAnPVGeYAMIwB5TV6PcBLZsP3ipwCRq5vrISJ4vf/Apqfgi 8o2DzBIEgXRlJCadZX0z3oug/gR1sQJh0FcbfX93rgaZjgIcho2uJt7qVwTFjDO39Oo2Sej4AYv 1sme/KYUT1ZKQWANSlFbnY3Jt9C+zBJ5CoDnYlyldVFZHKAf25oQJDKAoU6F4wAf8EyiShd4V/M l1tAHq9XMoGTSIGhcVTq60CVNuUzqDqIyySTonJ1LeIIPcLEdMmIPKNlPhXW7sxxwYo0z6dQeFK kX3IsLHLx8Qmd2P+yEDQyUazG0W3YKoGAI35ITV0atg3rYqolW4PF8Cwq6dMZChnmF4XKw== X-Received: by 2002:a05:600c:1c08:b0:4a5:5fb9:5d35 with SMTP id 5b1f17b1804b1-4b6df5eac1amr10248335e9.21.1793920039994; Thu, 05 Nov 2026 15:07:19 -0800 (PST) Received: from figssurface ([176.223.29.246]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-492d3d60e94sm183428f8f.2.2026.11.05.15.07.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2026 15:07:19 -0800 (PST) From: Afonso Figuinha To: libcamera-devel@lists.libcamera.org Subject: [PATCH 3/4] libcamera: sensor: Initialize the test pattern mode Date: Thu, 5 Nov 2026 23:07:07 +0000 Message-ID: <20261105230708.14601-4-afonso.figuinha@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261105230708.14601-1-afonso.figuinha@gmail.com> References: <20261105230708.14601-1-afonso.figuinha@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 06 Nov 2026 07:12:06 +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" testPatternMode_ is never initialized in CameraSensorLegacy and CameraSensorRaw. init() calls applyTestPatternMode(TestPatternModeOff), but that function returns early without updating testPatternMode_ when the sensor has no test pattern modes, which is the case for sensors missing from the camera sensor properties database. setTestPatternMode() then compares the requested mode with an uninitialized value. When the pipeline handler disables the test pattern before starting the camera, as the IPU3 pipeline handler does, the result depends on that value: the call either returns 0 or fails with -EINVAL, and Camera::start() fails intermittently. Initialize testPatternMode_ to TestPatternModeOff, which is the mode init() applies. The change and this description were drafted with an AI coding assistant (Claude Code, model Claude Opus 5.5). The author reviewed them and tested them on a Microsoft Surface Laptop 1. Fixes: 7ee7dc3369eb ("camera_sensor: Suppress error message if test patterns are unavailable") Signed-off-by: Afonso Figuinha --- src/libcamera/sensor/camera_sensor_legacy.cpp | 1 + src/libcamera/sensor/camera_sensor_raw.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) 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..58fdbfb7 100644 --- a/src/libcamera/sensor/camera_sensor_raw.cpp +++ b/src/libcamera/sensor/camera_sensor_raw.cpp @@ -164,7 +164,9 @@ private: */ CameraSensorRaw::CameraSensorRaw(const MediaEntity *entity) - : entity_(entity), staticProps_(nullptr), supportHFlips_(false), + : entity_(entity), staticProps_(nullptr), + testPatternMode_(controls::draft::TestPatternModeOff), + supportHFlips_(false), supportVFlips_(false), flipsAlterBayerOrder_(false), properties_(properties::properties) {