anv: order data in wa_bo to leave wa_addr last

We want to make sure the workaround_address is the last item in the BO
so that we don't have to care about the size of the writes going
there, we'll be sure they won't overwrite other items in that BO.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 7b9400b7f7 ("intel/blorp: Don't use clear color conversion on gfx12")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11775
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30844>
This commit is contained in:
Lionel Landwerlin 2024-08-26 09:44:31 +03:00 committed by Marge Bot
parent d8ec8acede
commit 6336e0fe7f
2 changed files with 33 additions and 6 deletions

View file

@ -707,20 +707,40 @@ VkResult anv_CreateDevice(
device->isl_dev.dummy_aux_address = device->dummy_aux_bo->offset;
}
device->workaround_address = (struct anv_address) {
struct anv_address wa_addr = (struct anv_address) {
.bo = device->workaround_bo,
.offset = align(intel_debug_write_identifiers(device->workaround_bo->map,
device->workaround_bo->size,
"Anv"), 32),
};
device->workarounds.doom64_images = NULL;
wa_addr = anv_address_add_aligned(wa_addr,
intel_debug_write_identifiers(
device->workaround_bo->map,
device->workaround_bo->size,
"Anv"), 32);
device->rt_uuid_addr = anv_address_add(device->workaround_address, 8);
device->rt_uuid_addr = wa_addr;
memcpy(device->rt_uuid_addr.bo->map + device->rt_uuid_addr.offset,
physical_device->rt_uuid,
sizeof(physical_device->rt_uuid));
/* Make sure the workaround address is the last one in the workaround BO,
* so that writes never overwrite other bits of data stored in the
* workaround BO.
*/
wa_addr = anv_address_add_aligned(device->workaround_address,
sizeof(physical_device->rt_uuid), 64);
device->workaround_address = wa_addr;
/* Make sure we don't over the allocated BO. */
assert(device->workaround_address.offset < device->workaround_bo->size);
/* We also need 64B (maximum GRF size) from the workaround address (see
* TBIMR workaround)
*/
assert((device->workaround_bo->size -
device->workaround_address.offset) >= 64);
device->workarounds.doom64_images = NULL;
device->debug_frame_desc =
intel_debug_get_identifier_block(device->workaround_bo->map,
device->workaround_bo->size,

View file

@ -596,6 +596,13 @@ anv_address_add(struct anv_address addr, uint64_t offset)
return addr;
}
static inline struct anv_address
anv_address_add_aligned(struct anv_address addr, uint64_t offset, uint32_t alignment)
{
addr.offset = align(addr.offset + offset, alignment);
return addr;
}
static inline void *
anv_address_map(struct anv_address addr)
{