diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index c33bc635f32..9a4969f6d9c 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -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) { };