[vlc-devel] [PATCH 2/6] video_output: conditionnally enable display rendering

Alexandre Janniaux ajanni at videolabs.io
Fri Feb 5 15:54:46 UTC 2021


Hi,

Finally, I've reproduced additional deadlock when opening
the display while the rendering gets enabled, so I've
added a render_lock that is taken at the begining of the
RenderPicture function and released at the end, allowing
the vlc_gl_t to be created without deadlock with the main
thread reporting the event.

I'll send a new revision of this patchset.

Regards,
--
Alexandre Janniaux
Videolabs

On Fri, Feb 05, 2021 at 10:01:53AM +0100, Alexandre Janniaux wrote:
> Add a function to enable or disable the rendering on a vout_thread_t.
> This will be used by the window callbacks to prevent rendering on the
> window when the rendering_suspended/resumed events are triggered.
> ---
>  src/video_output/video_output.c  | 11 +++++++++++
>  src/video_output/vout_internal.h |  1 +
>  2 files changed, 12 insertions(+)
>
> diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
> index 323b40c084..d225e56d8d 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -162,6 +162,7 @@ typedef struct vout_thread_sys_t
>      vlc_decoder_device *dec_device;
>
>      /* Video output display */
> +    bool            rendering_enabled;
>      vout_display_cfg_t display_cfg;
>      vout_display_t *display;
>      vlc_mutex_t     display_lock;
> @@ -762,6 +763,15 @@ void vout_ChangeCropBorder(vout_thread_t *vout,
>      vlc_mutex_unlock(&sys->display_lock);
>  }
>
> +void vout_ChangeDisplayRenderingEnabled(vout_thread_t *vout, bool enabled)
> +{
> +    vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout);
> +    assert(!sys->dummy);
> +    vlc_mutex_lock(&sys->display_lock);
> +    sys->rendering_enabled = enabled;
> +    vlc_mutex_unlock(&sys->display_lock);
> +}
> +
>  void vout_ControlChangeFilters(vout_thread_t *vout, const char *filters)
>  {
>      vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout);
> @@ -2071,6 +2081,7 @@ static vout_thread_sys_t *vout_CreateCommon(vlc_object_t *object)
>
>      vout_thread_sys_t *sys = vout;
>      vlc_atomic_rc_init(&sys->rc);
> +    sys->rendering_enabled = true;
>
>      return vout;
>  }
> diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
> index ef92f1c889..8359af2817 100644
> --- a/src/video_output/vout_internal.h
> +++ b/src/video_output/vout_internal.h
> @@ -120,6 +120,7 @@ void vout_ChangeDisplayAspectRatio(vout_thread_t *, unsigned num, unsigned den);
>  void vout_ChangeCropRatio(vout_thread_t *, unsigned num, unsigned den);
>  void vout_ChangeCropWindow(vout_thread_t *, int x, int y, int width, int height);
>  void vout_ChangeCropBorder(vout_thread_t *, int left, int top, int right, int bottom);
> +void vout_ChangeDisplayRenderingEnabled(vout_thread_t *, bool);
>  void vout_ControlChangeFilters(vout_thread_t *, const char *);
>  void vout_ControlChangeInterlacing(vout_thread_t *, bool);
>  void vout_ControlChangeSubSources(vout_thread_t *, const char *);
> --
> 2.28.0
>


More information about the vlc-devel mailing list