[v3,6/6] utils: ipc: Only dispatch messages for proxy when stopping thread
diff mbox series

Message ID 20250225150614.20195-7-mzamazal@redhat.com
State Accepted
Headers show
Series
  • Fix occasional software ISP assertion error on stop
Related show

Commit Message

Milan Zamazal Feb. 25, 2025, 3:06 p.m. UTC
When stopping the proxy thread, all messages of InvokeMessage type
posted to the pipeline handler thread are dispatched, to ensure that all
signals emitted from the proxy thread and queued for delivery to the
proxy are delivered synchronously. This unnecessarily delivers queued
signals for other objects in the pipeline handler thread, possibly
delaying processing of higher priority events.

Improve the implementation by limiting synchronous delivery to messages
posted for the proxy.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
---
 .../ipc/generators/libcamera_templates/proxy_functions.tmpl     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart Feb. 26, 2025, 12:40 a.m. UTC | #1
Hi Milan,

Thank you for the patch.

On Tue, Feb 25, 2025 at 04:06:12PM +0100, Milan Zamazal wrote:
> When stopping the proxy thread, all messages of InvokeMessage type
> posted to the pipeline handler thread are dispatched, to ensure that all
> signals emitted from the proxy thread and queued for delivery to the
> proxy are delivered synchronously. This unnecessarily delivers queued
> signals for other objects in the pipeline handler thread, possibly
> delaying processing of higher priority events.
> 
> Improve the implementation by limiting synchronous delivery to messages
> posted for the proxy.
> 
> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  .../ipc/generators/libcamera_templates/proxy_functions.tmpl     | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl
> index b5797b14..25476990 100644
> --- a/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl
> +++ b/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl
> @@ -34,7 +34,7 @@
>  	thread_.exit();
>  	thread_.wait();
>  
> -	Thread::current()->dispatchMessages(Message::Type::InvokeMessage);
> +	Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);
>  
>  	state_ = ProxyStopped;
>  {%- endmacro -%}
Paul Elder Feb. 26, 2025, 7:51 a.m. UTC | #2
On Tue, Feb 25, 2025 at 04:06:12PM +0100, Milan Zamazal wrote:
> When stopping the proxy thread, all messages of InvokeMessage type
> posted to the pipeline handler thread are dispatched, to ensure that all
> signals emitted from the proxy thread and queued for delivery to the
> proxy are delivered synchronously. This unnecessarily delivers queued
> signals for other objects in the pipeline handler thread, possibly
> delaying processing of higher priority events.
> 
> Improve the implementation by limiting synchronous delivery to messages
> posted for the proxy.
> 
> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  .../ipc/generators/libcamera_templates/proxy_functions.tmpl     | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl
> index b5797b14..25476990 100644
> --- a/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl
> +++ b/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl
> @@ -34,7 +34,7 @@
>  	thread_.exit();
>  	thread_.wait();
>  
> -	Thread::current()->dispatchMessages(Message::Type::InvokeMessage);
> +	Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);
>  
>  	state_ = ProxyStopped;
>  {%- endmacro -%}
> -- 
> 2.48.1
>
Kieran Bingham March 1, 2025, 10:58 p.m. UTC | #3
Quoting Milan Zamazal (2025-02-25 15:06:12)
> When stopping the proxy thread, all messages of InvokeMessage type
> posted to the pipeline handler thread are dispatched, to ensure that all
> signals emitted from the proxy thread and queued for delivery to the
> proxy are delivered synchronously. This unnecessarily delivers queued
> signals for other objects in the pipeline handler thread, possibly
> delaying processing of higher priority events.
> 
> Improve the implementation by limiting synchronous delivery to messages
> posted for the proxy.
> 
> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  .../ipc/generators/libcamera_templates/proxy_functions.tmpl     | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl
> index b5797b14..25476990 100644
> --- a/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl
> +++ b/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl
> @@ -34,7 +34,7 @@
>         thread_.exit();
>         thread_.wait();
>  
> -       Thread::current()->dispatchMessages(Message::Type::InvokeMessage);
> +       Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);
>  
>         state_ = ProxyStopped;
>  {%- endmacro -%}
> -- 
> 2.48.1
>

Patch
diff mbox series

diff --git a/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl
index b5797b14..25476990 100644
--- a/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl
+++ b/utils/codegen/ipc/generators/libcamera_templates/proxy_functions.tmpl
@@ -34,7 +34,7 @@ 
 	thread_.exit();
 	thread_.wait();
 
-	Thread::current()->dispatchMessages(Message::Type::InvokeMessage);
+	Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);
 
 	state_ = ProxyStopped;
 {%- endmacro -%}