[vlc-devel] [PATCH] Revert "video_output: translate the mouse coordinates to display coordinates early"

Alexandre Janniaux ajanni at videolabs.io
Tue Nov 3 15:13:06 CET 2020


Hi,

Patch LGTM as long as we revert it back after the merge
of the two missing window modules.

Regards,
--
Alexandre Janniaux
Videolabs

On Tue, Nov 03, 2020 at 12:56:58PM +0100, Steve Lhomme wrote:
> This reverts commit 5b2129eda58a4a19d37a9fb33e64af3777555233.
>
> This causes deadlocks with display modules where the display and windowing is
> tied. The display_lock and the internal UI/vout thread locking potentially
> called in different orders.
> ---
>  src/video_output/video_output.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
> index 57ee54e6e8b..2e1d7ffc8eb 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -384,14 +384,7 @@ void vout_MouseState(vout_thread_t *vout, const vlc_mouse_t *mouse)
>      assert(mouse);
>      vout_control_cmd_t cmd;
>      vout_control_cmd_Init(&cmd, VOUT_CONTROL_MOUSE_STATE);
> -
> -    /* Translate window coordinates to video coordinates */
> -    vlc_mutex_lock(&sys->display_lock);
> -    if (sys->display)
> -        vout_display_TranslateMouseState(sys->display, &cmd.mouse, mouse);
> -    else
> -        cmd.mouse = *mouse;
> -    vlc_mutex_unlock(&sys->display_lock);
> +    cmd.mouse = *mouse;
>
>      vout_control_Push(&sys->control, &cmd);
>  }
> @@ -1708,13 +1701,17 @@ void vout_ChangeSpuRate(vout_thread_t *vout, size_t channel_id, float rate)
>  static void ThreadProcessMouseState(vout_thread_sys_t *p_vout,
>                                      const vlc_mouse_t *win_mouse)
>  {
> -    vlc_mouse_t tmp1, tmp2;
> -    const vlc_mouse_t *m;
> +    vlc_mouse_t vid_mouse, tmp1, tmp2, *m;
>      vout_thread_t *vout = &p_vout->obj;
>      vout_thread_sys_t *sys = p_vout;
>
> -    /* pass mouse coordinates in the filter chains. */
> -    m = win_mouse;
> +    /* Translate window coordinates to video coordinates */
> +    vlc_mutex_lock(&sys->display_lock);
> +    vout_display_TranslateMouseState(sys->display, &vid_mouse, win_mouse);
> +    vlc_mutex_unlock(&sys->display_lock);
> +
> +    /* Then pass up the filter chains. */
> +    m = &vid_mouse;
>      vlc_mutex_lock(&sys->filter.lock);
>      if (sys->filter.chain_static && sys->filter.chain_interactive) {
>          if (!filter_chain_MouseFilter(sys->filter.chain_interactive,
> --
> 2.26.2
>
> _______________________________________________
> 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