[libcamera-devel] [PATCH 2/2] utils: ipc: Support extending IPA init() parameters
Naushir Patuck
naush at raspberrypi.com
Tue Mar 2 16:16:43 CET 2021
Hi Laurent,
Thank you for your patch.
On Tue, 2 Mar 2021 at 15:05, Laurent Pinchart <
laurent.pinchart at ideasonboard.com> wrote:
> It can be useful for pipeline handlers to pass additional parameters to
> the IPA init() method. Allow doing so.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> .../libcamera_templates/module_ipa_proxy.cpp.tmpl | 2 +-
> .../generators/libcamera_templates/proxy_functions.tmpl | 8 ++++++--
> utils/ipc/generators/mojom_libcamera_generator.py | 3 ---
> 3 files changed, 7 insertions(+), 6 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 d451fab35e83..f2f9128b056c 100644
> --- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
> +++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
> @@ -142,7 +142,7 @@ void {{proxy_name}}::recvMessage(const IPCMessage
> &data)
> {{proxy_funcs.func_sig(proxy_name, method, "Thread")}}
> {
> {%- if method.mojom_name == "init" %}
> - {{proxy_funcs.init_thread_body()}}
> + {{proxy_funcs.init_thread_body(method)}}
> {%- elif method.mojom_name == "stop" %}
> {{proxy_funcs.stop_thread_body()}}
> {%- elif method.mojom_name == "start" %}
> diff --git a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl
> b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl
> index 40611feb179b..222a2a63764d 100644
> --- a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl
> +++ b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl
> @@ -22,8 +22,12 @@
> {#
> # \brief Generate function body for IPA init() function for thread
> #}
> -{%- macro init_thread_body() -%}
> - int ret = ipa_->init(settings);
> +{%- macro init_thread_body(method) -%}
> + int ret = ipa_->init(
> + {%- for param in method|method_param_names -%}
> + {{param}}{{- ", " if not loop.last}}
> + {%- endfor -%}
> +);
> if (ret)
> return ret;
>
> diff --git a/utils/ipc/generators/mojom_libcamera_generator.py
> b/utils/ipc/generators/mojom_libcamera_generator.py
> index 438e41c649ad..2bfc4af23231 100644
> --- a/utils/ipc/generators/mojom_libcamera_generator.py
> +++ b/utils/ipc/generators/mojom_libcamera_generator.py
> @@ -346,10 +346,7 @@ def ValidateInterfaces(interfaces):
> f_stop = f_stop[0]
>
> # Validate parameters to init()
> - ValidateSingleLength(f_init.parameters, 'input parameter to init()')
> ValidateSingleLength(f_init.response_parameters, 'output parameter
> from init()')
> - if f_init.parameters[0].kind.mojom_name != 'IPASettings':
> - raise Exception('init() must have single IPASettings input
> parameter')
> if f_init.response_parameters[0].kind.spec != 'i32':
> raise Exception('init() must have single int32 output parameter')
>
As discussed, it would be really useful if the restriction on the return
value from init() could be relaxed as well.
Hopefully this will not be too complicated to achieve :-)
Regards,
Naush
>
> --
> Regards,
>
> Laurent Pinchart
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20210302/e010fa4c/attachment.htm>
More information about the libcamera-devel
mailing list