From patchwork Fri May 23 09:56:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Benjamin Mugnier X-Patchwork-Id: 23430 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 6B2D5BD78E for ; Fri, 23 May 2025 09:57:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1C20868D96; Fri, 23 May 2025 11:57:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.b="2LDtOMeK"; dkim-atps=neutral Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 567E268D76 for ; Fri, 23 May 2025 11:57:36 +0200 (CEST) Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 54N825Uc007895 for ; Fri, 23 May 2025 11:57:35 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=selector1; bh=sErVWvV0IUYR1UWFjv0pdg TlbU3QgRrGwxalmsqhxRk=; b=2LDtOMeK4UUBR5EOLoUAz7hj0jJt4193hskzvs qBDsPh0xojQSPwjEXLgnFjeB8sVnRiNTaHrdGWwzRe+I+L+/cNyyLZhH8B+cwG7h pP9Q43XHOOBajGWgdT15DK05+I3jhgnGL3a1kWKsqsEhdPlUEW1buzH0jn6w5shv SJ4e3uZa3IYD9L1D9NKB6vOYtlm1ts0isigS0hc7EY3+vnNZ9bDF5XOi3ncMTY30 rme1ME5dK/TPR/dhCx/qIc0KYkQi+CjfNQcdgRc47TYSNfG6QQX8MKAek+KAkZFr n7xW9SEHtq35yLMaBN2q1UDaweU581KiXMo3M9BmY982w5jQ== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 46rwffdgb8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 23 May 2025 11:57:35 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 016404005E for ; Fri, 23 May 2025 11:57:10 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 7EC87ADC260 for ; Fri, 23 May 2025 11:57:05 +0200 (CEST) Received: from localhost (10.252.4.195) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 23 May 2025 11:57:05 +0200 From: Benjamin Mugnier Date: Fri, 23 May 2025 11:56:56 +0200 Subject: [PATCH] ipa: rpi: Prevent segfault if AGC algorithm is absent MIME-Version: 1.0 Message-ID: <20250523-fix_segfault_agc-v1-1-aac60d87fd5c@foss.st.com> X-B4-Tracking: v=1; b=H4sIAGdGMGgC/x2MQQqAIBAAvxJ7TjBlCfpKRIiuthAWWhGIf086D sxMgUyJKcPUFUj0cOYjNhj6DuxmYiDBrjEoqVCi0sLzu2YK3tz7tZpgBXo1aiRHFj207EzUnH8 5L7V+5uBASGIAAAA= X-Change-ID: 20250523-fix_segfault_agc-5f2735edec5f To: CC: Benjamin Mugnier X-Mailer: b4 0.14.2 X-Originating-IP: [10.252.4.195] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293, Aquarius:18.0.1099, Hydra:6.0.736, FMLib:17.12.80.40 definitions=2025-05-23_03,2025-05-22_01,2025-03-28_01 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" Even without AGC definition in the tuning file, the application would still dereference agc unconditionally, leading to a segmentation fault if AGC is absent. This is relevant for sensors already providing AGC/AEC by themselves. Check if AGC is present prior to setting maximum exposure time. Signed-off-by: Benjamin Mugnier Reviewed-by: Paul Elder Tested-by: Barnabás Pőcze # RPi4 + imx708_wide --- src/ipa/rpi/common/ipa_base.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- base-commit: ad5326c926831fe7a943d10fd800de43e596f171 change-id: 20250523-fix_segfault_agc-5f2735edec5f Best regards, diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index e0a93daa9db229bb2829803fffc6b2f6c8f11061..e0f8b7e782f4340a069a2d7b9cf9dee3141c72df 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -1563,7 +1563,8 @@ void IpaBase::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDu RPiController::AgcAlgorithm *agc = dynamic_cast( controller_.getAlgorithm("agc")); - agc->setMaxExposureTime(maxExposureTime); + if (agc) + agc->setMaxExposureTime(maxExposureTime); } void IpaBase::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls)