[vlc-commits] wl/shm: only wait for buffers at termination

Rémi Denis-Courmont git at videolan.org
Wed Dec 12 21:29:31 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Dec 12 22:23:07 2018 +0200| [321d1624e2785c2064efded23c59f35347ad70b4] | committer: Rémi Denis-Courmont

wl/shm: only wait for buffers at termination

There is no point waiting when resetting pictures. The picture buffers
can outlive the video format being reset. We still to wait for buffers
at termination because they depend on the event queue.

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

 modules/video_output/wayland/shm.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c
index 641f3eb52e..28a5948c92 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -195,21 +195,9 @@ static void Display(vout_display_t *vd, picture_t *pic)
 static void ResetPictures(vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
-    struct wl_display *display = sys->embed->display.wl;
-    struct wl_surface *surface = sys->embed->handle.wl;
     if (sys->pool == NULL)
         return;
 
-    wl_surface_attach(surface, NULL, 0, 0);
-    wl_surface_commit(surface);
-
-    /* Wait until all picture buffers are released by the server */
-    while (sys->active_buffers > 0) {
-        msg_Dbg(vd, "%zu buffer(s) still active", sys->active_buffers);
-        wl_display_roundtrip_queue(display, sys->eventq);
-    }
-    msg_Dbg(vd, "no active buffers left");
-
     /* Destroy the buffers */
     picture_pool_Release(sys->pool);
     sys->pool = NULL;
@@ -436,15 +424,27 @@ error:
 static void Close(vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
+    struct wl_display *display = sys->embed->display.wl;
+    struct wl_surface *surface = sys->embed->handle.wl;
 
     ResetPictures(vd);
 
+    wl_surface_attach(surface, NULL, 0, 0);
+    wl_surface_commit(surface);
+
+    /* Wait until all picture buffers are released by the server */
+    while (sys->active_buffers > 0) {
+        msg_Dbg(vd, "%zu buffer(s) still active", sys->active_buffers);
+        wl_display_roundtrip_queue(display, sys->eventq);
+    }
+    msg_Dbg(vd, "no active buffers left");
+
     if (sys->viewport != NULL)
         wp_viewport_destroy(sys->viewport);
     if (sys->viewporter != NULL)
         wp_viewporter_destroy(sys->viewporter);
     wl_shm_destroy(sys->shm);
-    wl_display_flush(sys->embed->display.wl);
+    wl_display_flush(display);
     wl_event_queue_destroy(sys->eventq);
     free(sys);
 }



More information about the vlc-commits mailing list