anv: Use anv_block_pool_foreach_bo in get_bo_from_pool

While we're at it, use gen_48b_address().

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
Jason Ekstrand 2019-10-25 16:42:47 -05:00
parent 3178e583c8
commit 1be2e4c0ef

View file

@ -2334,14 +2334,13 @@ get_bo_from_pool(struct gen_batch_decode_bo *ret,
struct anv_block_pool *pool,
uint64_t address)
{
for (uint32_t i = 0; i < pool->nbos; i++) {
uint64_t bo_address = pool->bos[i].offset & (~0ull >> 16);
uint32_t bo_size = pool->bos[i].size;
if (address >= bo_address && address < (bo_address + bo_size)) {
anv_block_pool_foreach_bo(bo, pool) {
uint64_t bo_address = gen_48b_address(bo->offset);
if (address >= bo_address && address < (bo_address + bo->size)) {
*ret = (struct gen_batch_decode_bo) {
.addr = bo_address,
.size = bo_size,
.map = pool->bos[i].map,
.size = bo->size,
.map = bo->map,
};
return true;
}