summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2021-09-07 11:13:09 +0200
committerJacopo Mondi <jacopo@jmondi.org>2021-09-27 14:39:15 +0200
commit11e9d192885d94cbe1e5d850315b8f2b4032d804 (patch)
tree102bc5be5c91b6461d193eeae16b2183052cb101 /utils
parent23c2b8a9cacad72c405fbeea77d6b3f8cb865c98 (diff)
libcamera: control_serializer: Separate the handles space
Two independent instances of the ControlSerializer class are in use at the IPC boundaries, one in the Proxy class that serializes data from the pipeline handler to the IPA, and one in the ProxyWorker which serializes data in the opposite direction. Each instance operates autonomously, without any centralized point of control, and each one assigns a numerical handle to each ControlInfoMap it serializes. This creates a risk of potential collision on the handle values, as both instances will use the same numerical space and are not aware of what handles has been already used by the instance "on the other side". To fix that, partition the handles numerical space by initializing the control serializer with a seed according to the role of the component that creates the serializer and increment the handle number by 2, to avoid any collision risk. While this is temporary and rather hacky solution, it solves an issue with isolated IPA modules without too much complexity added. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl3
-rw-r--r--utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl4
2 files changed, 5 insertions, 2 deletions
diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
index aab1fffb..d856339a 100644
--- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
+++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
@@ -46,7 +46,8 @@ namespace {{ns}} {
{%- endif %}
{{proxy_name}}::{{proxy_name}}(IPAModule *ipam, bool isolate)
- : IPAProxy(ipam), isolate_(isolate), seq_(0)
+ : IPAProxy(ipam), isolate_(isolate),
+ controlSerializer_(ControlSerializer::Role::Proxy), seq_(0)
{
LOG(IPAProxy, Debug)
<< "initializing {{module_name}} proxy: loading IPA from "
diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
index 890246a8..764e7a3a 100644
--- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
+++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
@@ -53,7 +53,9 @@ class {{proxy_worker_name}}
{
public:
{{proxy_worker_name}}()
- : ipa_(nullptr), exit_(false) {}
+ : ipa_(nullptr),
+ controlSerializer_(ControlSerializer::Role::Worker),
+ exit_(false) {}
~{{proxy_worker_name}}() {}