<html><head></head><body>Hi,<br><br>In general, the interrupt helpers are only useful when there's multiple layers involved in the call stack - input->demux->access being the original use case. It's not the case in the vout thread. With a single component involved, interrupts are making things more complicated than necessary.<br><br>But more importantly, the vout thread cannot have long sleeps. It holds contended locks (filter and display) that would break other threads if slept with. Also it does timed and time-sensitive work. So it can't sleep for long and there's really no valid reasons why it would even need an interrupt-like mechanism.<br><br><div class="gmail_quote">Le 11 février 2021 13:17:13 GMT+02:00, Alexandre Janniaux <ajanni@videolabs.io> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">Hi,<br><br>Where do you suggest to move the «interrupt-like» mechanism<br>then?<br><br>Regards,<br>--<br>Alexandre Janniaux<br>Videolabs<br><br>On Thu, Feb 11, 2021 at 12:27:35PM +0200, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> Same as v1.<br><br> -1<br><br> Le 11 février 2021 10:34:03 GMT+02:00, Alexandre Janniaux <ajanni@videolabs.io> a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">Some display are doing IO (eg. texture synchronization, WSI details)<br>and<br>might be waiting within the prepare/display code. Install an<br>interruption context to allow notifying them that we're gonna kill<br>them.<hr> src/video_output/video_output.c | 14 ++++++++++++++<br> 1 file changed, 14 insertions(+)<br><br>diff --git a/src/video_output/video_output.c<br>b/src/video_output/video_output.c<br>index d04d3f4d11..d1eaf81242 100644<br>--- a/src/video_output/video_output.c<br>+++ b/src/video_output/video_output.c<br>@@ -49,6 +49,7 @@<br> #include <vlc_plugin.h><br> #include <vlc_codec.h><br> #include <vlc_atomic.h><br>+#include <vlc_interrupt.h><br><br> #include <libvlc.h><br> #include "vout_private.h"<br>@@ -162,6 +163,7 @@ typedef struct vout_thread_sys_t<br>vout_chrono_t   render;           /**< picture render time estimator */<br>     vout_chrono_t   static_filter;<br><br>+    vlc_interrupt_t *interrupt;<br>     vlc_atomic_rc_t rc;<br><br> } vout_thread_sys_t;<br>@@ -1763,6 +1765,8 @@ static void *Thread(void *object)<br>     vlc_tick_t deadline = VLC_TICK_INVALID;<br>     bool wait = false;<br><br>+    vlc_interrupt_set(sys->interrupt);<br>+<br>     for (;;) {<br>         if (wait)<br>         {<br>@@ -1848,9 +1852,11 @@ void vout_StopDisplay(vout_thread_t *vout)<br>     vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout);<br><br>     atomic_store(&sys->control_is_terminated, true);<br>+    vlc_interrupt_kill(sys->interrupt);<br>// wake up so it goes back to the loop that will detect the terminated<br>state<br>     vout_control_Wake(&sys->control);<br>     vlc_join(sys->thread, NULL);<br>+    vlc_interrupt_destroy(sys->interrupt);<br><br>     vout_ReleaseDisplay(sys);<br> }<br>@@ -2147,6 +2153,14 @@ int vout_Request(const vout_configuration_t<br>*cfg, vlc_video_context *vctx, input<br><br>     if (sys->display != NULL)<br>         vout_StopDisplay(cfg->vout);<br>+    sys->interrupt = vlc_interrupt_create();<br>+    if (sys->interrupt == NULL)<br>+    {<br>+        video_format_Clean(&original);<br>+        vout_DisableWindow(vout);<br>+        return -1;<br>+    }<br>+<br><br>     vout_ReinitInterlacingSupport(cfg->vout, &sys->private);<br><br>--<br>2.30.1<hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote>--<br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.<br></blockquote><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>