From: Marek Olšák Date: Thu, 22 Feb 2018 16:13:51 +0000 (+0100) Subject: radeonsi: add/update assertions for 32-bit address space X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=53db2790c06faa9dd58465b79065f97bc8e0cb62;p=mesa.git radeonsi: add/update assertions for 32-bit address space --- diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c index 2d64eed1c10..2106b9b3a5e 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 b71815fac5c..07d1420d8ee 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); }