st: add ST_FLUSH_WAIT to st_context_flush()
authorCharmaine Lee <charmainel@vmware.com>
Sat, 18 Feb 2017 09:19:23 +0000 (01:19 -0800)
committerCharmaine Lee <charmainel@vmware.com>
Sat, 18 Feb 2017 17:36:42 +0000 (09:36 -0800)
When st_context_flush() is called with ST_FLUSH_WAIT,
the function will return after the fence is completed.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/include/state_tracker/st_api.h
src/mesa/state_tracker/st_manager.c

index daa1f23812e35f1f80223ad5f1e4e53115bf7ded..a9997744cde79dc54174edf45f4d81fd3d495570 100644 (file)
@@ -160,6 +160,7 @@ enum st_context_resource_type {
  */
 #define ST_FLUSH_FRONT                    (1 << 0)
 #define ST_FLUSH_END_OF_FRAME             (1 << 1)
+#define ST_FLUSH_WAIT                     (1 << 2)
 
 /**
  * Value to st_manager->get_param function.
index c3d8286b5a712daa0c7d2a592e0737d34c0b6492..e663b017174ebb5b4260de2dd133abc9c6b0c4a4 100644 (file)
@@ -504,6 +504,13 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags,
    }
 
    st_flush(st, fence, pipe_flags);
+
+   if ((flags & ST_FLUSH_WAIT) && fence) {
+      st->pipe->screen->fence_finish(st->pipe->screen, NULL, *fence,
+                                     PIPE_TIMEOUT_INFINITE);
+      st->pipe->screen->fence_reference(st->pipe->screen, fence, NULL);
+   }
+
    if (flags & ST_FLUSH_FRONT)
       st_manager_flush_frontbuffer(st);
 }