r600g/radeonsi: Silence warnings
authorMaxence Le Dore <maxence.ledore@gmail.com>
Thu, 13 Dec 2012 04:17:35 +0000 (05:17 +0100)
committerTom Stellard <thomas.stellard@amd.com>
Thu, 13 Dec 2012 19:40:28 +0000 (19:40 +0000)
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
src/gallium/drivers/r600/compute_memory_pool.c
src/gallium/drivers/r600/evergreen_compute.c
src/gallium/drivers/r600/evergreen_compute_internal.c
src/gallium/drivers/r600/r600_shader.c
src/gallium/drivers/radeonsi/radeonsi_pipe.c

index 46bff3221d9ff8c63fffb829497bb30a4913cc13..5b1cb1b7930c5954ebd6258a01bfcd8ecf5ac04a 100644 (file)
@@ -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);
index 44831a76188d6b8596b0bf15ac4dbac6e7777239..66b0cc6d92c137d856ce167aaa2fa91a4a30beff 100644 (file)
@@ -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");
 
index cbf662285185da072a51aa98d0a9ba18148ce186..f7aebf22374356dfca2e382b2b791b359f3443f5 100644 (file)
@@ -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;
 }
index 102d1c61118fe2e8b8f7ff963bd7efa303994afa..f0072046e28d1386b65b55ac3b93416792ea720e 100644 (file)
@@ -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
index fa16f4c5dde9ac026b604cbb2b25f09ccf0922b5..69df8a909e668924fb3d5dd0e9da6538a6d71463 100644 (file)
@@ -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. */