[vlc-commits] display: unroll picture buffer reset

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


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat May 19 17:39:02 2018 +0300| [b0fcf457c326e74763ff4c1203fc6e2be3153ccf] | committer: Rémi Denis-Courmont

display: unroll picture buffer reset

If multiple events require resetting the picture pool, we are better
off resetting only once at the end.

This works because resetting the pool will not trigger any other
cascaded event within the vout display management loop.

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

 src/video_output/display.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index 65a6c98893..b79d12b844 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -643,7 +643,6 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
         SplitterManage(vd);
 
     bool fit_window = false;
-    bool reset_render = false;
     for (;;) {
 #if defined(_WIN32) || defined(__OS2__)
         vlc_mutex_lock(&osys->lock);
@@ -657,10 +656,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
         vlc_mutex_unlock(&osys->lock);
 #endif
 
-        bool reset_pictures = allow_reset_pictures
-            && atomic_exchange(&osys->reset_pictures, false);
-
-        if (!reset_pictures &&
+        if (
 #if defined(_WIN32) || defined(__OS2__)
             !ch_fullscreen &&
             !ch_wm_state &&
@@ -772,24 +768,22 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
             osys->cfg.viewpoint = osys->viewpoint;
             osys->ch_viewpoint  = false;
         }
-
-        /* */
-        if (reset_pictures) {
-            if (vout_display_Control(vd, VOUT_DISPLAY_RESET_PICTURES)) {
-                /* FIXME what to do here ? */
-                msg_Err(vd, "Failed to reset pictures (probably fatal)");
-            }
-            reset_render = true;
-        }
     }
 
     if (fit_window)
         VoutDisplayFitWindow(vd, false);
 
-    if (reset_render)
+    if (allow_reset_pictures
+     && atomic_exchange(&osys->reset_pictures, false)) {
+        if (vout_display_Control(vd, VOUT_DISPLAY_RESET_PICTURES)) {
+            /* FIXME what to do here ? */
+            msg_Err(vd, "Failed to reset pictures (probably fatal)");
+        }
         VoutDisplayResetRender(vd);
+        return true;
+    }
 
-    return reset_render;
+    return false;
 }
 
 bool vout_AreDisplayPicturesInvalid(vout_display_t *vd)



More information about the vlc-commits mailing list