r600g/compute: Add more debugging output
authorTom Stellard <thomas.stellard@amd.com>
Wed, 11 Jul 2012 17:46:59 +0000 (17:46 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Wed, 11 Jul 2012 17:46:59 +0000 (17:46 +0000)
src/gallium/drivers/r600/compute_memory_pool.c
src/gallium/drivers/r600/evergreen_compute.c

index 0f8bee6e1cd53359e37131af5df7ee00334ce28f..17657f7c51a6c130bfd65f39c2a1a67936b30e6e 100644 (file)
@@ -80,6 +80,9 @@ struct compute_memory_pool* compute_memory_pool_new(
        struct compute_memory_pool* pool = (struct compute_memory_pool*)
                                CALLOC(sizeof(struct compute_memory_pool), 1);
 
+       COMPUTE_DBG("* compute_memory_pool_new() initial_size_in_dw = %ld\n",
+               initial_size_in_dw);
+
        pool->next_id = 1;
        pool->size_in_dw = initial_size_in_dw;
        pool->screen = rscreen;
@@ -95,6 +98,7 @@ struct compute_memory_pool* compute_memory_pool_new(
  */
 void compute_memory_pool_delete(struct compute_memory_pool* pool)
 {
+       COMPUTE_DBG("* compute_memory_pool_delete()\n");
        free(pool->shadow);
        if (pool->bo) {
                pool->screen->screen.resource_destroy((struct pipe_screen *)
@@ -117,6 +121,9 @@ int64_t compute_memory_prealloc_chunk(
 
        int last_end = 0;
 
+       COMPUTE_DBG("* compute_memory_prealloc_chunk() size_in_dw = %ld\n",
+               size_in_dw);
+
        for (item = pool->item_list; item; item = item->next) {
                if (item->start_in_dw > -1) {
                        if (item->start_in_dw-last_end > size_in_dw) {
@@ -144,6 +151,9 @@ struct compute_memory_item* compute_memory_postalloc_chunk(
 {
        struct compute_memory_item* item;
 
+       COMPUTE_DBG("* compute_memory_postalloc_chunck() start_in_dw = %ld\n",
+               start_in_dw);
+
        for (item = pool->item_list; item; item = item->next) {
                if (item->next) {
                        if (item->start_in_dw < start_in_dw
@@ -168,10 +178,15 @@ struct compute_memory_item* compute_memory_postalloc_chunk(
 void compute_memory_grow_pool(struct compute_memory_pool* pool,
        struct pipe_context * pipe, int new_size_in_dw)
 {
+       COMPUTE_DBG("* compute_memory_grow_pool() new_size_in_dw = %d\n",
+               new_size_in_dw);
+
        assert(new_size_in_dw >= pool->size_in_dw);
 
        new_size_in_dw += 1024 - (new_size_in_dw % 1024);
 
+       COMPUTE_DBG("  Aligned size = %d\n", new_size_in_dw);
+
        if (pool->bo) {
                compute_memory_shadow(pool, pipe, 1);
        }
@@ -200,6 +215,9 @@ void compute_memory_shadow(struct compute_memory_pool* pool,
 {
        struct compute_memory_item chunk;
 
+       COMPUTE_DBG("* compute_memory_shadow() device_to_host = %d\n",
+               device_to_host);
+
        chunk.id = 0;
        chunk.start_in_dw = 0;
        chunk.size_in_dw = pool->size_in_dw;
@@ -220,6 +238,8 @@ void compute_memory_finalize_pending(struct compute_memory_pool* pool,
        int64_t allocated = 0;
        int64_t unallocated = 0;
 
+       COMPUTE_DBG("* compute_memory_finalize_pending()\n");
+
        for (item = pool->item_list; item; item = item->next) {
                COMPUTE_DBG("list: %i %p\n", item->start_in_dw, item->next);
        }
@@ -317,6 +337,8 @@ void compute_memory_free(struct compute_memory_pool* pool, int64_t id)
 {
        struct compute_memory_item *item, *next;
 
+       COMPUTE_DBG("* compute_memory_free() id + %ld \n", id);
+
        for (item = pool->item_list; item; item = next) {
                next = item->next;
 
@@ -353,7 +375,7 @@ struct compute_memory_item* compute_memory_alloc(
 {
        struct compute_memory_item *new_item;
 
-       COMPUTE_DBG("Alloc: %i\n", size_in_dw);
+       COMPUTE_DBG("* compute_memory_alloc() size_in_dw = %ld\n", size_in_dw);
 
        new_item = (struct compute_memory_item *)
                                CALLOC(sizeof(struct compute_memory_item), 1);
@@ -399,6 +421,10 @@ void compute_memory_transfer(
 
        assert(gart);
 
+       COMPUTE_DBG("* compute_memory_transfer() device_to_host = %d, "
+               "offset_in_chunk = %d, size = %d\n", device_to_host,
+               offset_in_chunk, size);
+
        if (device_to_host)
        {
                xfer = pipe->get_transfer(pipe, gart, 0, PIPE_TRANSFER_READ,
index 40200ae21de83e4e0a65f9f34693dcabb4e0d608..0d3c9f33651d8e4c99188998034f8fb4aa8e9049 100644 (file)
@@ -106,6 +106,8 @@ void *evergreen_create_compute_state(
        const struct pipe_llvm_program_header * header;
        const unsigned char * code;
 
+       COMPUTE_DBG("*** evergreen_create_compute_state\n");
+
        header = cso->prog;
        code = cso->prog + sizeof(struct pipe_llvm_program_header);
 #endif
@@ -145,6 +147,8 @@ static void evergreen_bind_compute_state(struct pipe_context *ctx_, void *state)
 {
        struct r600_context *ctx = (struct r600_context *)ctx_;
 
+       COMPUTE_DBG("*** evergreen_bind_compute_state\n");
+
        ctx->cs_shader = (struct r600_pipe_compute *)state;
 
        if (!ctx->cs_shader->shader_code_bo) {
@@ -444,6 +448,10 @@ static void evergreen_set_compute_resources(struct pipe_context * ctx_,
 {
        struct r600_context *ctx = (struct r600_context *)ctx_;
        struct r600_surface **resources = (struct r600_surface **)surfaces;
+
+       COMPUTE_DBG("*** evergreen_set_compute_resources: start = %u count = %u\n",
+                       start, count);
+
        for (int i = 0; i < count; i++) {
                if (resources[i]) {
                        struct r600_resource_global *buffer =
@@ -513,6 +521,9 @@ static void evergreen_set_global_binding(
        struct r600_resource_global **buffers =
                (struct r600_resource_global **)resources;
 
+       COMPUTE_DBG("*** evergreen_set_global_binding first = %u n = %u\n",
+                       first, n);
+
        if (!resources) {
                /* XXX: Unset */
                return;
@@ -719,6 +730,10 @@ struct pipe_resource *r600_compute_global_buffer_create(
                CALLOC(sizeof(struct r600_resource_global), 1);
        struct r600_screen* rscreen = (struct r600_screen*)screen;
 
+       COMPUTE_DBG("*** r600_compute_global_buffer_create\n");
+       COMPUTE_DBG("width = %u array_size = %u\n", templ->width0,
+                       templ->array_size);
+
        result->base.b.vtbl = &r600_global_buffer_vtbl;
        result->base.b.b.screen = screen;
        result->base.b.b = *templ;