Matteo Bruni : wined3d: Get rid of most of the redundant query flushes.

Alexandre Julliard julliard at winehq.org
Mon Sep 11 15:07:59 CDT 2017


Module: wine
Branch: master
Commit: cc8e87372036504f1b25036125072d1d5a84e18c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cc8e87372036504f1b25036125072d1d5a84e18c

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Fri Sep  8 18:44:08 2017 +0200

wined3d: Get rid of most of the redundant query flushes.

This way we avoid queueing up CS packets on each
wined3d_query_get_data() call, which has been seen in some degenerate
cases to starve other client threads that are trying to submit actual
work into the CS (sort-of a livelock).

Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/cs.c              | 2 ++
 dlls/wined3d/query.c           | 2 +-
 dlls/wined3d/wined3d_private.h | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 6ea2fd2..0ff0c61 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -877,6 +877,7 @@ void wined3d_cs_emit_flush(struct wined3d_cs *cs)
     op->opcode = WINED3D_CS_OP_FLUSH;
 
     cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
+    cs->queries_flushed = TRUE;
 }
 
 static void wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data)
@@ -1863,6 +1864,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
     op->flags = flags;
 
     cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
+    cs->queries_flushed = FALSE;
 }
 
 static void wined3d_cs_exec_preload_resource(struct wined3d_cs *cs, const void *data)
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index 88f64bd..1bdaaf0 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -389,7 +389,7 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
     }
     else if (query->counter_main != query->counter_retrieved)
     {
-        if (flags & WINED3DGETDATA_FLUSH)
+        if (flags & WINED3DGETDATA_FLUSH && !query->device->cs->queries_flushed)
             wined3d_cs_emit_flush(query->device->cs);
         return S_FALSE;
     }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 70120e8..04f2955 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3427,6 +3427,7 @@ struct wined3d_cs
     size_t data_size, start, end;
     void *data;
     struct list query_poll_list;
+    BOOL queries_flushed;
 
     HANDLE event;
     BOOL waiting_for_event;




More information about the wine-cvs mailing list