gallium/radeon: remove the internal u_upload_mgr pointer
authorMarek Olšák <marek.olsak@amd.com>
Fri, 27 Jan 2017 00:42:41 +0000 (01:42 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 14 Feb 2017 20:46:16 +0000 (21:46 +0100)
also remove the BIND flags

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Tested-by: Charmaine Lee <charmainel@vmware.com>
src/gallium/drivers/r600/r600_state_common.c
src/gallium/drivers/radeon/r600_buffer_common.c
src/gallium/drivers/radeon/r600_pipe_common.c
src/gallium/drivers/radeon/r600_pipe_common.h
src/gallium/drivers/radeonsi/si_compute.c
src/gallium/drivers/radeonsi/si_descriptors.c
src/gallium/drivers/radeonsi/si_state_draw.c

index c8502e90ea9ab020a27ac2ce5dc11606b25fcc15..9ff2364d875691c179899135a8bae3486c278d04 100644 (file)
@@ -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;
                }
index 86163b8c90f6b941ac0b6280a967847c88431a0e..9e5a8a6dff88dadc9c45713b475e2e1a9a1a86f0 100644 (file)
@@ -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;
index 732f5c348c1a632d7b4a5d5947cbba1806016ee2..53d3dc6935d3f593356da0f2480bc79641f81cdf 100644 (file)
@@ -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);
index 6eff9aaf0951e56d1ef0e6aae7fe84c78f96b835..a01351c93bc1c21675b79e4fd82b162b1fde9e2b 100644 (file)
@@ -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;
 
index d05c488f38ce16cabc56f6a2fdb2173c3482505d..aae651c4f625b086386a8dbdf1c7e13c207e130d 100644 (file)
@@ -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);
 
index b0faf421a44c9bd80c9733dbaadae4d1bfa3c4c2..3c981761dc51ab279193d29c96207c9ba295094b 100644 (file)
@@ -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);
index 643ff7451735871b28d9c423a411b074e06dd278..d4533093e46b40debe6c7065c6f2f2d8d8d9ee08 100644 (file)
@@ -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)