From patchwork Fri Jan 10 23:57:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 22518 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 5229BC32DA for ; Fri, 10 Jan 2025 23:58:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F1E1868521; Sat, 11 Jan 2025 00:58:19 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="mhVxmB9w"; 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 541E5684E7 for ; Sat, 11 Jan 2025 00:58:10 +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 C97909CE; Sat, 11 Jan 2025 00:57:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1736553435; bh=FGpXf6cgvMeBrwd93CUoA1EEUsP1tZfkHxVKNHg0Eok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mhVxmB9wA9Ef++93q23rY4Z9Psy6eJmYTsZatZMTpe5buNDMe6JyVy1TPbxbRSwgO XRQfyXF9FV1Eji0ZGAtLIPGmU978FPQ3yMeCOiNJ0AmSA6jqxJqVRAwa8N+m+Q8sJV nBTKU3smVWNChiozX1FRdqCLAj/HpyuEwI7GpWeY= From: Paul Elder To: libcamera-devel@lists.libcamera.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, stefan.klug@ideasonboard.com Subject: [PATCH v7 09/12] controls: Redefine AeEnable Date: Fri, 10 Jan 2025 17:57:34 -0600 Message-Id: <20250110235737.1524733-10-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" In the redesign of the AE-related controls, the AeEnable control was intended to be removed in favor of more specific sub-controls for analogue gain and exposure time. However this will cause problems if aperture sub-controls are introduced, and an application from a pre-aperture era uses a camera that supports aperture. If there is no AeEnable control, then a pre-aperture era application might set analogue gain and exposure time to manual, while aperture silently stays auto since that's the default mode. Thus aperture would be uncontrollable by the application. With an AeEnable control, then a pre-aperture era application can set AeEnable to manual, and under the hood all three of analogue gain and exposure time and aperture will be set to manual. The application won't be able to set the manual aperture, however. Although the above scenario is expected to be rare, the scenario with an AeEnable control seems less detrimental. With an AeEnable control at least the aperture would be static at a reasonably usable value, whereas without an AeEnable the aperture would be more-or-less uncontrolable and could go to extreme values as the AEGC algorithm tries to compensate for the manual analogue gain and exposure time values. Thus we redefine the AeEnable control, available only as a control and not in metadata. It will be preprocessed by the Camera class so that the relevant sub-controls are set. No pipline handler nor IPA shall act on the AeEnable control. The IPA still has to report the control as available, however. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Stefan Klug --- Changes in v7: - fix wording New in v6 --- Documentation/design/ae.rst | 23 +++++++++++++++++------ src/libcamera/control_ids_core.yaml | 12 +++++++++--- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Documentation/design/ae.rst b/Documentation/design/ae.rst index 9d5bb5078..df9b1fa76 100644 --- a/Documentation/design/ae.rst +++ b/Documentation/design/ae.rst @@ -185,6 +185,10 @@ A diagram of our solution: 0: Auto 1: Manual + AeEnable + - True -> ExposureTimeMode:Auto + AnalogueGainMode:Auto + - False -> ExposureTimeMode:Manual + AnalogueGainMode:Manual + The diagram is divided in four sections horizontally: @@ -225,10 +229,14 @@ This simulates an auto -> locked -> manual or auto -> manual state transition, and makes it impossible to do the nonsensical manual -> locked state transition. -We specifically do not have a "master AE control" like the old AeEnable. This -is because we have the individual mode controls, and if we had a master AE -control it would be a "control that sets other controls", which could easily -get out of control. +AeEnable still exists to allow applications to set the mode of all the +sub-controls at once. Besides being for convenience, this will also be useful +when we eventually implement an aperture control. This is because applications +that will be made before aperture will have been available would still be able +to set aperture mode to auto or manual, as opposed to having the aperture stuck +at auto while the application really wanted manual. Although the aperture would +still be stuck at an uncontrollable value, at least it would be at a static +usable value as opposed to varying via the AEGC algorithm. With this solution, the earlier example would become: @@ -277,9 +285,12 @@ and gain: - AeState +- AeEnable + Auto-exposure and auto-gain can be enabled and disabled separately using the -ExposureTimeMode and AnalogueGainMode controls respectively. There is no -overarching AeEnable control. +ExposureTimeMode and AnalogueGainMode controls respectively. The AeEnable +control can also be used, as it sets both of the modes simultaneously. The +AeEnable control is not returned in metadata. When the respective mode is set to auto, the respective value that is computed by the AEGC algorithm is applied to the image sensor. Any value that is diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml index d88c1852e..aa7448645 100644 --- a/src/libcamera/control_ids_core.yaml +++ b/src/libcamera/control_ids_core.yaml @@ -10,11 +10,17 @@ vendor: libcamera controls: - AeEnable: type: bool - direction: inout + direction: in description: | - Enable or disable the AE. + Enable or disable the AEGC algorithm. When this control is set to true, + both ExposureTimeMode and AnalogueGainMode are set to auto, and if this + control is set to false then both are set to manual. + + If ExposureTimeMode or AnalogueGainMode are also set in the same + request as AeEnable, then the modes supplied by ExposureTimeMode or + AnalogueGainMode will take precedence. - \sa ExposureTime AnalogueGain + \sa ExposureTimeMode AnalogueGainMode - AeState: type: int32_t