libcamera: control_serializer: Serialize info::def()
The ControlInfo class was originally designed to only transport the control's minimum and maximum values which represent the control's valid limits. Later the default value of the control has been added to the ControlInfo class, but the control serializer implementation has not been updated accordingly. This causes issues in IPA modules making use of ControlInfo::def() as, when running in isolation, they would receive 0. Fix that by serializing and deserializing the additional ControlValue and update the protocol description accordingly. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
b516ffb3bd
commit
23c2b8a9ca
2 changed files with 12 additions and 8 deletions
|
@ -105,7 +105,7 @@ size_t ControlSerializer::binarySize(const ControlValue &value)
|
||||||
|
|
||||||
size_t ControlSerializer::binarySize(const ControlInfo &info)
|
size_t ControlSerializer::binarySize(const ControlInfo &info)
|
||||||
{
|
{
|
||||||
return binarySize(info.min()) + binarySize(info.max());
|
return binarySize(info.min()) + binarySize(info.max()) + binarySize(info.def());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,6 +158,7 @@ void ControlSerializer::store(const ControlInfo &info, ByteStreamBuffer &buffer)
|
||||||
{
|
{
|
||||||
store(info.min(), buffer);
|
store(info.min(), buffer);
|
||||||
store(info.max(), buffer);
|
store(info.max(), buffer);
|
||||||
|
store(info.def(), buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -346,8 +347,9 @@ ControlInfo ControlSerializer::loadControlInfo(ControlType type,
|
||||||
|
|
||||||
ControlValue min = loadControlValue(type, b);
|
ControlValue min = loadControlValue(type, b);
|
||||||
ControlValue max = loadControlValue(type, b);
|
ControlValue max = loadControlValue(type, b);
|
||||||
|
ControlValue def = loadControlValue(type, b);
|
||||||
|
|
||||||
return ControlInfo(min, max);
|
return ControlInfo(min, max, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -108,17 +108,19 @@
|
||||||
* +-------------------------+ .
|
* +-------------------------+ .
|
||||||
* / | ... | | entry[n].offset
|
* / | ... | | entry[n].offset
|
||||||
* | +-------------------------+ <-----´
|
* | +-------------------------+ <-----´
|
||||||
* Data | | minimum value (#n) | \
|
* | | minimum value (#n) | \
|
||||||
* section | +-------------------------+ | Entry #n
|
* Data | +-------------------------+ |
|
||||||
* | | maximum value (#n) | /
|
* section | | maximum value (#n) | | Entry #n
|
||||||
|
* | +-------------------------+ |
|
||||||
|
* | | default value (#n) | /
|
||||||
* | +-------------------------+
|
* | +-------------------------+
|
||||||
* \ | ... |
|
* \ | ... |
|
||||||
* +-------------------------+
|
* +-------------------------+
|
||||||
* ~~~~
|
* ~~~~
|
||||||
*
|
*
|
||||||
* The minimum and maximum value are stored in the platform's native data
|
* The minimum, maximum and default values are stored in the platform's native
|
||||||
* format. The ipa_control_info_entry::offset field stores the offset from the
|
* data format. The ipa_control_info_entry::offset field stores the offset from
|
||||||
* beginning of the data section to the info data.
|
* the beginning of the data section to the info data.
|
||||||
*
|
*
|
||||||
* Info data in the data section shall be stored in the same order as the
|
* Info data in the data section shall be stored in the same order as the
|
||||||
* entries array, shall be aligned to a multiple of 8 bytes, and shall be
|
* entries array, shall be aligned to a multiple of 8 bytes, and shall be
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue