Mesa (master): st: add ST_FLUSH_WAIT to st_context_flush()

Charmaine Lee charmainel at kemper.freedesktop.org
Thu Feb 23 05:39:22 UTC 2017


Module: Mesa
Branch: master
Commit: d793b54c4e921a8560a6aac6b9949f2784a5dc73
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d793b54c4e921a8560a6aac6b9949f2784a5dc73

Author: Charmaine Lee <charmainel at vmware.com>
Date:   Sat Feb 18 01:19:23 2017 -0800

st: add ST_FLUSH_WAIT to st_context_flush()

When st_context_flush() is called with ST_FLUSH_WAIT,
the function will return after the fence is completed.

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/include/state_tracker/st_api.h | 1 +
 src/mesa/state_tracker/st_manager.c        | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
index daa1f23..a999774 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -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.
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index c3d8286..e663b01 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -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);
 }




More information about the mesa-commit mailing list