From: Marek Olšák Date: Fri, 27 Jan 2017 00:42:41 +0000 (+0100) Subject: gallium/radeon: remove the internal u_upload_mgr pointer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2ca3548eb926e0c89a3ef72bb07dedf85d3c250a;p=mesa.git gallium/radeon: remove the internal u_upload_mgr pointer also remove the BIND flags Reviewed-by: Nicolai Hähnle Tested-by: Edmondo Tommasina Tested-by: Charmaine Lee --- diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index c8502e90ea9..9ff2364d875 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -1093,10 +1093,13 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint tmpPtr[i] = util_cpu_to_le32(((uint32_t *)ptr)[i]); } - u_upload_data(rctx->b.uploader, 0, size, 256, tmpPtr, &cb->buffer_offset, &cb->buffer); + u_upload_data(ctx->stream_uploader, 0, size, 256, + tmpPtr, &cb->buffer_offset, &cb->buffer); free(tmpPtr); } else { - u_upload_data(rctx->b.uploader, 0, input->buffer_size, 256, ptr, &cb->buffer_offset, &cb->buffer); + u_upload_data(ctx->stream_uploader, 0, + input->buffer_size, 256, ptr, + &cb->buffer_offset, &cb->buffer); } /* account it in gtt */ rctx->b.gtt += input->buffer_size; @@ -1736,8 +1739,8 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info } } - u_upload_alloc(rctx->b.uploader, start, count * 2, 256, - &out_offset, &out_buffer, &ptr); + u_upload_alloc(ctx->stream_uploader, start, count * 2, + 256, &out_offset, &out_buffer, &ptr); util_shorten_ubyte_elts_to_userptr( &rctx->b.b, &ib, 0, ib.offset + start, count, ptr); @@ -1757,7 +1760,8 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info if (ib.user_buffer && (R600_BIG_ENDIAN || info.indirect || info.instance_count > 1 || info.count*ib.index_size > 20)) { - u_upload_data(rctx->b.uploader, 0, info.count * ib.index_size, 256, + u_upload_data(ctx->stream_uploader, 0, + info.count * ib.index_size, 256, ib.user_buffer, &ib.offset, &ib.buffer); ib.user_buffer = NULL; } diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c index 86163b8c90f..9e5a8a6dff8 100644 --- a/src/gallium/drivers/radeon/r600_buffer_common.c +++ b/src/gallium/drivers/radeon/r600_buffer_common.c @@ -367,8 +367,10 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx, unsigned offset; struct r600_resource *staging = NULL; - u_upload_alloc(rctx->uploader, 0, box->width + (box->x % R600_MAP_BUFFER_ALIGNMENT), - 256, &offset, (struct pipe_resource**)&staging, (void**)&data); + u_upload_alloc(ctx->stream_uploader, 0, + box->width + (box->x % R600_MAP_BUFFER_ALIGNMENT), + 256, &offset, (struct pipe_resource**)&staging, + (void**)&data); if (staging) { data += box->x % R600_MAP_BUFFER_ALIGNMENT; diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 732f5c348c1..53d3dc6935d 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -193,7 +193,8 @@ void r600_draw_rectangle(struct blitter_context *blitter, /* Upload vertices. The hw rectangle has only 3 vertices, * I guess the 4th one is derived from the first 3. * The vertex specification should match u_blitter's vertex element state. */ - u_upload_alloc(rctx->uploader, 0, sizeof(float) * 24, 256, &offset, &buf, (void**)&vb); + u_upload_alloc(rctx->b.stream_uploader, 0, sizeof(float) * 24, 256, + &offset, &buf, (void**)&vb); if (!buf) return; @@ -601,13 +602,11 @@ bool r600_common_context_init(struct r600_common_context *rctx, if (!rctx->allocator_zeroed_memory) return false; - rctx->uploader = u_upload_create(&rctx->b, 1024 * 1024, - PIPE_BIND_INDEX_BUFFER | - PIPE_BIND_CONSTANT_BUFFER, PIPE_USAGE_STREAM); - if (!rctx->uploader) + rctx->b.stream_uploader = u_upload_create(&rctx->b, 1024 * 1024, + 0, PIPE_USAGE_STREAM); + if (!rctx->b.stream_uploader) return false; - rctx->b.stream_uploader = rctx->uploader; - rctx->b.const_uploader = rctx->uploader; + rctx->b.const_uploader = rctx->b.stream_uploader; rctx->ctx = rctx->ws->ctx_create(rctx->ws); if (!rctx->ctx) @@ -649,8 +648,8 @@ void r600_common_context_cleanup(struct r600_common_context *rctx) if (rctx->ctx) rctx->ws->ctx_destroy(rctx->ctx); - if (rctx->uploader) { - u_upload_destroy(rctx->uploader); + if (rctx->b.stream_uploader) { + u_upload_destroy(rctx->b.stream_uploader); } slab_destroy_child(&rctx->pool_transfers); diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index 6eff9aaf095..a01351c93bc 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -567,7 +567,6 @@ struct r600_common_context { unsigned last_dirty_tex_counter; unsigned last_compressed_colortex_counter; - struct u_upload_mgr *uploader; struct u_suballocator *allocator_zeroed_memory; struct slab_child_pool pool_transfers; diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index d05c488f38c..aae651c4f62 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -503,9 +503,9 @@ static void si_setup_user_sgprs_co_v2(struct si_context *sctx, dispatch.kernarg_address = kernel_args_va; - u_upload_data(sctx->b.uploader, 0, sizeof(dispatch), 256, - &dispatch, &dispatch_offset, - (struct pipe_resource**)&dispatch_buf); + u_upload_data(sctx->b.b.stream_uploader, 0, sizeof(dispatch), + 256, &dispatch, &dispatch_offset, + (struct pipe_resource**)&dispatch_buf); if (!dispatch_buf) { fprintf(stderr, "Error: Failed to allocate dispatch " @@ -565,7 +565,7 @@ static void si_upload_compute_input(struct si_context *sctx, /* The extra num_work_size_bytes are for work group / work item size information */ kernel_args_size = program->input_size + num_work_size_bytes; - u_upload_alloc(sctx->b.uploader, 0, kernel_args_size, 256, + u_upload_alloc(sctx->b.b.stream_uploader, 0, kernel_args_size, 256, &kernel_args_offset, (struct pipe_resource**)&input_buffer, &kernel_args_ptr); diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index b0faf421a44..3c981761dc5 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -234,7 +234,7 @@ static bool si_upload_descriptors(struct si_context *sctx, } else { void *ptr; - u_upload_alloc(sctx->b.uploader, 0, list_size, 256, + u_upload_alloc(sctx->b.b.stream_uploader, 0, list_size, 256, &desc->buffer_offset, (struct pipe_resource**)&desc->buffer, &ptr); if (!desc->buffer) @@ -961,7 +961,8 @@ bool si_upload_vertex_buffer_descriptors(struct si_context *sctx) * directly through a staging buffer and don't go through * the fine-grained upload path. */ - u_upload_alloc(sctx->b.uploader, 0, velems->desc_list_byte_size, 256, + u_upload_alloc(sctx->b.b.stream_uploader, 0, + velems->desc_list_byte_size, 256, &desc->buffer_offset, (struct pipe_resource**)&desc->buffer, (void**)&ptr); if (!desc->buffer) @@ -1068,7 +1069,7 @@ void si_upload_const_buffer(struct si_context *sctx, struct r600_resource **rbuf { void *tmp; - u_upload_alloc(sctx->b.uploader, 0, size, 256, const_offset, + u_upload_alloc(sctx->b.b.stream_uploader, 0, size, 256, const_offset, (struct pipe_resource**)rbuffer, &tmp); if (*rbuffer) util_memcpy_cpu_to_le32(tmp, ptr, size); diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index 643ff745173..d4533093e46 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -1054,7 +1054,8 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) si_get_draw_start_count(sctx, info, &start, &count); start_offset = start * ib.index_size; - u_upload_alloc(sctx->b.uploader, start_offset, count * 2, 256, + u_upload_alloc(ctx->stream_uploader, start_offset, + count * 2, 256, &out_offset, &out_buffer, &ptr); if (!out_buffer) { pipe_resource_reference(&ib.buffer, NULL); @@ -1077,7 +1078,8 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) si_get_draw_start_count(sctx, info, &start, &count); start_offset = start * ib.index_size; - u_upload_data(sctx->b.uploader, start_offset, count * ib.index_size, + u_upload_data(ctx->stream_uploader, start_offset, + count * ib.index_size, 256, (char*)ib.user_buffer + start_offset, &ib.offset, &ib.buffer); if (!ib.buffer)