radeonsi: fix printing vertex buffer descriptors into ddebug reports
authorMarek Olšák <marek.olsak@amd.com>
Sun, 30 Jul 2017 23:31:19 +0000 (01:31 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 1 Aug 2017 15:06:38 +0000 (17:06 +0200)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_debug.c
src/gallium/drivers/radeonsi/si_descriptors.c

index 06dea61e3c9cf13e21c1d15a23720bf607d6f36d..7c8a0fed99edaaca6af47a6267f47db5a8ae2a58 100644 (file)
@@ -392,6 +392,9 @@ static void si_dump_descriptor_list(struct si_descriptors *desc,
 {
        unsigned i, j;
 
+       if (!desc->list)
+               return;
+
        for (i = 0; i < num_elements; i++) {
                unsigned dw_offset = slot_remap(i) * element_dw_size;
                uint32_t *gpu_ptr = desc->gpu_list ? desc->gpu_list : desc->list;
index b080562348c540a7be8eaa88af9aa09befa5ccf4..26a8d815183d24be1b7136d94664faf9e9c79bfe 100644 (file)
@@ -1101,6 +1101,7 @@ bool si_upload_vertex_buffer_descriptors(struct si_context *sctx)
        if (!desc->buffer)
                return false;
 
+       desc->list = ptr;
        radeon_add_to_buffer_list(&sctx->b, &sctx->b.gfx,
                              desc->buffer, RADEON_USAGE_READ,
                              RADEON_PRIO_DESCRIPTORS);
@@ -2834,6 +2835,8 @@ void si_init_all_descriptors(struct si_context *sctx)
 
        si_init_descriptors(sctx, &sctx->vertex_buffers, SI_SGPR_VERTEX_BUFFERS,
                            4, SI_NUM_VERTEX_BUFFERS, 0, 0, NULL);
+       FREE(sctx->vertex_buffers.list); /* not used */
+       sctx->vertex_buffers.list = NULL;
 
        sctx->descriptors_dirty = u_bit_consecutive(0, SI_NUM_DESCS);
        sctx->total_ce_ram_allocated = ce_offset;
@@ -2947,6 +2950,8 @@ void si_release_all_descriptors(struct si_context *sctx)
 
        for (i = 0; i < SI_NUM_DESCS; ++i)
                si_release_descriptors(&sctx->descriptors[i]);
+
+       sctx->vertex_buffers.list = NULL; /* points into a mapped buffer */
        si_release_descriptors(&sctx->vertex_buffers);
 }