libcamera: controls: Use ControlIdMap in deserialization

Introduce a new field in the controls serialization protocol to
allow discerning which ControlIdMap a ControlInfoMap refers to.

The newly introduced IdMapType enumeration describes the possible
info maps:
- Either the globally available controls::controls and
  properties::properties maps, which are valid across IPC boundaries
- A ControlIdMap created locally by the V4L2 device, which is not valid
  across the IPC boundaries

At de-serialization time the idMapType field is inspected and
- If the idmap is a globally defined one, there's no need to create
  new ControlId instances when populating the de-serialized
  ControlInfoMap. Use the globally available map to retrieve the
  ControlId reference and use it.
- If the idmap is a map only available locally, create a new ControlId
  as it used to happen before this patch.

As a direct consequence, this change allows us to perform lookup by
ControlId reference on de-serialized ControlIdMap that refers to the
libcamera defined controls::controls and properties::properties.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Jacopo Mondi 2021-07-28 16:03:54 +02:00
parent 0d7db1b511
commit 62c82ab93f
3 changed files with 91 additions and 13 deletions

View file

@ -15,13 +15,20 @@ extern "C" {
#define IPA_CONTROLS_FORMAT_VERSION 1
enum ipa_controls_id_map_type {
IPA_CONTROL_ID_MAP_CONTROLS,
IPA_CONTROL_ID_MAP_PROPERTIES,
IPA_CONTROL_ID_MAP_V4L2,
};
struct ipa_controls_header {
uint32_t version;
uint32_t handle;
uint32_t entries;
uint32_t size;
uint32_t data_offset;
uint32_t reserved[3];
enum ipa_controls_id_map_type id_map_type;
uint32_t reserved[2];
};
struct ipa_control_value_entry {