[libcamera-devel,RFC,07/14] android: Plumb AeLock control
diff mbox series

Message ID 20210618103351.1642060-8-paul.elder@ideasonboard.com
State Superseded
Delegated to: Paul Elder
Headers show
Series
  • Preliminary FULL plumbing
Related show

Commit Message

Paul Elder June 18, 2021, 10:33 a.m. UTC
Plumb the AeLock control into the HAL for
CONTROL_AE_LOCK_AVAILABLE_MODES for static metadata.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=43
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>

---
TODO: plumb result metadata
---
 src/android/camera_device.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Laurent Pinchart June 28, 2021, 1:32 a.m. UTC | #1
Hi Paul,

Thank you for the patch.

On Fri, Jun 18, 2021 at 07:33:44PM +0900, Paul Elder wrote:
> Plumb the AeLock control into the HAL for
> CONTROL_AE_LOCK_AVAILABLE_MODES for static metadata.
> 
> Bug: https://bugs.libcamera.org/show_bug.cgi?id=43
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> 
> ---
> TODO: plumb result metadata

Please record this in the bug once this patch gets merged (or address
the issue in this series :-))

> ---
>  src/android/camera_device.cpp | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index 3446cdb6..3add5bc6 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -1010,6 +1010,14 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  				  sceneModesOverride);
>  
>  	uint8_t aeLockAvailable = ANDROID_CONTROL_AE_LOCK_AVAILABLE_FALSE;
> +	const auto &aeLockInfo = controlsInfo.find(&controls::AeLock);
> +	if (aeLockInfo != controlsInfo.end()) {
> +		aeLockAvailable = aeLockInfo->second.max().get<bool>();
> +	}

It makes little sense for a camera to expose AeLock with only false as a
supported value. I'd write this

	if (controlsInfo.find(&controls::AeLock) != controlsInfo.end())
		aeLockAvailable = ANDROID_CONTROL_AE_LOCK_AVAILABLE_TRUE;

The AeLock documentation should state that both true and false need to
be supported when the control is reported by the camera.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +	if (!aeLockAvailable) {
> +		capabilities[ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE] = false;
> +		capabilities[ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR] = false;
> +	}
>  	staticMetadata_->addEntry(ANDROID_CONTROL_AE_LOCK_AVAILABLE,
>  				  aeLockAvailable);
>

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 3446cdb6..3add5bc6 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1010,6 +1010,14 @@  const camera_metadata_t *CameraDevice::getStaticMetadata()
 				  sceneModesOverride);
 
 	uint8_t aeLockAvailable = ANDROID_CONTROL_AE_LOCK_AVAILABLE_FALSE;
+	const auto &aeLockInfo = controlsInfo.find(&controls::AeLock);
+	if (aeLockInfo != controlsInfo.end()) {
+		aeLockAvailable = aeLockInfo->second.max().get<bool>();
+	}
+	if (!aeLockAvailable) {
+		capabilities[ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE] = false;
+		capabilities[ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR] = false;
+	}
 	staticMetadata_->addEntry(ANDROID_CONTROL_AE_LOCK_AVAILABLE,
 				  aeLockAvailable);