[libcamera-devel] [PATCH 3/6] libcamera: control_serializer: Keep handles in sync

paul.elder at ideasonboard.com paul.elder at ideasonboard.com
Fri Sep 3 13:04:40 CEST 2021


Hi Jacopo,

On Wed, Sep 01, 2021 at 04:37:57PM +0200, Jacopo Mondi wrote:
> When running the IPA in isolated mode, each side of the IPC boundary
> has an instance of the ControlSerializer class.
> 
> Each serializer instance tags with a numerical id (handle) each
> ControlInfoMap instance it serializes, to be capable of associating
> ControlList with it at serialization and deserialization time, and
> increments the numerical counter for each newly serialized control info
> map.
> 
> Having two instances of the ControlSerializer class running in two
> different process spaces, each instance increments its own counter,
> preventing from maintaining a globally shared state where each
> ControlInfoMap instance is reference by a unique identifier.
> 
> Fix this by advancing the serial_ counter at ControlInfoMap
> de-serialization time, so that each newly serialized map will have a
> globally unique identifier.
> 
> Fixes: 2c5f0ad23aa4 ("libcamera: Add controls serializer")
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>

Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>

> ---
>  src/libcamera/control_serializer.cpp | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp
> index 27360526f9eb..08cfecca3078 100644
> --- a/src/libcamera/control_serializer.cpp
> +++ b/src/libcamera/control_serializer.cpp
> @@ -380,6 +380,9 @@ ControlInfoMap ControlSerializer::deserialize<ControlInfoMap>(ByteStreamBuffer &
>  		return {};
>  	}
>  
> +	/* Keep the info map handles in sync between the two sides of IPC. */
> +	serial_ = std::max(serial_, hdr->handle);
> +
>  	/*
>  	 * Use the ControlIdMap corresponding to the id map type. If the type
>  	 * references a globally defined id map (such as controls::controls
> -- 
> 2.32.0
> 


More information about the libcamera-devel mailing list