{"id":11493,"url":"https://patchwork.libcamera.org/api/patches/11493/?format=json","web_url":"https://patchwork.libcamera.org/patch/11493/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210304084703.11542-1-paul.elder@ideasonboard.com>","date":"2021-03-04T08:47:02","name":"[libcamera-devel,v1,1/2] utils: ipc: Support custom parameters to init()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"25fa6235dbc6ecd5d54bab0e72a419a4d709dac6","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11493/mbox/","series":[{"id":1758,"url":"https://patchwork.libcamera.org/api/series/1758/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1758","date":"2021-03-04T08:47:02","name":"[libcamera-devel,v1,1/2] utils: ipc: Support custom parameters to init()","version":1,"mbox":"https://patchwork.libcamera.org/series/1758/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11493/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11493/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5DF3DBD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  4 Mar 2021 08:47:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BCD1068A92;\n\tThu,  4 Mar 2021 09:47:13 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3BA37602EC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Mar 2021 09:47:12 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9798827A;\n\tThu,  4 Mar 2021 09:47:10 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"wHZgJ48u\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1614847631;\n\tbh=/gBG6fWestvg85aNRRGJnOSQFFGIdG2ehK8cMrw7BN8=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=wHZgJ48uXO0hYinfH/Wy3Gd3OITWmdBG+Pb2yPIVI0F5OCA3WOFVXc9Vm45d351Yf\n\tQDMnD0IP0oloOP0XzeogYATSdfcpyScEt/mdvkEHCyefqjxwXsQ+8tauw4/qN2vxS8\n\t84Cygz+9IGAoSXUp2R00nYlVboVWpZWGh+aRg0jc=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  4 Mar 2021 17:47:02 +0900","Message-Id":"<20210304084703.11542-1-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v1 1/2] utils: ipc: Support custom\n\tparameters to init()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add support to the mojom-based code generator for custom parameters to\ninit(). Remove the parameter type and count validation as well.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n .../libcamera_templates/module_ipa_proxy.cpp.tmpl | 15 ++++++++++++---\n .../libcamera_templates/proxy_functions.tmpl      | 13 -------------\n utils/ipc/generators/mojom_libcamera_generator.py | 10 +---------\n 3 files changed, 13 insertions(+), 25 deletions(-)","diff":"diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl\nindex 5e0d3976..8ba1a5cf 100644\n--- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl\n+++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl\n@@ -144,10 +144,19 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data)\n \n {{proxy_funcs.func_sig(proxy_name, method, \"Thread\")}}\n {\n-{%- if method.mojom_name == \"init\" %}\n-\t{{proxy_funcs.init_thread_body()}}\n-{%- elif method.mojom_name == \"stop\" %}\n+{%- if method.mojom_name == \"stop\" %}\n \t{{proxy_funcs.stop_thread_body()}}\n+{%- elif method.mojom_name == \"init\" %}\n+\t{{ method|method_return_value + \" _ret = \" if method|method_return_value != \"void\" -}}\n+\tipa_->{{method.mojom_name}}(\n+\t{%- for param in method|method_param_names -%}\n+\t\t{{param}}{{- \", \" if not loop.last}}\n+\t{%- endfor -%}\n+);\n+\n+\tproxy_.moveToThread(&thread_);\n+\n+\treturn {{ \"_ret\" if method|method_return_value != \"void\" }};\n {%- elif method.mojom_name == \"start\" %}\n \trunning_ = true;\n \tthread_.start();\ndiff --git a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl\nindex 40611feb..f2d86b67 100644\n--- a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl\n+++ b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl\n@@ -19,19 +19,6 @@\n ){{\" override\" if override}}\n {%- endmacro -%}\n \n-{#\n- # \\brief Generate function body for IPA init() function for thread\n- #}\n-{%- macro init_thread_body() -%}\n-\tint ret = ipa_->init(settings);\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tproxy_.moveToThread(&thread_);\n-\n-\treturn 0;\n-{%- endmacro -%}\n-\n {#\n  # \\brief Generate function body for IPA stop() function for thread\n  #}\ndiff --git a/utils/ipc/generators/mojom_libcamera_generator.py b/utils/ipc/generators/mojom_libcamera_generator.py\nindex 438e41c6..af123ef2 100644\n--- a/utils/ipc/generators/mojom_libcamera_generator.py\n+++ b/utils/ipc/generators/mojom_libcamera_generator.py\n@@ -345,15 +345,7 @@ def ValidateInterfaces(interfaces):\n     f_start = f_start[0]\n     f_stop  = f_stop[0]\n \n-    # Validate parameters to init()\n-    ValidateSingleLength(f_init.parameters, 'input parameter to init()')\n-    ValidateSingleLength(f_init.response_parameters, 'output parameter from init()')\n-    if f_init.parameters[0].kind.mojom_name != 'IPASettings':\n-        raise Exception('init() must have single IPASettings input parameter')\n-    if f_init.response_parameters[0].kind.spec != 'i32':\n-        raise Exception('init() must have single int32 output parameter')\n-\n-    # No need to validate start() as it is customizable\n+    # No need to validate init() and start() as they are customizable\n \n     # Validate parameters to stop()\n     ValidateZeroLength(f_stop.parameters, 'input parameter to stop()')\n","prefixes":["libcamera-devel","v1","1/2"]}