summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2014-12-11 01:43:52 -0800
committerKenneth Graunke <[email protected]>2014-12-16 15:39:53 -0800
commit9c47653d3202b166efb51bac00ae84f9d03b2a40 (patch)
tree75a2fbabaefaa3c8d4240dfb109a5b1f4ebaf58c /src/mesa/drivers/dri
parent12c16f4f27f7d57b036493826eacc1cab0584d45 (diff)
i965/query: Remove redundant drm_intel_bo_references call in CheckQuery.
CheckQuery calls drm_intel_bo_references to see if the batch references the query BO, and if so, flushes. It then checks if the query BO is busy, and if not, calls gen6_queryobj_get_results(). Stupidly, gen6_queryobj_get_results() immediately did a second redundant drm_intel_bo_references check, even though we know the buffer is not referenced and in fact idle. This patch moves the batch-flush check out of gen6_queryobj_get_results and into WaitQuery() (the other caller). That way, both callers do a single batch-flush check. This should only be a minor improvement, since it would only affect the first CheckQuery call where the result is actually available. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86969 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ben Widawsky <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i965/gen6_queryobj.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_queryobj.c b/src/mesa/drivers/dri/i965/gen6_queryobj.c
index 537c1d992cc..9d2e5c44f8d 100644
--- a/src/mesa/drivers/dri/i965/gen6_queryobj.c
+++ b/src/mesa/drivers/dri/i965/gen6_queryobj.c
@@ -121,13 +121,6 @@ gen6_queryobj_get_results(struct gl_context *ctx,
if (query->bo == NULL)
return;
- /* If the application has requested the query result, but this batch is
- * still contributing to it, flush it now so the results will be present
- * when mapped.
- */
- if (drm_intel_bo_references(brw->batch.bo, query->bo))
- intel_batchbuffer_flush(brw);
-
if (unlikely(brw->perf_debug)) {
if (drm_intel_bo_busy(query->bo)) {
perf_debug("Stalling on the GPU waiting for a query object.\n");
@@ -304,8 +297,16 @@ gen6_end_query(struct gl_context *ctx, struct gl_query_object *q)
*/
static void gen6_wait_query(struct gl_context *ctx, struct gl_query_object *q)
{
+ struct brw_context *brw = brw_context(ctx);
struct brw_query_object *query = (struct brw_query_object *)q;
+ /* If the application has requested the query result, but this batch is
+ * still contributing to it, flush it now to finish that work so the
+ * result will become available (eventually).
+ */
+ if (drm_intel_bo_references(brw->batch.bo, query->bo))
+ intel_batchbuffer_flush(brw);
+
gen6_queryobj_get_results(ctx, query);
}