anv: look into batch bo reloc list looking for BOs to decode

On DG2 I ran into a case where the surface state was not being decoded
with INTEL_DEBUG=bat. This is because the surface states are not part
of a state pool there anymore. Instead BO are allocate manually and
placed in vma heap.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 96c33fb027 ("anv: enable direct descriptors on platforms with extended bindless offset")
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23891>
This commit is contained in:
Lionel Landwerlin
2023-06-27 16:54:04 +03:00
committed by Marge Bot
parent 5f7fb0a720
commit a1fda29bd1
+26 -7
View File
@@ -2881,19 +2881,38 @@ decode_get_bo(void *v_batch, bool ppgtt, uint64_t address)
if (!device->cmd_buffer_being_decoded)
return (struct intel_batch_decode_bo) { };
struct anv_batch_bo **bo;
u_vector_foreach(bo, &device->cmd_buffer_being_decoded->seen_bbos) {
struct anv_batch_bo **bbo;
u_vector_foreach(bbo, &device->cmd_buffer_being_decoded->seen_bbos) {
/* The decoder zeroes out the top 16 bits, so we need to as well */
uint64_t bo_address = (*bo)->bo->offset & (~0ull >> 16);
uint64_t bo_address = (*bbo)->bo->offset & (~0ull >> 16);
if (address >= bo_address && address < bo_address + (*bo)->bo->size) {
if (address >= bo_address && address < bo_address + (*bbo)->bo->size) {
return (struct intel_batch_decode_bo) {
.addr = bo_address,
.size = (*bo)->bo->size,
.map = (*bo)->bo->map,
.size = (*bbo)->bo->size,
.map = (*bbo)->bo->map,
};
}
uint32_t dep_words = (*bbo)->relocs.dep_words;
BITSET_WORD *deps = (*bbo)->relocs.deps;
for (uint32_t w = 0; w < dep_words; w++) {
BITSET_WORD mask = deps[w];
while (mask) {
int i = u_bit_scan(&mask);
uint32_t gem_handle = w * BITSET_WORDBITS + i;
struct anv_bo *bo = anv_device_lookup_bo(device, gem_handle);
assert(bo->refcount > 0);
bo_address = bo->offset & (~0ull >> 16);
if (address >= bo_address && address < bo_address + bo->size) {
return (struct intel_batch_decode_bo) {
.addr = bo_address,
.size = bo->size,
.map = bo->map,
};
}
}
}
}
return (struct intel_batch_decode_bo) { };