diff options
author | Kenneth Graunke <[email protected]> | 2013-02-25 23:33:24 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-03-01 22:09:04 -0800 |
commit | 961c9b8cac6c438b74d8328a5e8c61215a16ea40 (patch) | |
tree | e194542976ba6e75be7f7cc9be29594a0ad507bb /src/mesa/drivers | |
parent | 614944b8975ce9827b26b92f42ad8b48493eb7f0 (diff) |
i965: Replace the global brw->query.bo variable with query->bo.
Again, eliminating a global variable in favor of a per-query object
variable will help in a future where we have more queries in hardware.
Personally, I find this clearer: there's just the query object's BO,
rather than two variables that usually shadow each other.
Signed-off-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_queryobj.c | 22 |
2 files changed, 7 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 9f386255b9e..c34d6b108a2 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1043,7 +1043,6 @@ struct brw_context struct { struct brw_query_object *obj; - drm_intel_bo *bo; bool begin_emitted; } query; diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c index 0cdfa6e486b..ccc504f5241 100644 --- a/src/mesa/drivers/dri/i965/brw_queryobj.c +++ b/src/mesa/drivers/dri/i965/brw_queryobj.c @@ -408,9 +408,6 @@ brw_end_query(struct gl_context *ctx, struct gl_query_object *q) brw_emit_query_end(brw); - drm_intel_bo_unreference(brw->query.bo); - brw->query.bo = NULL; - brw->query.obj = NULL; intel->stats_wm--; @@ -530,8 +527,7 @@ brw_emit_query_begin(struct brw_context *brw) * If not, create a new one of the same size; we'll gather the existing * buffer's results momentarily. */ - if (brw->query.bo == NULL || - query->last_index * 2 + 1 >= 4096 / sizeof(uint64_t)) { + if (!query->bo || query->last_index * 2 + 1 >= 4096 / sizeof(uint64_t)) { if (query->bo != NULL) { /* The old query BO did not have enough space, so we allocated a new @@ -540,22 +536,18 @@ brw_emit_query_begin(struct brw_context *brw) */ brw_queryobj_get_results(ctx, query); } - drm_intel_bo_unreference(brw->query.bo); - brw->query.bo = NULL; - brw->query.bo = drm_intel_bo_alloc(intel->bufmgr, "query", 4096, 1); - drm_intel_bo_reference(brw->query.bo); + query->bo = drm_intel_bo_alloc(intel->bufmgr, "query", 4096, 1); /* Fill the buffer with zeroes. This is probably superfluous. */ - drm_intel_bo_map(brw->query.bo, true); - memset((char *)brw->query.bo->virtual, 0, 4096); - drm_intel_bo_unmap(brw->query.bo); + drm_intel_bo_map(query->bo, true); + memset((char *) query->bo->virtual, 0, 4096); + drm_intel_bo_unmap(query->bo); query->last_index = 0; - query->bo = brw->query.bo; } - write_depth_count(intel, brw->query.bo, query->last_index * 2); + write_depth_count(intel, query->bo, query->last_index * 2); brw->query.begin_emitted = true; } @@ -574,7 +566,7 @@ brw_emit_query_end(struct brw_context *brw) if (!brw->query.begin_emitted) return; - write_depth_count(intel, brw->query.bo, query->last_index * 2 + 1); + write_depth_count(intel, query->bo, query->last_index * 2 + 1); brw->query.begin_emitted = false; query->last_index++; |