summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZou Nan hai <[email protected]>2011-07-21 00:12:59 +0800
committerEric Anholt <[email protected]>2011-10-10 11:38:52 -0700
commit7457da5edd4a33c2581f10608ce5bcf0e254c5f9 (patch)
treea3ce074e09687cebae58f916c3735f28a8e71e60 /src
parent9f0e98d1dfcf83a07a62e9c62e3dc77336789b4a (diff)
i965: Fix timer query on gen6+
PIPE_CONTROL reported time stamp are 64 bits value incrementing every 80 ns, and only the low 32 bits are active (high 32 are always 0). v2: Cleaned up whitespace, function arguments (anholt). Fixes piglit EXT_timer_query/time-elapsed Signed-off-by: Zou Nan hai <[email protected]> Signed-off-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_queryobj.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c
index b41d05dd438..08492d6b111 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -47,8 +47,11 @@
/** Waits on the query object's BO and totals the results for this query */
static void
-brw_queryobj_get_results(struct brw_query_object *query)
+brw_queryobj_get_results(struct gl_context *ctx,
+ struct brw_query_object *query)
{
+ struct intel_context *intel = intel_context(ctx);
+
int i;
uint64_t *results;
@@ -58,7 +61,10 @@ brw_queryobj_get_results(struct brw_query_object *query)
drm_intel_bo_map(query->bo, GL_FALSE);
results = query->bo->virtual;
if (query->Base.Target == GL_TIME_ELAPSED_EXT) {
- query->Base.Result += 1000 * ((results[1] >> 32) - (results[0] >> 32));
+ if (intel->gen >= 6)
+ query->Base.Result += 80 * (results[1] - results[0]);
+ else
+ query->Base.Result += 1000 * ((results[1] >> 32) - (results[0] >> 32));
} else {
/* Map and count the pixels from the current query BO */
for (i = query->first_index; i <= query->last_index; i++) {
@@ -201,7 +207,7 @@ static void brw_wait_query(struct gl_context *ctx, struct gl_query_object *q)
{
struct brw_query_object *query = (struct brw_query_object *)q;
- brw_queryobj_get_results(query);
+ brw_queryobj_get_results(ctx, query);
query->Base.Ready = GL_TRUE;
}
@@ -210,7 +216,7 @@ static void brw_check_query(struct gl_context *ctx, struct gl_query_object *q)
struct brw_query_object *query = (struct brw_query_object *)q;
if (query->bo == NULL || !drm_intel_bo_busy(query->bo)) {
- brw_queryobj_get_results(query);
+ brw_queryobj_get_results(ctx, query);
query->Base.Ready = GL_TRUE;
}
}
@@ -249,6 +255,7 @@ void
brw_emit_query_begin(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
+ struct gl_context *ctx = &intel->ctx;
struct brw_query_object *query = brw->query.obj;
/* Skip if we're not doing any queries, or we've emitted the start. */
@@ -295,7 +302,7 @@ brw_emit_query_begin(struct brw_context *brw)
if (query->bo != brw->query.bo) {
if (query->bo != NULL)
- brw_queryobj_get_results(query);
+ brw_queryobj_get_results(ctx, query);
drm_intel_bo_reference(brw->query.bo);
query->bo = brw->query.bo;
query->first_index = brw->query.index;