From patchwork Fri Jan 10 23:57:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 22519 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 77284C32FB for ; Fri, 10 Jan 2025 23:58:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F0BF768557; Sat, 11 Jan 2025 00:58:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="bbt/+/Z1"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 793F868549 for ; Sat, 11 Jan 2025 00:58:11 +0100 (CET) Received: from pyrite.hamster-moth.ts.net (unknown [IPv6:2604:2d80:9e93:ad00:3d82:7e4f:ab9b:8a]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2ACB8166C; Sat, 11 Jan 2025 00:57:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1736553436; bh=Meh6ICwMrOG2ZLDUDJiPzmPzZux1JSzdWHkmA7+xJOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bbt/+/Z1jMLLM9+Pmy6L4E1quDhG20AkrCA9pyKqCilG8cwNZtl0FT0smP8DjHO/w IAe92MBbM2V4EN6thIDJ4x601UKBj7w+62vqLjAHspwtr4y1ljBSWwh5Ir1mszRkFT Ns2FlWnkY65sbqTo0FbEzUKdv1cL07Di9YbvsgDE= From: Paul Elder To: libcamera-devel@lists.libcamera.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, stefan.klug@ideasonboard.com Subject: [PATCH v7 10/12] libcamera: camera: Pre-process AeEnable control Date: Fri, 10 Jan 2025 17:57:35 -0600 Message-Id: <20250110235737.1524733-11-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20250110235737.1524733-1-paul.elder@ideasonboard.com> References: <20250110235737.1524733-1-paul.elder@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" Handle the AeEnable under the hood in the Camera class, such that AeEnable activates ExposureTimeMode and AnalogueGain together. This allows applications the convenience of setting auto/manual mode of all of the AE-related controls, as well as protecting applications against a nasty behavior change if an aperture control is added in the future. This also moves common handling code out of the IPA. While we also want to inject AeEnable in Camera::controls() so that IPAs don't have to report it, it is technically difficult at the moment as ControlInfoMaps are not easily modifiable. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Stefan Klug --- Changes in v7: - check that the camera supports the ae sub-controls before setting them when handling AeEnable New in v6 --- src/libcamera/camera.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 69a7ee535..56c585199 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -1325,6 +1326,25 @@ int Camera::queueRequest(Request *request) } } + /* Pre-process AeEnable. */ + ControlList &controls = request->controls(); + const auto &aeEnable = controls.get(controls::AeEnable); + if (aeEnable) { + if (_d()->controlInfo_.count(controls::AnalogueGainMode.id()) && + !controls.contains(controls::AnalogueGainMode.id())) { + controls.set(controls::AnalogueGainMode, + *aeEnable ? controls::AnalogueGainModeAuto + : controls::AnalogueGainModeManual); + } + + if (_d()->controlInfo_.count(controls::ExposureTimeMode.id()) && + !controls.contains(controls::ExposureTimeMode.id())) { + controls.set(controls::ExposureTimeMode, + *aeEnable ? controls::ExposureTimeModeAuto + : controls::ExposureTimeModeManual); + } + } + d->pipe_->invokeMethod(&PipelineHandler::queueRequest, ConnectionTypeQueued, request);