[Mesa-dev] [PATCH v3 12/19] st/nine: if query needs flush, try again get_query_result after flush

David Heidelberg david at ixit.cz
Mon Nov 24 15:38:12 PST 2014


From: Axel Davy <axel.davy at ens.fr>

Cc: "10.4" <mesa-stable at lists.freedesktop.org>
Tested-by: David Heidelberg <david at ixit.cz>
Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/query9.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/nine/query9.c b/src/gallium/state_trackers/nine/query9.c
index e44eb11..761f02e 100644
--- a/src/gallium/state_trackers/nine/query9.c
+++ b/src/gallium/state_trackers/nine/query9.c
@@ -196,7 +196,7 @@ NineQuery9_GetData( struct NineQuery9 *This,
                     DWORD dwGetDataFlags )
 {
     struct pipe_context *pipe = This->base.device->pipe;
-    boolean ok;
+    boolean ok, flush_if_needed;
     unsigned i;
     union pipe_query_result presult;
     union nine_query_result nresult;
@@ -212,16 +212,18 @@ NineQuery9_GetData( struct NineQuery9 *This,
     if (This->state == NINE_QUERY_STATE_FRESH)
         return S_OK;
 
+    flush_if_needed = dwGetDataFlags &&
+                      This->state != NINE_QUERY_STATE_FLUSHED;
+
     ok = pipe->get_query_result(pipe, This->pq, FALSE, &presult);
-    if (!ok) {
-        if (dwGetDataFlags) {
-            if (This->state != NINE_QUERY_STATE_FLUSHED)
-                pipe->flush(pipe, NULL, 0);
-            This->state = NINE_QUERY_STATE_FLUSHED;
-        }
-        return S_FALSE;
+    if (!ok && flush_if_needed) {
+        pipe->flush(pipe, NULL, 0);
+        ok = pipe->get_query_result(pipe, This->pq, FALSE, &presult);
+        This->state = NINE_QUERY_STATE_FLUSHED;
     }
 
+    if (!ok) return S_FALSE;
+
     if (!dwSize)
         return S_OK;
 
-- 
2.1.3



More information about the mesa-dev mailing list