[vlc-devel] [PATCH v2 1/7] video output: setup interruption context in vout

Rémi Denis-Courmont remi at remlab.net
Thu Feb 11 14:39:38 UTC 2021


Hi,

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.

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.

Le 11 février 2021 13:17:13 GMT+02:00, Alexandre Janniaux <ajanni at videolabs.io> a écrit :
>Hi,
>
>Where do you suggest to move the «interrupt-like» mechanism
>then?
>
>Regards,
>--
>Alexandre Janniaux
>Videolabs
>
>On Thu, Feb 11, 2021 at 12:27:35PM +0200, Rémi Denis-Courmont wrote:
>> Same as v1.
>>
>> -1
>>
>> Le 11 février 2021 10:34:03 GMT+02:00, Alexandre Janniaux
><ajanni at videolabs.io> a écrit :
>> >Some display are doing IO (eg. texture synchronization, WSI details)
>> >and
>> >might be waiting within the prepare/display code. Install an
>> >interruption context to allow notifying them that we're gonna kill
>> >them.
>> >---
>> > src/video_output/video_output.c | 14 ++++++++++++++
>> > 1 file changed, 14 insertions(+)
>> >
>> >diff --git a/src/video_output/video_output.c
>> >b/src/video_output/video_output.c
>> >index d04d3f4d11..d1eaf81242 100644
>> >--- a/src/video_output/video_output.c
>> >+++ b/src/video_output/video_output.c
>> >@@ -49,6 +49,7 @@
>> > #include <vlc_plugin.h>
>> > #include <vlc_codec.h>
>> > #include <vlc_atomic.h>
>> >+#include <vlc_interrupt.h>
>> >
>> > #include <libvlc.h>
>> > #include "vout_private.h"
>> >@@ -162,6 +163,7 @@ typedef struct vout_thread_sys_t
>> >vout_chrono_t   render;           /**< picture render time estimator
>*/
>> >     vout_chrono_t   static_filter;
>> >
>> >+    vlc_interrupt_t *interrupt;
>> >     vlc_atomic_rc_t rc;
>> >
>> > } vout_thread_sys_t;
>> >@@ -1763,6 +1765,8 @@ static void *Thread(void *object)
>> >     vlc_tick_t deadline = VLC_TICK_INVALID;
>> >     bool wait = false;
>> >
>> >+    vlc_interrupt_set(sys->interrupt);
>> >+
>> >     for (;;) {
>> >         if (wait)
>> >         {
>> >@@ -1848,9 +1852,11 @@ void vout_StopDisplay(vout_thread_t *vout)
>> >     vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout);
>> >
>> >     atomic_store(&sys->control_is_terminated, true);
>> >+    vlc_interrupt_kill(sys->interrupt);
>> >// wake up so it goes back to the loop that will detect the
>terminated
>> >state
>> >     vout_control_Wake(&sys->control);
>> >     vlc_join(sys->thread, NULL);
>> >+    vlc_interrupt_destroy(sys->interrupt);
>> >
>> >     vout_ReleaseDisplay(sys);
>> > }
>> >@@ -2147,6 +2153,14 @@ int vout_Request(const vout_configuration_t
>> >*cfg, vlc_video_context *vctx, input
>> >
>> >     if (sys->display != NULL)
>> >         vout_StopDisplay(cfg->vout);
>> >+    sys->interrupt = vlc_interrupt_create();
>> >+    if (sys->interrupt == NULL)
>> >+    {
>> >+        video_format_Clean(&original);
>> >+        vout_DisableWindow(vout);
>> >+        return -1;
>> >+    }
>> >+
>> >
>> >     vout_ReinitInterlacingSupport(cfg->vout, &sys->private);
>> >
>> >--
>> >2.30.1
>> >
>> >_______________________________________________
>> >vlc-devel mailing list
>> >To unsubscribe or modify your subscription options:
>> >https://mailman.videolan.org/listinfo/vlc-devel
>>
>> --
>> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez
>excuser ma brièveté.
>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20210211/94850a52/attachment.html>


More information about the vlc-devel mailing list