[vlc-devel] [PATCH 4/6] video_output: conditionnally render on display
Alexandre Janniaux
ajanni at videolabs.io
Fri Feb 5 09:43:08 UTC 2021
Hi,
As I've mentioned in the commit message, since the disabling
of rendering needs to grab display lock, and prepare/display
is protected behind display lock, it's either bother prepare
and display are called with the same picture or none of them
are called.
Regards,
--
Alexandre Janniaux
Videolabs
On Fri, Feb 05, 2021 at 10:20:25AM +0100, Thomas Guillem wrote:
>
>
> On Fri, Feb 5, 2021, at 10:01, Alexandre Janniaux wrote:
> > Don't prepare/display if rendering is disabled. Rendering can only be
> > disabled when taking the display_lock so the prepare/display cannot be
> > done partially because of this patch.
> > ---
> > src/video_output/video_output.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/video_output/video_output.c
> > b/src/video_output/video_output.c
> > index d225e56d8d..11c50871c1 100644
> > --- a/src/video_output/video_output.c
> > +++ b/src/video_output/video_output.c
> > @@ -1405,7 +1405,7 @@ static int
> > ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool render_now)
> > const unsigned frame_rate = todisplay->format.i_frame_rate;
> > const unsigned frame_rate_base =
> > todisplay->format.i_frame_rate_base;
> >
> > - if (vd->ops->prepare != NULL)
> > + if (vd->ops->prepare != NULL && sys->rendering_enabled)
> > vd->ops->prepare(vd, todisplay, do_dr_spu ? subpic : NULL, system_pts);
> >
> > vout_chrono_Stop(&sys->render);
> > @@ -1452,7 +1452,9 @@ static int
> > ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool render_now)
> > frame_rate, frame_rate_base);
> >
> > /* Display the direct buffer returned by vout_RenderPicture */
> > - vout_display_Display(vd, todisplay);
> > + if (sys->rendering_enabled)
> > + vout_display_Display(vd, todisplay);
>
> cf. prepare documentation:
> * If prepare is not \c NULL, there is an implicit guarantee that display
> * will be invoked with the exact same picture afterwards:
>
> If the prepare callback is called, then the display should always be called after. Indeed, some modules allocates resources on prepare() and release them on display().
>
> > +
> > vlc_mutex_unlock(&sys->display_lock);
> >
> > if (subpic)
> > --
> > 2.28.0
> >
> > _______________________________________________
> > 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
More information about the vlc-devel
mailing list