[vlc-commits] window: do not bypass vout thread when resizing

Rémi Denis-Courmont git at videolan.org
Sun May 20 19:51:42 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri May 18 21:04:31 2018 +0300| [56de48d1d1259f0700d16d301559a149f0fda4c7] | committer: Rémi Denis-Courmont

window: do not bypass vout thread when resizing

When the vout window is resized, queue an event to the video output
thread. This will wake-up the video output thread automatically and
process the change straight away.

Sending an event directly to the display is somewhat ugly, and will
would not perform any necessary vout thread wake-up.

This removes vout_display_window_Detach(), which had become a no-op.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=56de48d1d1259f0700d16d301559a149f0fda4c7
---

 src/video_output/display.c |  8 ++------
 src/video_output/window.c  | 46 +++-------------------------------------------
 src/video_output/window.h  |  1 -
 3 files changed, 5 insertions(+), 50 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index 7d2201044e..68c1dc91e8 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -652,9 +652,7 @@ static void VoutDisplayDelWindow(vout_display_t *vd, vout_window_t *window)
 {
     vout_display_owner_sys_t *osys = vd->owner.sys;
 
-    if (window != NULL)
-        vout_display_window_Detach(window);
-    else
+    if (window == NULL)
         vout_DeleteDisplayWindow(osys->vout);
 }
 
@@ -1240,9 +1238,7 @@ static vout_window_t *SplitterNewWindow(vout_display_t *vd, unsigned type)
 
 static void SplitterDelWindow(vout_display_t *vd, vout_window_t *window)
 {
-    if (window != NULL)
-        vout_display_window_Detach(window);
-    (void) vd;
+    (void) vd; (void) window;
 }
 
 static void SplitterEvent(vout_display_t *vd, int event, va_list args)
diff --git a/src/video_output/window.c b/src/video_output/window.c
index 9ea5890ae9..ea8f4106f3 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -130,27 +130,17 @@ void vout_window_SetInhibition(vout_window_t *window, bool enabled)
 typedef struct vout_display_window
 {
     vout_display_t *vd;
-    unsigned width;
-    unsigned height;
     vlc_mouse_t mouse;
     mtime_t last_left_press;
-
-    vlc_mutex_t lock;
 } vout_display_window_t;
 
 static void vout_display_window_ResizeNotify(vout_window_t *window,
                                              unsigned width, unsigned height)
 {
-    vout_display_window_t *state = window->owner.sys;
+    vout_thread_t *vout = (vout_thread_t *)window->obj.parent;
 
     msg_Dbg(window, "resized to %ux%u", width, height);
-    vlc_mutex_lock(&state->lock);
-    state->width = width;
-    state->height = height;
-
-    if (state->vd != NULL)
-        vout_display_SendEventDisplaySize(state->vd, width, height);
-    vlc_mutex_unlock(&state->lock);
+    vout_ControlChangeDisplaySize(vout, width, height);
 }
 
 static void vout_display_window_CloseNotify(vout_window_t *window)
@@ -237,12 +227,8 @@ vout_window_t *vout_display_window_New(vout_thread_t *vout,
     if (state == NULL)
         return NULL;
 
-    state->vd = NULL;
-    state->width = cfg->width;
-    state->height = cfg->height;
     vlc_mouse_Init(&state->mouse);
     state->last_left_press = INT64_MIN;
-    vlc_mutex_init(&state->lock);
 
     char *modlist = var_InheritString(vout, "window");
     vout_window_owner_t owner = {
@@ -253,10 +239,8 @@ vout_window_t *vout_display_window_New(vout_thread_t *vout,
 
     window = vout_window_New((vlc_object_t *)vout, modlist, cfg, &owner);
     free(modlist);
-    if (window == NULL) {
-        vlc_mutex_destroy(&state->lock);
+    if (window == NULL)
         free(state);
-    }
     return window;
 }
 
@@ -266,29 +250,8 @@ vout_window_t *vout_display_window_New(vout_thread_t *vout,
  */
 void vout_display_window_Attach(vout_window_t *window, vout_display_t *vd)
 {
-    vout_display_window_t *state = window->owner.sys;
-
     vout_window_SetSize(window,
                         vd->cfg->display.width, vd->cfg->display.height);
-
-    vlc_mutex_lock(&state->lock);
-    state->vd = vd;
-
-    vout_display_SendEventDisplaySize(vd, state->width, state->height);
-    vlc_mutex_unlock(&state->lock);
-}
-
-/**
- * Detaches a window from a display. Window events will no longer be dispatched
- * (except those that do not need a display).
- */
-void vout_display_window_Detach(vout_window_t *window)
-{
-    vout_display_window_t *state = window->owner.sys;
-
-    vlc_mutex_lock(&state->lock);
-    state->vd = NULL;
-    vlc_mutex_unlock(&state->lock);
 }
 
 /**
@@ -300,8 +263,5 @@ void vout_display_window_Delete(vout_window_t *window)
     vout_display_window_t *state = window->owner.sys;
 
     vout_window_Delete(window);
-
-    assert(state->vd == NULL);
-    vlc_mutex_destroy(&state->lock);
     free(state);
 }
diff --git a/src/video_output/window.h b/src/video_output/window.h
index 1b123c3490..459d6c38cb 100644
--- a/src/video_output/window.h
+++ b/src/video_output/window.h
@@ -21,5 +21,4 @@
 vout_window_t *vout_display_window_New(vout_thread_t *,
                                        const vout_window_cfg_t *);
 void vout_display_window_Attach(vout_window_t *, vout_display_t *);
-void vout_display_window_Detach(vout_window_t *);
 void vout_display_window_Delete(vout_window_t *);



More information about the vlc-commits mailing list