[v2,1/3] libcamera: request: Create control list with Camera info map
diff mbox series

Message ID 20251126-cam-control-override-v2-1-305024a1f190@ideasonboard.com
State Superseded
Headers show
Series
  • libcamera: ipc: ControlLists without valid idmap break IPC
Related show

Commit Message

Jacopo Mondi Nov. 26, 2025, 9:38 a.m. UTC
The control lists associated with a Request is created with the global
libcamera::controls::controls id map.

This is fine as the idmap/info map used to contruct a ControlList are not
used for any control validation purposes by the libcamera code.

However creating a ControlList with the camera ControlInfoMap has two
advantages:

1) The idmap can be extracted from the info map, but not the other way
   around
2) The control list is constructed with a valid map of info to the
   controls it can actually supports, instead of the global map of
   libcamera controls

Initialize the ControlList part of a Request with the Camera control
info map, as the association between a Request and a Camera is permanent
and valid for the whole lifetime of a Request.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/request.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul Elder Dec. 1, 2025, 10:23 a.m. UTC | #1
Quoting Jacopo Mondi (2025-11-26 18:38:51)
> The control lists associated with a Request is created with the global
> libcamera::controls::controls id map.
> 
> This is fine as the idmap/info map used to contruct a ControlList are not
> used for any control validation purposes by the libcamera code.
> 
> However creating a ControlList with the camera ControlInfoMap has two
> advantages:
> 
> 1) The idmap can be extracted from the info map, but not the other way
>    around
> 2) The control list is constructed with a valid map of info to the
>    controls it can actually supports, instead of the global map of
>    libcamera controls
> 
> Initialize the ControlList part of a Request with the Camera control
> info map, as the association between a Request and a Camera is permanent
> and valid for the whole lifetime of a Request.
> 
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

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

> ---
>  src/libcamera/request.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
> index 60565f5984971c7ab34e119a15b8141799f71071..2544a059f6984d930ec909c74e0b621c9fe82726 100644
> --- a/src/libcamera/request.cpp
> +++ b/src/libcamera/request.cpp
> @@ -356,7 +356,7 @@ Request::Request(Camera *camera, uint64_t cookie)
>         : Extensible(std::make_unique<Private>(camera)),
>           cookie_(cookie), status_(RequestPending)
>  {
> -       controls_ = new ControlList(controls::controls,
> +       controls_ = new ControlList(camera->controls(),
>                                     camera->_d()->validator());
>  
>         /**
> 
> -- 
> 2.51.1
>

Patch
diff mbox series

diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index 60565f5984971c7ab34e119a15b8141799f71071..2544a059f6984d930ec909c74e0b621c9fe82726 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -356,7 +356,7 @@  Request::Request(Camera *camera, uint64_t cookie)
 	: Extensible(std::make_unique<Private>(camera)),
 	  cookie_(cookie), status_(RequestPending)
 {
-	controls_ = new ControlList(controls::controls,
+	controls_ = new ControlList(camera->controls(),
 				    camera->_d()->validator());
 
 	/**