From patchwork Tue Feb 11 10:20:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 22775 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 4B99CBD1F1 for ; Tue, 11 Feb 2025 10:23:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 542E768621; Tue, 11 Feb 2025 11:23:32 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="G6BK+sMg"; 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 2247E61865 for ; Tue, 11 Feb 2025 11:23:30 +0100 (CET) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-43938828d02so4068075e9.1 for ; Tue, 11 Feb 2025 02:23:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1739269409; x=1739874209; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=4dyl7xP7Mrndp9vkgsdnkXWXMyudrHUKqaOZdrZf6o4=; b=G6BK+sMg5GyQ7vq5OonXzoQGhDsr8NCpZIbTkYmh15mLCVSbTUuHG8BnBJSUg454ll vq3Cua6rYL035qnmPKEP18VmdkClg+9iqxQYeSO9uOr9Kjy1nXEwynMldGJqog/GaJ4K Ck2hnxMrL0u/Uif60aP5WSbvkzV1ylQ6hKayGPDYKDIjbipV5M4ySD02iZRnvNKFtA6m 516zCgLGmIwl2cO+XBvEuq/A7ecuDX9tmxJA25jOsh2yEXCZjlXYgb2C3WHLa1jyv3O5 I1J1Ra139UmnQ5qVmPcZQrTi8sdmZjYM8BmB7JpMa9qVAcMX6Moy8uERahv5BjxoU7+Y xPDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739269409; x=1739874209; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4dyl7xP7Mrndp9vkgsdnkXWXMyudrHUKqaOZdrZf6o4=; b=ebtlsS9Wg03zDosq5Elxy8ntXOGXSRqzqzC2KmdzqFnKvvaz4ZshDYWhnedn/rQlDZ QdubHRrdUNQWIxKh1iIez8oLQ/bgzGjvPwEleK/lvYEUcELTUj4AbLz8lDy9hEpPKCAB 3mlBUsrn7iKPGWSs87by0M0WT+0bIHbBuzzLv+17ytxYokY3SoPQXgKG1l2ccsImklQQ 6TnfW/KZhPXyqc4RlXiPePJcB9iJqZxwlNPCYDl96Dm6AFUWokjTpZ6ODZt78WJzvIpF v2d3J/RGeFkVuDeroh6gkVzH7cNbC53PxUXEVMfYwJqXsDadI1oBrYeQTryF4JeH4wwZ jfrQ== X-Gm-Message-State: AOJu0Yy3VpOLlO06zPoOLGjzBkc0XMXlqw+0nQhgMUoCn1FEDn18pKX0 tQ6OyVJr/Z5ren95nP/8/buzkQA4JPaVclE3vI3O64TMW8nOqAO25PJKwF9FyPZIq/9NRdcnUin B8Dk= X-Gm-Gg: ASbGncv4BXsWAg3vyUDpIq3PodHt9Qf8FdL5TD5dZu6tPMW/daTpjBjrvbL6m+h16Rw TLe2udClJ4eHyzM7YUoi9XTwQu3mRLoL2NuPthB8v+Y7S1uE8o4Aqkr8a4UHB8+hZlgj6w3Nh+W h/00oAQyJpXlrLW4A1ebN+tNFbjZevNEJNDhNGqI06EO1NncGhsNyAB20QroGc2Dfn7MS1V1D57 +99hjbq0REekqVjyuchlCVKal4HM61GpG+M5CqDPehuoeNThMGLKSpT3DyaknjH97slnGjXSbRy wURzU/jl7pO1iTM2H5dfwUMD6hrTh3OY97M= X-Google-Smtp-Source: AGHT+IEpZQNacMOi8+IoOCozeqD/mjT20oPUQG/WsyVoCWSDnieLLPzxWteXNptmY5JqaJfoHdhA/w== X-Received: by 2002:a05:600c:4fd5:b0:439:4a36:ab7 with SMTP id 5b1f17b1804b1-4394dc02d8fmr7148235e9.1.1739269409090; Tue, 11 Feb 2025 02:23:29 -0800 (PST) Received: from NAUSH-P-DELL.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4390d96530fsm204084075e9.19.2025.02.11.02.23.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2025 02:23:28 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , David Plowman Subject: [PATCH v3] ipa: rpi: Apply default ControlInfo values for sensor controls Date: Tue, 11 Feb 2025 10:20:02 +0000 Message-ID: <20250211102327.55021-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.43.0 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 existing IPA initialisation code did not set default values for some sensor related controls. This caused a crash using libcamerify when the it was trying to access the default value for controls::FrameDurationLimits as part of a recent change. Ensure controls::FrameDurationLimits, controls::AnalogueGain and controls::ExposureTime advertise default values along with the existing min/max values. The default is set to the defaults defined in the IPA set during initialisation. Bug: https://bugs.libcamera.org/show_bug.cgi?id=253 Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Kieran Bingham --- Changes in v3: Need to apply the same default in the init phase since the test in the V4L2CameraProxy::setFmtFromConfig() happens before calling ipa::configure(). --- src/ipa/rpi/common/ipa_base.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index bd3c22000df5..5d2c6d40da3e 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -61,12 +61,13 @@ const ControlInfoMap::Map ipaControls{ ControlInfo(static_cast(controls::ExposureTimeModeAuto), static_cast(controls::ExposureTimeModeManual), static_cast(controls::ExposureTimeModeAuto)) }, - { &controls::ExposureTime, ControlInfo(0, 66666) }, + { &controls::ExposureTime, + ControlInfo(1, 66666, static_cast(defaultExposureTime.get())) }, { &controls::AnalogueGainMode, ControlInfo(static_cast(controls::AnalogueGainModeAuto), static_cast(controls::AnalogueGainModeManual), static_cast(controls::AnalogueGainModeAuto)) }, - { &controls::AnalogueGain, ControlInfo(1.0f, 16.0f) }, + { &controls::AnalogueGain, ControlInfo(1.0f, 16.0f, 1.0f) }, { &controls::AeMeteringMode, ControlInfo(controls::AeMeteringModeValues) }, { &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) }, { &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) }, @@ -80,7 +81,9 @@ const ControlInfoMap::Map ipaControls{ { &controls::HdrMode, ControlInfo(controls::HdrModeValues) }, { &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) }, { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }, - { &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) }, + { &controls::FrameDurationLimits, + ControlInfo(INT64_C(33333), INT64_C(120000), + static_cast(defaultMinFrameDuration.get())) }, { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }, { &controls::rpi::StatsOutputEnable, ControlInfo(false, true, false) }, }; @@ -259,15 +262,18 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa ControlInfoMap::Map ctrlMap = ipaControls; ctrlMap[&controls::FrameDurationLimits] = ControlInfo(static_cast(mode_.minFrameDuration.get()), - static_cast(mode_.maxFrameDuration.get())); + static_cast(mode_.maxFrameDuration.get()), + static_cast(defaultMinFrameDuration.get())); ctrlMap[&controls::AnalogueGain] = ControlInfo(static_cast(mode_.minAnalogueGain), - static_cast(mode_.maxAnalogueGain)); + static_cast(mode_.maxAnalogueGain), + static_cast(defaultAnalogueGain)); ctrlMap[&controls::ExposureTime] = ControlInfo(static_cast(mode_.minExposureTime.get()), - static_cast(mode_.maxExposureTime.get())); + static_cast(mode_.maxExposureTime.get()), + static_cast(defaultExposureTime.get())); /* Declare colour processing related controls for non-mono sensors. */ if (!monoSensor_)