st/mesa: remove redundant flushes from st_flush
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Sun, 22 Oct 2017 15:39:02 +0000 (17:39 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 9 Nov 2017 13:20:58 +0000 (14:20 +0100)
st_flush should flush state tracker-internal state and the pipe, but
not mesa/main state. Of the four callers:

- glFlush/glFinish already call FLUSH_{VERTICES,STATE}.
- st_vdpau doesn't need to call them.
- st_manager will now call them explicitly.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_cb_flush.c
src/mesa/state_tracker/st_manager.c
src/mesa/state_tracker/st_vdpau.c

index d9ec0a846a741600458dfcf063ff95ab9424b1bf..c8452d0e6f7220750f8fd64de29d6048469bdfca 100644 (file)
@@ -50,9 +50,6 @@ void st_flush(struct st_context *st,
               struct pipe_fence_handle **fence,
               unsigned flags)
 {
-   FLUSH_VERTICES(st->ctx, 0);
-   FLUSH_CURRENT(st->ctx, 0);
-
    st_flush_bitmap_cache(st);
 
    st->pipe->flush(st->pipe, fence, flags);
index d27727ae8fb96e81e1ede86591195c377049a0e5..953f7156c9064481e5276e2ab9b683b294160ea3 100644 (file)
@@ -45,6 +45,7 @@
 #include "st_debug.h"
 #include "st_extensions.h"
 #include "st_format.h"
+#include "st_cb_bitmap.h"
 #include "st_cb_fbo.h"
 #include "st_cb_flush.h"
 #include "st_manager.h"
@@ -635,6 +636,8 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags,
       pipe_flags |= PIPE_FLUSH_END_OF_FRAME;
    }
 
+   FLUSH_VERTICES(st->ctx, 0);
+   FLUSH_CURRENT(st->ctx, 0);
    st_flush(st, fence, pipe_flags);
 
    if ((flags & ST_FLUSH_WAIT) && fence && *fence) {
index 19611e719a185199838c2c5cf94daa7a8e11a029..e0126cc03d8b97f02e6c3ed9ce159b9eef261447 100644 (file)
@@ -262,6 +262,9 @@ st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access,
 
    _mesa_dirty_texobj(ctx, texObj);
 
+   /* NV_vdpau_interop does not specify an explicit synchronization mechanism
+    * between the GL and VDPAU contexts. Provide automatic synchronization here.
+    */
    st_flush(st, NULL, 0);
 }