[libcamera-devel] [RFC PATCH v3 04/16] android, controls: Add and plumb MaxLatency control

Jacopo Mondi jacopo at jmondi.org
Mon Jul 5 17:48:25 CEST 2021


Hi Paul,

On Fri, Jul 02, 2021 at 07:37:48PM +0900, Paul Elder wrote:
> Add a MaxLatency control, and plumb it into the HAL accordingly.
>
> Bug: https://bugs.libcamera.org/show_bug.cgi?id=50
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
>
> ---
> Changes in v3:
> - use v3 setMetadata
> - add comment to explain 4
> - remove todo
>
> Changes in v2:
> - use new setMetadata
> - rebase on camera capabilities refactor
> ---
>  src/android/camera_capabilities.cpp | 13 +++++++++++--
>  src/libcamera/control_ids.yaml      | 10 ++++++++++
>  2 files changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
> index 1d4c44ce..530167de 100644
> --- a/src/android/camera_capabilities.cpp
> +++ b/src/android/camera_capabilities.cpp
> @@ -870,8 +870,17 @@ int CameraCapabilities::initializeStaticMetadata()
>  	}
>
>  	/* Sync static metadata. */
> -	int32_t maxLatency = ANDROID_SYNC_MAX_LATENCY_UNKNOWN;
> -	staticMetadata_->addEntry(ANDROID_SYNC_MAX_LATENCY, maxLatency);
> +	int32_t maxLatency = setMetadata<int32_t, int32_t>(
> +		staticMetadata_.get(), ANDROID_SYNC_MAX_LATENCY,
> +		controlsInfo, &controls::draft::MaxLatency,
> +		ControlRange::Def,
> +		(int32_t)ANDROID_SYNC_MAX_LATENCY_UNKNOWN);

That's tough to read, but probably better than repeating the checks in
every metadata.

> +	LOG(HAL, Info) << "Max sync latency is " << maxLatency;
> +	/* CTS allows a sync latency of up to 4 for burst capture capability */
> +	if (maxLatency < 0 || 4 < maxLatency)
> +		capabilities.erase(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE);

According to my previous comments, I would centralize these checks in
one function and do the other way around: add instead of erasing.

> +	if (maxLatency != 0)
> +		hwLevels.erase(ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_FULL);

Same

>
>  	/* Flash static metadata. */
>  	char flashAvailable = ANDROID_FLASH_INFO_AVAILABLE_FALSE;
> diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml
> index d92f29f5..9d4638ae 100644
> --- a/src/libcamera/control_ids.yaml
> +++ b/src/libcamera/control_ids.yaml
> @@ -622,6 +622,16 @@ controls:
>          detection, additional format conversions etc) count as an additional
>          pipeline stage.
>
> +  - MaxLatency:
> +      type: int32_t
> +      draft: true
> +      description: |
> +        The maximum number of frames that can occur after a request (different
> +        than the previous) has been submitted, and before the result's state
> +        becomes synchronized. A value of -1 indicates unknown latency, and 0
> +        indicates per-frame control. Currently identical to
> +        ANDROID_SYNC_MAX_LATENCY.
> +
>    - TestPatternMode:
>        type: int32_t
>        draft: true
> --
> 2.27.0
>


More information about the libcamera-devel mailing list