Module: Mesa
Branch: master
Commit: 53db2790c06faa9dd58465b79065f97bc8e0cb62
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=53db2790c06faa9dd58465b79065f97bc8e0cb62

Author: Marek Olšák <marek.ol...@amd.com>
Date:   Thu Feb 22 17:13:51 2018 +0100

radeonsi: add/update assertions for 32-bit address space

---

 src/gallium/drivers/radeon/r600_buffer_common.c | 15 +++++++++++++--
 src/gallium/drivers/radeonsi/si_descriptors.c   |  6 +++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index 2d64eed1c1..2106b9b3a5 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -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);
 
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index b71815fac5..07d1420d8e 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -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);
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to