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

Alexandre Janniaux ajanni at videolabs.io
Thu Feb 11 15:20:14 UTC 2021


Hi,

Yes, the real bug it is workarounding is in the mediacodec module,
and it's to pass the vout->display->opengl interop layers.

In mediacodec, the inflight pictures are flushed even though they
are still conveyed by a picture_t.

As I'm adding wait (which should be short) on the SurfaceTexture,
if the picture cannot be delivered because of the flush, then it
cannot unblock the wait.

I'll try to find another fix for mediacodec.

Thanks for review,

Regards,
--
Alexandre Janniaux
Videolabs

On Thu, Feb 11, 2021 at 04:39:38PM +0200, Rémi Denis-Courmont wrote:
> 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é.

> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list