From f70f79f6f6027bdf2f7de09bb39e12a24420f338 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 16 Sep 2010 20:22:09 +1000 Subject: r600g: attempt to abstract kernel bos from pipe driver. introduce an abstraction layer between kernel bos and the winsys BOs. this is to allow plugging in pb manager with minimal disruption to pipe driver. --- src/gallium/drivers/r600/r600_query.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/gallium/drivers/r600/r600_query.c') diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 68358f9..922d7ac 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -39,7 +39,7 @@ static void r600_query_begin(struct r600_context *rctx, struct r600_query *rquer radeon_state_fini(rstate); radeon_state_init(rstate, rscreen->rw, R600_STATE_QUERY_BEGIN, 0, 0); rstate->states[R600_QUERY__OFFSET] = rquery->num_results; - rstate->bo[0] = radeon_bo_incref(rscreen->rw, rquery->buffer); + radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rquery->buffer); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; if (radeon_state_pm4(rstate)) { @@ -55,7 +55,7 @@ static void r600_query_end(struct r600_context *rctx, struct r600_query *rquery) radeon_state_fini(rstate); radeon_state_init(rstate, rscreen->rw, R600_STATE_QUERY_END, 0, 0); rstate->states[R600_QUERY__OFFSET] = rquery->num_results + 8; - rstate->bo[0] = radeon_bo_incref(rscreen->rw, rquery->buffer); + radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rquery->buffer); rstate->nbo = 1; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; if (radeon_state_pm4(rstate)) { @@ -79,7 +79,7 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q q->type = query_type; q->buffer_size = 4096; - q->buffer = radeon_bo(rscreen->rw, 0, q->buffer_size, 1, NULL); + q->buffer = radeon_ws_bo(rscreen->rw, q->buffer_size, 1); if (!q->buffer) { FREE(q); return NULL; @@ -96,7 +96,7 @@ static void r600_destroy_query(struct pipe_context *ctx, struct r600_screen *rscreen = r600_screen(ctx->screen); struct r600_query *q = r600_query(query); - radeon_bo_decref(rscreen->rw, q->buffer); + radeon_ws_bo_reference(rscreen->rw, &q->buffer, NULL); LIST_DEL(&q->list); FREE(query); } @@ -108,9 +108,8 @@ static void r600_query_result(struct pipe_context *ctx, struct r600_query *rquer u32 *results; int i; - radeon_bo_wait(rscreen->rw, rquery->buffer); - radeon_bo_map(rscreen->rw, rquery->buffer); - results = rquery->buffer->data; + radeon_ws_bo_wait(rscreen->rw, rquery->buffer); + results = radeon_ws_bo_map(rscreen->rw, rquery->buffer); for (i = 0; i < rquery->num_results; i += 4) { start = (u64)results[i] | (u64)results[i + 1] << 32; end = (u64)results[i + 2] | (u64)results[i + 3] << 32; @@ -118,7 +117,7 @@ static void r600_query_result(struct pipe_context *ctx, struct r600_query *rquer rquery->result += end - start; } } - radeon_bo_unmap(rscreen->rw, rquery->buffer); + radeon_ws_bo_unmap(rscreen->rw, rquery->buffer); rquery->num_results = 0; } -- cgit v1.1