From patchwork Fri Sep 24 17:25:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13932 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A4A0FBDC71 for ; Fri, 24 Sep 2021 17:24:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 925C569197; Fri, 24 Sep 2021 19:24:46 +0200 (CEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A47C26918C for ; Fri, 24 Sep 2021 19:24:43 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 8B2631BF203; Fri, 24 Sep 2021 17:24:42 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Sep 2021 19:25:22 +0200 Message-Id: <20210924172525.160482-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210924172525.160482-1-jacopo@jmondi.org> References: <20210924172525.160482-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/5] ipa: proxy_worker: Reset ControlSerializer on worker X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When running the IPA in isolated mode, each side of the IPC boundary has an instance of the ControlSerializer class which is used to serializer/deserialize controls before transmitting them on the wire. The IPAProxyWorker, which creates and manages the process the IPA runs in, does not reset its ControlSerializer upon an IPA::configure() call, while the IPAProxy does, effectively creating a misalignment between the two sides of the fence. This obviously creates issues as one side of the IPC runs with a populated and possibly stale cache of ControlInfoMap references, while the other side gets reset every time a new configuration is applied to the Camera. Fix that by resetting the IPAProxyWorker ControlSerializer on an IPA configure() call. This change fixes an issue which is easily triggered by running two consecutive capture sessions with the IPA running in isolated mode: ERROR Serializer control_serializer.cpp:520 Can't deserialize ControlList: unknown ControlInfoMap Fixes: 7832e19a599e ("utils: ipc: add templates for code generation for IPC mechanism") Signed-off-by: Jacopo Mondi Reviewed-by: Umang Jain Reviewed-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- .../libcamera_templates/module_ipa_proxy_worker.cpp.tmpl | 3 +++ 1 file changed, 3 insertions(+) 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 c306d8dfcaf2..890246a8849b 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 @@ -79,6 +79,9 @@ public: {% for method in interface_main.methods %} case {{cmd_enum_name}}::{{method.mojom_name|cap}}: { +{%- if method.mojom_name == "configure" %} + controlSerializer_.reset(); +{%- endif %} {{proxy_funcs.deserialize_call(method|method_param_inputs, '_ipcMessage.data()', '_ipcMessage.fds()', false, true)|indent(16, true)}} {% for param in method|method_param_outputs %} {{param|name}} {{param.mojom_name}};