From 6d7d821e3df7dde45fbd7ae2988eee8e94baa14f Mon Sep 17 00:00:00 2001 From: Maxence Le Dore Date: Thu, 13 Dec 2012 05:17:35 +0100 Subject: [PATCH] r600g/radeonsi: Silence warnings Reviewed-by: Tom Stellard --- .../drivers/r600/compute_memory_pool.c | 12 +++---- src/gallium/drivers/r600/evergreen_compute.c | 27 ++++++++++----- .../drivers/r600/evergreen_compute_internal.c | 33 ++++++++++++------- src/gallium/drivers/r600/r600_shader.c | 5 +-- src/gallium/drivers/radeonsi/radeonsi_pipe.c | 2 ++ 5 files changed, 49 insertions(+), 30 deletions(-) diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c index 46bff3221d9..5b1cb1b7930 100644 --- a/src/gallium/drivers/r600/compute_memory_pool.c +++ b/src/gallium/drivers/r600/compute_memory_pool.c @@ -93,12 +93,12 @@ int64_t compute_memory_prealloc_chunk( struct compute_memory_pool* pool, int64_t size_in_dw) { - assert(size_in_dw <= pool->size_in_dw); - struct compute_memory_item *item; int last_end = 0; + assert(size_in_dw <= pool->size_in_dw); + COMPUTE_DBG("* compute_memory_prealloc_chunk() size_in_dw = %ld\n", size_in_dw); @@ -217,6 +217,8 @@ void compute_memory_finalize_pending(struct compute_memory_pool* pool, int64_t allocated = 0; int64_t unallocated = 0; + int64_t start_in_dw = 0; + COMPUTE_DBG("* compute_memory_finalize_pending()\n"); for (item = pool->item_list; item; item = item->next) { @@ -292,8 +294,6 @@ void compute_memory_finalize_pending(struct compute_memory_pool* pool, for (item = pending_list; item; item = next) { next = item->next; - int64_t start_in_dw; - /* Search for free space in the pool for this item. */ while ((start_in_dw=compute_memory_prealloc_chunk(pool, item->size_in_dw)) == -1) { @@ -397,7 +397,7 @@ struct compute_memory_item* compute_memory_alloc( struct compute_memory_pool* pool, int64_t size_in_dw) { - struct compute_memory_item *new_item; + struct compute_memory_item *new_item = NULL, *last_item = NULL; COMPUTE_DBG("* compute_memory_alloc() size_in_dw = %ld (%ld bytes)\n", size_in_dw, 4 * size_in_dw); @@ -409,8 +409,6 @@ struct compute_memory_item* compute_memory_alloc( new_item->id = pool->next_id++; new_item->pool = pool; - struct compute_memory_item *last_item; - if (pool->item_list) { for (last_item = pool->item_list; last_item->next; last_item = last_item->next); diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index 44831a76188..66b0cc6d92c 100644 --- a/src/gallium/drivers/r600/evergreen_compute.c +++ b/src/gallium/drivers/r600/evergreen_compute.c @@ -804,15 +804,19 @@ struct pipe_resource *r600_compute_global_buffer_create( struct pipe_screen *screen, const struct pipe_resource *templ) { + struct r600_resource_global* result = NULL; + struct r600_screen* rscreen = NULL; + int size_in_dw = 0; + assert(templ->target == PIPE_BUFFER); assert(templ->bind & PIPE_BIND_GLOBAL); assert(templ->array_size == 1 || templ->array_size == 0); assert(templ->depth0 == 1 || templ->depth0 == 0); assert(templ->height0 == 1 || templ->height0 == 0); - struct r600_resource_global* result = (struct r600_resource_global*) - CALLOC(sizeof(struct r600_resource_global), 1); - struct r600_screen* rscreen = (struct r600_screen*)screen; + result = (struct r600_resource_global*) + CALLOC(sizeof(struct r600_resource_global), 1); + rscreen = (struct r600_screen*)screen; COMPUTE_DBG("*** r600_compute_global_buffer_create\n"); COMPUTE_DBG("width = %u array_size = %u\n", templ->width0, @@ -823,7 +827,7 @@ struct pipe_resource *r600_compute_global_buffer_create( result->base.b.b = *templ; pipe_reference_init(&result->base.b.b.reference, 1); - int size_in_dw = (templ->width0+3) / 4; + size_in_dw = (templ->width0+3) / 4; result->chunk = compute_memory_alloc(rscreen->global_pool, size_in_dw); @@ -840,11 +844,14 @@ void r600_compute_global_buffer_destroy( struct pipe_screen *screen, struct pipe_resource *res) { + struct r600_resource_global* buffer = NULL; + struct r600_screen* rscreen = NULL; + assert(res->target == PIPE_BUFFER); assert(res->bind & PIPE_BIND_GLOBAL); - struct r600_resource_global* buffer = (struct r600_resource_global*)res; - struct r600_screen* rscreen = (struct r600_screen*)screen; + buffer = (struct r600_resource_global*)res; + rscreen = (struct r600_screen*)screen; compute_memory_free(rscreen->global_pool, buffer->chunk->id); @@ -911,12 +918,14 @@ void r600_compute_global_transfer_unmap( struct pipe_context *ctx_, struct pipe_transfer* transfer) { + struct r600_context *ctx = NULL; + struct r600_resource_global* buffer = NULL; + assert(transfer->resource->target == PIPE_BUFFER); assert(transfer->resource->bind & PIPE_BIND_GLOBAL); - struct r600_context *ctx = (struct r600_context *)ctx_; - struct r600_resource_global* buffer = - (struct r600_resource_global*)transfer->resource; + ctx = (struct r600_context *)ctx_; + buffer = (struct r600_resource_global*)transfer->resource; COMPUTE_DBG("* r600_compute_global_transfer_unmap()\n"); diff --git a/src/gallium/drivers/r600/evergreen_compute_internal.c b/src/gallium/drivers/r600/evergreen_compute_internal.c index cbf66228518..f7aebf22374 100644 --- a/src/gallium/drivers/r600/evergreen_compute_internal.c +++ b/src/gallium/drivers/r600/evergreen_compute_internal.c @@ -97,6 +97,8 @@ struct evergreen_compute_resource* get_empty_res( { int code_index = -1; int code_size = -1; + int index = 0; + struct evergreen_compute_resource* res = NULL; { int i = 0; @@ -108,9 +110,9 @@ struct evergreen_compute_resource* get_empty_res( assert(code_index != -1 && "internal error: resouce index not found"); assert(offset_index < code_size && "internal error: overindexing resource"); - int index = code_index + offset_index; + index = code_index + offset_index; - struct evergreen_compute_resource* res = &pipe->resources[index]; + res = &pipe->resources[index]; res->enabled = true; res->bo = NULL; @@ -125,8 +127,10 @@ void evergreen_emit_raw_reg_set( unsigned index, int num) { + int cs_end = 0; + res->enabled = 1; - int cs_end = res->cs_end; + cs_end = res->cs_end; if (index >= EVERGREEN_CONFIG_REG_OFFSET && index < EVERGREEN_CONFIG_REG_END) { @@ -213,10 +217,12 @@ void evergreen_emit_ctx_reloc( struct r600_resource *bo, enum radeon_bo_usage usage) { + u32 rr = 0; + assert(bo); ctx->cs->buf[ctx->cs->cdw++] = PKT3(PKT3_NOP, 0, 0); - u32 rr = r600_context_bo_reloc(ctx, bo, usage); + rr = r600_context_bo_reloc(ctx, bo, usage); ctx->cs->buf[ctx->cs->cdw++] = rr; } @@ -260,13 +266,15 @@ void evergreen_set_rat( int start, int size) { + struct pipe_surface rat_templ; + struct r600_surface *surf = NULL; + struct r600_context *rctx = NULL; + assert(id < 12); assert((size & 3) == 0); assert((start & 0xFF) == 0); - struct pipe_surface rat_templ; - struct r600_surface *surf; - struct r600_context *rctx = pipe->ctx; + rctx = pipe->ctx; COMPUTE_DBG("bind rat: %i \n", id); @@ -603,13 +611,14 @@ struct r600_resource* r600_compute_buffer_alloc_vram( struct r600_screen *screen, unsigned size) { + struct pipe_resource * buffer = NULL; assert(size); - struct pipe_resource * buffer = pipe_buffer_create( - (struct pipe_screen*) screen, - PIPE_BIND_CUSTOM, - PIPE_USAGE_IMMUTABLE, - size); + buffer = pipe_buffer_create( + (struct pipe_screen*) screen, + PIPE_BIND_CUSTOM, + PIPE_USAGE_IMMUTABLE, + size); return (struct r600_resource *)buffer; } diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 102d1c61118..f0072046e28 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -516,10 +516,11 @@ static int r600_vtx_from_byte_stream(struct r600_shader_ctx *ctx, static int r600_export_from_byte_stream(struct r600_shader_ctx *ctx, unsigned char * bytes, unsigned bytes_read) { + uint32_t word0 = 0, word1 = 0; struct r600_bytecode_output output; memset(&output, 0, sizeof(struct r600_bytecode_output)); - uint32_t word0 = i32_from_byte_stream(bytes, &bytes_read); - uint32_t word1 = i32_from_byte_stream(bytes, &bytes_read); + word0 = i32_from_byte_stream(bytes, &bytes_read); + word1 = i32_from_byte_stream(bytes, &bytes_read); if (ctx->bc->chip_class >= EVERGREEN) eg_bytecode_export_read(&output, word0,word1); else diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c b/src/gallium/drivers/radeonsi/radeonsi_pipe.c index fa16f4c5dde..69df8a909e6 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c +++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c @@ -349,6 +349,8 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_TEXTURE_MULTISAMPLE: case PIPE_CAP_COMPUTE: case PIPE_CAP_QUERY_TIMESTAMP: + case PIPE_CAP_CUBE_MAP_ARRAY: + case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: return 0; /* Stream output. */ -- 2.30.2