[vlc-devel] [PATCH 1/3] display: turn the reset_pictures flag into a simple boolean

Steve Lhomme robux4 at ycbcr.xyz
Thu Oct 24 17:18:58 CEST 2019


It is already read alongside control calls which are protected by the caller.

It is only set by D3D9 which is setting it during Prepare which is also
protected by the caller the same way.
---
 src/video_output/display.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index 556406f7c6d..8c5d8539b4d 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -283,7 +283,7 @@ typedef struct {
       * can be done and nothing will be displayed */
     filter_chain_t *converters;
 #ifdef _WIN32
-    atomic_bool reset_pictures;
+    bool reset_pictures; // set/read under the same lock as the control
 #endif
     picture_pool_t *pool;
 } vout_display_priv_t;
@@ -361,7 +361,7 @@ void vout_display_SendEventPicturesInvalid(vout_display_t *vd)
 
     msg_Err(vd, "picture buffers invalidated asynchronously");
     assert(vd->info.has_pictures_invalid);
-    atomic_store_explicit(&osys->reset_pictures, true, memory_order_release);
+    osys->reset_pictures = true;
 #else
     (void) vd;
     vlc_assert_unreachable();
@@ -484,9 +484,8 @@ static void vout_display_CheckReset(vout_display_t *vd)
 #ifdef _WIN32
     vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
 
-    if (unlikely(atomic_exchange_explicit(&osys->reset_pictures, false,
-                                          memory_order_relaxed))) {
-        atomic_thread_fence(memory_order_acquire);
+    if (unlikely(osys->reset_pictures)) {
+        osys->reset_pictures = false;
         vout_display_Reset(vd);
     }
 #else
@@ -744,7 +743,7 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
                                        &osys->cfg.display.height,
                                        source, &osys->cfg);
 #ifdef _WIN32
-    atomic_init(&osys->reset_pictures, false);
+    osys->reset_pictures = false;
 #endif
     osys->pool = NULL;
 
-- 
2.17.1



More information about the vlc-devel mailing list