From patchwork Mon Jan 13 21:59:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 22557 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 2551DC3303 for ; Mon, 13 Jan 2025 22:02:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DA1446855A; Mon, 13 Jan 2025 23:02:25 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="VOm+9YJO"; 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 9849668549 for ; Mon, 13 Jan 2025 23:02:22 +0100 (CET) Received: from pyrite.hamster-moth.ts.net (unknown [173.16.167.215]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 333494382; Mon, 13 Jan 2025 23:01:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1736805685; bh=NU4w64PEQnfOokV3ZKDNjRXuRgFxpXYHQz/jOUntsyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VOm+9YJOalfgjHQDEls1n+34jihv2291TI8obK3FtddnuFOG5ovZ0tC6rkjcSnBqv GFW56hBBI09Aww2KENzLN3FYUhFwO66h/4kVBWqh8LEKIe7c9ogDVi5B4xpEhDz/m4 sMiQpBcCe9vLWlMli4GkYIwYRBeZQeAU8A0Bs9Q0= From: Paul Elder To: libcamera-devel@lists.libcamera.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, stefan.klug@ideasonboard.com Subject: [PATCH v8 10/12] libcamera: camera: Pre-process AeEnable control Date: Mon, 13 Jan 2025 15:59:44 -0600 Message-Id: <20250113215946.1033762-11-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20250113215946.1033762-1-paul.elder@ideasonboard.com> References: <20250113215946.1033762-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 --- No change in v8 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);