From patchwork Tue Nov 25 16:28:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 25205 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 7811AC3338 for ; Tue, 25 Nov 2025 16:30:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 218C360B30; Tue, 25 Nov 2025 17:30:13 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DojNeDAJ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DA3B260AD0 for ; Tue, 25 Nov 2025 17:30:11 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:bae1:340c:573c:570b]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id E933D6AF; Tue, 25 Nov 2025 17:28:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1764088083; bh=Ph1nfg8mvjVX1JdKj+tQ/BpziA69Zqy+s4I6Wt+ey6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DojNeDAJ7fnZAIRM3l/nGX+DisYSbW8VR+WIBu7jPd0zHC9jTIjtWOxxWPtE1dnOI L/76HLvu52j79+vOyWoFQC5SqoZG3Gin6zuHXkzYYeKwk19CaVk+VFvN8PrMxkgMLr q8ZVr4qN5T4BAiBgn37Rfzqzsa8So5k7SFZjUEMI= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder Subject: [PATCH v3 26/29] libcamera: Add and implement LensDewarpEnable control Date: Tue, 25 Nov 2025 17:28:38 +0100 Message-ID: <20251125162851.2301793-27-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251125162851.2301793-1-stefan.klug@ideasonboard.com> References: <20251125162851.2301793-1-stefan.klug@ideasonboard.com> 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" Add a LensDewarpEnable control to enable or disable lens dewarping if it is configured. Implement it inside the dw100 converter module. Signed-off-by: Stefan Klug Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- Changes in v3: - Moved control handling into converter module - Moved yaml handling into converter module - Collected tag Changes in v2: - Merged control definition and usage into one patch - Improved control description - Fixed actual handling of LensDewarpEnable control that got lost in a previous rebase --- src/libcamera/control_ids_core.yaml | 7 +++++++ src/libcamera/converter/converter_dw100.cpp | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml index f781865859ac..3bcb475fd102 100644 --- a/src/libcamera/control_ids_core.yaml +++ b/src/libcamera/control_ids_core.yaml @@ -1346,4 +1346,11 @@ controls: reduces the WdrExposureValue until the amount of pixels that are close to saturation is lower than this value. + - LensDewarpEnable: + type: bool + direction: inout + description: | + Enable or disable lens dewarping. This control is only available if lens + dewarp parameters are configured in the tuning file. + ... diff --git a/src/libcamera/converter/converter_dw100.cpp b/src/libcamera/converter/converter_dw100.cpp index 03ffd939dc63..7adad1b502f0 100644 --- a/src/libcamera/converter/converter_dw100.cpp +++ b/src/libcamera/converter/converter_dw100.cpp @@ -343,6 +343,9 @@ void ConverterDW100Module::updateControlInfos(const Stream *stream, ControlInfoM controls[&controls::ScalerCrop] = ControlInfo(Rectangle(sensorCrop_.x, sensorCrop_.y, 1, 1), sensorCrop_, sensorCrop_); + if (dewarpParams_.has_value()) + controls[&controls::LensDewarpEnable] = ControlInfo(false, true, true); + if (!converter_.supportsRequests()) LOG(Converter, Warning) << "dw100 kernel driver has no requests support." @@ -366,6 +369,12 @@ void ConverterDW100Module::setControls(const Stream *stream, const ControlList & auto &info = vertexMaps_[stream]; auto &vertexMap = info.map; + const auto &lensDewarpEnable = controls.get(controls::LensDewarpEnable); + if (lensDewarpEnable) { + vertexMap.setLensDewarpEnable(*lensDewarpEnable); + info.update = true; + } + const auto &crop = controls.get(controls::ScalerCrop); if (crop) { vertexMap.setScalerCrop(*crop); @@ -394,6 +403,9 @@ void ConverterDW100Module::populateMetadata(const Stream *stream, ControlList &m auto &vertexMap = vertexMaps_[stream].map; meta.set(controls::ScalerCrop, vertexMap.effectiveScalerCrop()); + + if (dewarpParams_.has_value()) + meta.set(controls::LensDewarpEnable, vertexMap.lensDewarpEnable()); } /**