[libcamera-devel] [RFC PATCH v4 09/21] android, controls: Add and plumb MaxLatency control

paul.elder at ideasonboard.com paul.elder at ideasonboard.com
Mon Jul 19 07:50:38 CEST 2021


Hi Jacopo,

On Sat, Jul 17, 2021 at 12:25:10PM +0200, Jacopo Mondi wrote:
> Hi Paul,
> 
> On Fri, Jul 16, 2021 at 07:56:19PM +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 |  7 +++++--
> >  src/libcamera/control_ids.yaml      | 10 ++++++++++
> >  2 files changed, 15 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
> > index 21e31cf2..c333b329 100644
> > --- a/src/android/camera_capabilities.cpp
> > +++ b/src/android/camera_capabilities.cpp
> > @@ -1127,8 +1127,11 @@ int CameraCapabilities::initializeStaticMetadata()
> >  	}
> >
> >  	/* Sync static metadata. */
> > -	int32_t maxLatency = ANDROID_SYNC_MAX_LATENCY_UNKNOWN;
> > -	staticMetadata_->addEntry(ANDROID_SYNC_MAX_LATENCY, maxLatency);
> > +	setMetadata<int32_t, int32_t>(
> > +		staticMetadata_.get(), ANDROID_SYNC_MAX_LATENCY,
> 
> As I've read this, I thought if
> 
>         staticMetadata->setMetadata()
> 
> wouldn't be a nicer API

setMetadata() reconciles (?) libcamera controls into android controls.
staticMetadata (CameraMetadata) is a wrapper around the android
metadata, so it shouldn't be dealing with libcamera controls.

> 
> > +		controlsInfo, &controls::draft::MaxLatency,
> > +		ControlRange::Def,
> 
> If ::Def serves to get which ControlValue to get from ControlInfo,
> can't we pass the ControlValue in directly ?

Then we have to do find() and if (it != end()), and that's what I want
to avoid :D Don't you remember how much copy&pasting there was of
exactly that?

> 
> Anyway, these comments are not on this patch
> 
> > +		ANDROID_SYNC_MAX_LATENCY_UNKNOWN);
> >
> >  	/* 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.
> > +
> 
> Do we have a sorting order for controls ? It seems we don't...

Apparently not.

> Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>


Thanks,

Paul

> 
> >    - TestPatternMode:
> >        type: int32_t
> >        draft: true
> > --
> > 2.27.0
> >


More information about the libcamera-devel mailing list