diff options
author | Marek Olšák <[email protected]> | 2012-04-26 12:02:31 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-04-29 14:46:52 +0200 |
commit | 0a6120244e66494db070ce875c0a464fbc5b15a1 (patch) | |
tree | 400b5129e5ae2edbca42039224ee27a22c835816 /src/gallium/drivers/radeonsi | |
parent | 8e90913e9f99ff3296a3c3da36e73cd2d4730269 (diff) |
winsys/radeon: simplify buffer map/unmap functions
The idea is not to use pb_map and pb_unmap wrappers, calling straight
into the winsys.
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r-- | src/gallium/drivers/radeonsi/evergreen_state.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/r600_buffer.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/r600_hw_context.c | 24 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/r600_state_common.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/r600_texture.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/radeonsi_pipe.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/radeonsi_shader.c | 4 |
7 files changed, 35 insertions, 35 deletions
diff --git a/src/gallium/drivers/radeonsi/evergreen_state.c b/src/gallium/drivers/radeonsi/evergreen_state.c index 034a9880ba0..c70b0b24d79 100644 --- a/src/gallium/drivers/radeonsi/evergreen_state.c +++ b/src/gallium/drivers/radeonsi/evergreen_state.c @@ -1306,7 +1306,7 @@ static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned cou bo = (struct r600_resource*) pipe_buffer_create(ctx->screen, PIPE_BIND_CUSTOM, PIPE_USAGE_IMMUTABLE, count * sizeof(resource[0]->state)); - ptr = rctx->ws->buffer_map(bo->buf, rctx->cs, PIPE_TRANSFER_WRITE); + ptr = rctx->ws->buffer_map(bo->cs_buf, rctx->cs, PIPE_TRANSFER_WRITE); for (i = 0; i < count; i++, ptr += sizeof(resource[0]->state)) { pipe_sampler_view_reference( @@ -1322,7 +1322,7 @@ static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned cou memset(ptr, 0, sizeof(resource[0]->state)); } - rctx->ws->buffer_unmap(bo->buf); + rctx->ws->buffer_unmap(bo->cs_buf); for (i = count; i < NUM_TEX_UNITS; i++) { if (rctx->ps_samplers.views[i]) @@ -1357,13 +1357,13 @@ static void evergreen_bind_ps_sampler(struct pipe_context *ctx, unsigned count, bo = (struct r600_resource*) pipe_buffer_create(ctx->screen, PIPE_BIND_CUSTOM, PIPE_USAGE_IMMUTABLE, count * sizeof(rstates[0]->val)); - ptr = rctx->ws->buffer_map(bo->buf, rctx->cs, PIPE_TRANSFER_WRITE); + ptr = rctx->ws->buffer_map(bo->cs_buf, rctx->cs, PIPE_TRANSFER_WRITE); for (i = 0; i < count; i++, ptr += sizeof(rstates[0]->val)) { memcpy(ptr, rstates[i]->val, sizeof(rstates[0]->val)); } - rctx->ws->buffer_unmap(bo->buf); + rctx->ws->buffer_unmap(bo->cs_buf); va = r600_resource_va(ctx->screen, (void *)bo); r600_pipe_state_add_reg(rstate, R_00B038_SPI_SHADER_USER_DATA_PS_2, va, bo, RADEON_USAGE_READ); diff --git a/src/gallium/drivers/radeonsi/r600_buffer.c b/src/gallium/drivers/radeonsi/r600_buffer.c index be2e5ceaf8e..eedf9f5ec26 100644 --- a/src/gallium/drivers/radeonsi/r600_buffer.c +++ b/src/gallium/drivers/radeonsi/r600_buffer.c @@ -79,7 +79,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe, if (rbuffer->b.b.user_ptr) return (uint8_t*)rbuffer->b.b.user_ptr + transfer->box.x; - data = rctx->ws->buffer_map(rbuffer->buf, rctx->cs, transfer->usage); + data = rctx->ws->buffer_map(rbuffer->cs_buf, rctx->cs, transfer->usage); if (!data) return NULL; @@ -95,7 +95,7 @@ static void r600_buffer_transfer_unmap(struct pipe_context *pipe, if (rbuffer->b.b.user_ptr) return; - rctx->ws->buffer_unmap(rbuffer->buf); + rctx->ws->buffer_unmap(rbuffer->cs_buf); } static void r600_buffer_transfer_flush_region(struct pipe_context *pipe, @@ -126,12 +126,12 @@ static void r600_buffer_transfer_inline_write(struct pipe_context *pipe, assert(rbuffer->b.b.user_ptr == NULL); - map = rctx->ws->buffer_map(rbuffer->buf, rctx->cs, + map = rctx->ws->buffer_map(rbuffer->cs_buf, rctx->cs, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE | usage); memcpy(map + box->x, data, box->width); - rctx->ws->buffer_unmap(rbuffer->buf); + rctx->ws->buffer_unmap(rbuffer->cs_buf); } static const struct u_resource_vtbl r600_buffer_vtbl = diff --git a/src/gallium/drivers/radeonsi/r600_hw_context.c b/src/gallium/drivers/radeonsi/r600_hw_context.c index 3fe8f0495fb..2ba77b736a6 100644 --- a/src/gallium/drivers/radeonsi/r600_hw_context.c +++ b/src/gallium/drivers/radeonsi/r600_hw_context.c @@ -72,12 +72,12 @@ void r600_get_backend_mask(struct r600_context *ctx) goto err; /* initialize buffer with zeroes */ - results = ctx->ws->buffer_map(buffer->buf, ctx->cs, PIPE_TRANSFER_WRITE); + results = ctx->ws->buffer_map(buffer->cs_buf, ctx->cs, PIPE_TRANSFER_WRITE); if (results) { uint64_t va = 0; memset(results, 0, ctx->max_db * 4 * 4); - ctx->ws->buffer_unmap(buffer->buf); + ctx->ws->buffer_unmap(buffer->cs_buf); /* emit EVENT_WRITE for ZPASS_DONE */ va = r600_resource_va(&ctx->screen->screen, (void *)buffer); @@ -90,14 +90,14 @@ void r600_get_backend_mask(struct r600_context *ctx) cs->buf[cs->cdw++] = r600_context_bo_reloc(ctx, buffer, RADEON_USAGE_WRITE); /* analyze results */ - results = ctx->ws->buffer_map(buffer->buf, ctx->cs, PIPE_TRANSFER_READ); + results = ctx->ws->buffer_map(buffer->cs_buf, ctx->cs, PIPE_TRANSFER_READ); if (results) { for(i = 0; i < ctx->max_db; i++) { /* at least highest bit will be set if backend is used */ if (results[i*4 + 1]) mask |= (1<<i); } - ctx->ws->buffer_unmap(buffer->buf); + ctx->ws->buffer_unmap(buffer->cs_buf); } } @@ -608,7 +608,7 @@ static boolean r600_query_result(struct r600_context *ctx, struct r600_query *qu unsigned results_base = query->results_start; char *map; - map = ctx->ws->buffer_map(query->buffer->buf, ctx->cs, + map = ctx->ws->buffer_map(query->buffer->cs_buf, ctx->cs, PIPE_TRANSFER_READ | (wait ? 0 : PIPE_TRANSFER_DONTBLOCK)); if (!map) @@ -680,7 +680,7 @@ static boolean r600_query_result(struct r600_context *ctx, struct r600_query *qu } query->results_start = query->results_end; - ctx->ws->buffer_unmap(query->buffer->buf); + ctx->ws->buffer_unmap(query->buffer->cs_buf); return TRUE; } @@ -703,7 +703,7 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query) switch (query->type) { case PIPE_QUERY_OCCLUSION_COUNTER: case PIPE_QUERY_OCCLUSION_PREDICATE: - results = ctx->ws->buffer_map(query->buffer->buf, ctx->cs, PIPE_TRANSFER_WRITE); + results = ctx->ws->buffer_map(query->buffer->cs_buf, ctx->cs, PIPE_TRANSFER_WRITE); if (results) { results = (uint32_t*)((char*)results + query->results_end); memset(results, 0, query->result_size); @@ -715,7 +715,7 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query) results[(i * 4)+3] = 0x80000000; } } - ctx->ws->buffer_unmap(query->buffer->buf); + ctx->ws->buffer_unmap(query->buffer->cs_buf); } break; case PIPE_QUERY_TIME_ELAPSED: @@ -724,10 +724,10 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query) case PIPE_QUERY_PRIMITIVES_GENERATED: case PIPE_QUERY_SO_STATISTICS: case PIPE_QUERY_SO_OVERFLOW_PREDICATE: - results = ctx->ws->buffer_map(query->buffer->buf, ctx->cs, PIPE_TRANSFER_WRITE); + results = ctx->ws->buffer_map(query->buffer->cs_buf, ctx->cs, PIPE_TRANSFER_WRITE); results = (uint32_t*)((char*)results + query->results_end); memset(results, 0, query->result_size); - ctx->ws->buffer_unmap(query->buffer->buf); + ctx->ws->buffer_unmap(query->buffer->cs_buf); break; default: assert(0); @@ -1089,9 +1089,9 @@ void r600_context_streamout_end(struct r600_context *ctx) if (!t[i]) continue; - uint32_t *ptr = ctx->ws->buffer_map(t[i]->filled_size->buf, ctx->cs, RADEON_USAGE_READ); + uint32_t *ptr = ctx->ws->buffer_map(t[i]->filled_size->cs_buf, ctx->cs, RADEON_USAGE_READ); printf("FILLED_SIZE%i: %u\n", i, *ptr); - ctx->ws->buffer_unmap(t[i]->filled_size->buf); + ctx->ws->buffer_unmap(t[i]->filled_size->cs_buf); } } diff --git a/src/gallium/drivers/radeonsi/r600_state_common.c b/src/gallium/drivers/radeonsi/r600_state_common.c index b8fcf222544..d283e41e681 100644 --- a/src/gallium/drivers/radeonsi/r600_state_common.c +++ b/src/gallium/drivers/radeonsi/r600_state_common.c @@ -501,9 +501,9 @@ r600_create_so_target(struct pipe_context *ctx, t->filled_size = (struct r600_resource*) pipe_buffer_create(ctx->screen, PIPE_BIND_CUSTOM, PIPE_USAGE_STATIC, 4); - ptr = rctx->ws->buffer_map(t->filled_size->buf, rctx->cs, PIPE_TRANSFER_WRITE); + ptr = rctx->ws->buffer_map(t->filled_size->cs_buf, rctx->cs, PIPE_TRANSFER_WRITE); memset(ptr, 0, t->filled_size->buf->size); - rctx->ws->buffer_unmap(t->filled_size->buf); + rctx->ws->buffer_unmap(t->filled_size->cs_buf); return &t->b; } @@ -570,7 +570,7 @@ static void r600_vertex_buffer_update(struct r600_context *rctx) if (t_list_buffer == NULL) return; - ptr = (uint32_t*)rctx->ws->buffer_map(t_list_buffer->buf, + ptr = (uint32_t*)rctx->ws->buffer_map(t_list_buffer->cs_buf, rctx->cs, PIPE_TRANSFER_WRITE); diff --git a/src/gallium/drivers/radeonsi/r600_texture.c b/src/gallium/drivers/radeonsi/r600_texture.c index a1151fe963d..ab11285de85 100644 --- a/src/gallium/drivers/radeonsi/r600_texture.c +++ b/src/gallium/drivers/radeonsi/r600_texture.c @@ -770,20 +770,20 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, { struct r600_context *rctx = (struct r600_context *)ctx; struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; - struct pb_buffer *buf; + struct radeon_winsys_cs_handle *buf; enum pipe_format format = transfer->resource->format; unsigned offset = 0; char *map; if (rtransfer->staging_texture) { - buf = ((struct r600_resource *)rtransfer->staging_texture)->buf; + buf = ((struct r600_resource *)rtransfer->staging_texture)->cs_buf; } else { struct r600_resource_texture *rtex = (struct r600_resource_texture*)transfer->resource; if (rtex->flushed_depth_texture) - buf = ((struct r600_resource *)rtex->flushed_depth_texture)->buf; + buf = ((struct r600_resource *)rtex->flushed_depth_texture)->cs_buf; else - buf = ((struct r600_resource *)transfer->resource)->buf; + buf = ((struct r600_resource *)transfer->resource)->cs_buf; offset = rtransfer->offset + transfer->box.y / util_format_get_blockheight(format) * transfer->stride + @@ -802,17 +802,17 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx, { struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; struct r600_context *rctx = (struct r600_context*)ctx; - struct pb_buffer *buf; + struct radeon_winsys_cs_handle *buf; if (rtransfer->staging_texture) { - buf = ((struct r600_resource *)rtransfer->staging_texture)->buf; + buf = ((struct r600_resource *)rtransfer->staging_texture)->cs_buf; } else { struct r600_resource_texture *rtex = (struct r600_resource_texture*)transfer->resource; if (rtex->flushed_depth_texture) { - buf = ((struct r600_resource *)rtex->flushed_depth_texture)->buf; + buf = ((struct r600_resource *)rtex->flushed_depth_texture)->cs_buf; } else { - buf = ((struct r600_resource *)transfer->resource)->buf; + buf = ((struct r600_resource *)transfer->resource)->cs_buf; } } rctx->ws->buffer_unmap(buf); diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c b/src/gallium/drivers/radeonsi/radeonsi_pipe.c index e20ba165691..f97db3ac39a 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c +++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c @@ -67,7 +67,7 @@ static struct r600_fence *r600_create_fence(struct r600_context *rctx) R600_ERR("r600: failed to create bo for fence objects\n"); goto out; } - rscreen->fences.data = rctx->ws->buffer_map(rscreen->fences.bo->buf, + rscreen->fences.data = rctx->ws->buffer_map(rscreen->fences.bo->cs_buf, rctx->cs, PIPE_TRANSFER_READ_WRITE); } @@ -516,7 +516,7 @@ static void r600_destroy_screen(struct pipe_screen* pscreen) FREE(entry); } - rscreen->ws->buffer_unmap(rscreen->fences.bo->buf); + rscreen->ws->buffer_unmap(rscreen->fences.bo->cs_buf); pipe_resource_reference((struct pipe_resource**)&rscreen->fences.bo, NULL); } pipe_mutex_destroy(rscreen->fences.mutex); diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c index d24e335c3fa..6425c352d28 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c @@ -545,7 +545,7 @@ int si_pipe_shader_create( if (shader->bo == NULL) { return -ENOMEM; } - ptr = (uint32_t*)rctx->ws->buffer_map(shader->bo->buf, rctx->cs, PIPE_TRANSFER_WRITE); + ptr = (uint32_t*)rctx->ws->buffer_map(shader->bo->cs_buf, rctx->cs, PIPE_TRANSFER_WRITE); if (0 /*R600_BIG_ENDIAN*/) { for (i = 0; i < (inst_byte_count-12)/4; ++i) { ptr[i] = util_bswap32(*(uint32_t*)(inst_bytes+12 + i*4)); @@ -553,7 +553,7 @@ int si_pipe_shader_create( } else { memcpy(ptr, inst_bytes + 12, inst_byte_count - 12); } - rctx->ws->buffer_unmap(shader->bo->buf); + rctx->ws->buffer_unmap(shader->bo->cs_buf); } free(inst_bytes); |