{"id":11505,"url":"https://patchwork.libcamera.org/api/1.1/patches/11505/?format=json","web_url":"https://patchwork.libcamera.org/patch/11505/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20210308074828.13228-2-paul.elder@ideasonboard.com>","date":"2021-03-08T07:48:26","name":"[libcamera-devel,v2,1/3] utils: ipc: Support custom parameters to init()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"cc51c623dd33f16755a1b621b8aa500c279bc174","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11505/mbox/","series":[{"id":1765,"url":"https://patchwork.libcamera.org/api/1.1/series/1765/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1765","date":"2021-03-08T07:48:25","name":"Expand mojom-based code generator","version":2,"mbox":"https://patchwork.libcamera.org/series/1765/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11505/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11505/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 4D27EBD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Mar 2021 07:48:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0ADA968A9C;\n\tMon,  8 Mar 2021 08:48:42 +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 3625460520\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Mar 2021 08:48:40 +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 21175E7B;\n\tMon,  8 Mar 2021 08:48:37 +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=\"e+Aj949L\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1615189719;\n\tbh=YvnsxGT1vhLUwJcK8YYkLvwKig+nsIT0JR72Iqt7qcA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=e+Aj949LTQPoEwgP7wytysMuQl82TjDO72EMhpF2n5kt8oX3kN8EkaCUXXe+408mh\n\tedRjB1iUmxyiAS3okRVMJtm2+tc+uTT4WeV4sayTejPCqaDlivb9D6T1C/4ImU0PzT\n\t19IrhVTKWQ8BHTHz7pI6tntLnrBY4lMcoQvZJiWU=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  8 Mar 2021 16:48:26 +0900","Message-Id":"<20210308074828.13228-2-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20210308074828.13228-1-paul.elder@ideasonboard.com>","References":"<20210308074828.13228-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 1/3] 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>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\nNo change in v2\n\nChanges in v1.1\n- remove unused variables in the python file\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 | 12 +-----------\n 3 files changed, 13 insertions(+), 27 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 d451fab3..3eb3dced 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@@ -141,10 +141,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..fa0c21a2 100644\n--- a/utils/ipc/generators/mojom_libcamera_generator.py\n+++ b/utils/ipc/generators/mojom_libcamera_generator.py\n@@ -341,19 +341,9 @@ def ValidateInterfaces(interfaces):\n     ValidateSingleLength(f_start, 'start()', False)\n     ValidateSingleLength(f_stop, 'stop()', False)\n \n-    f_init  = f_init[0]\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","v2","1/3"]}