[PATCH v2 2/5] wined3d: Get rid of most of the redundant query flushes.
Matteo Bruni
mbruni at codeweavers.com
Fri Sep 8 11:44:08 CDT 2017
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).
This doesn't do an accurate tracking of flushes vs query issues, which
means some unnecessary flushes might happen. At least for the
applications / drivers combinations I tested it doesn't seem like the
additional complexity of a more thorough implementation is warranted.
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
v2: Go back to WINED3D_CS_OP_FLUSH, use the single global flag check
mentioned at the end of the review email.
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 6ea2fd27a7..0ff0c61a45 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 88f64bddc2..1bdaaf0284 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 70120e8a5b..04f2955990 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;
--
2.13.5
More information about the wine-patches
mailing list