radeonsi: add/update assertions for 32-bit address space
authorMarek Olšák <marek.olsak@amd.com>
Thu, 22 Feb 2018 16:13:51 +0000 (17:13 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 7 Mar 2018 18:55:47 +0000 (13:55 -0500)
src/gallium/drivers/radeon/r600_buffer_common.c
src/gallium/drivers/radeonsi/si_descriptors.c

index 2d64eed1c10ad41518e7df44064db16af7df38bd..2106b9b3a5ef964aebc0fb4e38bf63123d6bcbe6 100644 (file)
@@ -218,10 +218,21 @@ bool si_alloc_resource(struct si_screen *sscreen,
        old_buf = res->buf;
        res->buf = new_buf; /* should be atomic */
 
-       if (sscreen->info.has_virtual_memory)
+       if (sscreen->info.has_virtual_memory) {
                res->gpu_address = sscreen->ws->buffer_get_virtual_address(res->buf);
-       else
+
+               if (res->flags & RADEON_FLAG_32BIT) {
+                       uint64_t start = res->gpu_address;
+                       uint64_t last = start + res->bo_size - 1;
+                       (void)start;
+                       (void)last;
+
+                       assert((start >> 32) == sscreen->info.address32_hi);
+                       assert((last >> 32) == sscreen->info.address32_hi);
+               }
+       } else {
                res->gpu_address = 0;
+       }
 
        pb_reference(&old_buf, NULL);
 
index b71815fac5c6bcea97c59dbbdb14523215a7d37c..07d1420d8eedf413f57162873bcd310258150ed9 100644 (file)
@@ -188,6 +188,10 @@ static bool si_upload_descriptors(struct si_context *sctx,
        buffer_offset -= first_slot_offset;
        desc->gpu_address = desc->buffer->gpu_address + buffer_offset;
 
+       assert(desc->buffer->flags & RADEON_FLAG_32BIT);
+       assert((desc->buffer->gpu_address >> 32) == sctx->screen->info.address32_hi);
+       assert((desc->gpu_address >> 32) == sctx->screen->info.address32_hi);
+
        si_mark_atom_dirty(sctx, &sctx->shader_pointers.atom);
        return true;
 }
@@ -2016,7 +2020,7 @@ static void si_emit_shader_pointer_body(struct si_screen *sscreen,
        radeon_emit(cs, va);
 
        if (HAVE_32BIT_POINTERS)
-               assert((va >> 32) == sscreen->info.address32_hi);
+               assert(va == 0 || (va >> 32) == sscreen->info.address32_hi);
        else
                radeon_emit(cs, va >> 32);
 }