anv: Delete wrapper BOs for relocations

These were only used in the non-softpin case.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18208>
This commit is contained in:
Kenneth Graunke
2022-08-30 16:12:57 -07:00
committed by Marge Bot
parent 7b7381e8d7
commit 3fd4a294f5
3 changed files with 6 additions and 38 deletions

View File

@@ -1564,7 +1564,7 @@ anv_device_map_bo(struct anv_device *device,
uint32_t gem_flags,
void **map_out)
{
assert(!bo->is_wrapper && !bo->from_host_ptr);
assert(!bo->from_host_ptr);
assert(size > 0);
void *map = anv_gem_mmap(device, bo->gem_handle, offset, size, gem_flags);
@@ -1584,7 +1584,7 @@ anv_device_unmap_bo(struct anv_device *device,
struct anv_bo *bo,
void *map, size_t map_size)
{
assert(!bo->is_wrapper && !bo->from_host_ptr);
assert(!bo->from_host_ptr);
anv_gem_munmap(device, map, map_size);
}

View File

@@ -183,8 +183,6 @@ anv_reloc_list_add_bo(struct anv_reloc_list *list,
const VkAllocationCallbacks *alloc,
struct anv_bo *target_bo)
{
assert(!target_bo->is_wrapper);
uint32_t idx = target_bo->gem_handle;
VkResult result = anv_reloc_list_grow_deps(list, alloc,
(idx / BITSET_WORDBITS) + 1);
@@ -1140,8 +1138,6 @@ anv_execbuf_add_bo(struct anv_device *device,
{
struct drm_i915_gem_exec_object2 *obj = NULL;
bo = anv_bo_unwrap(bo);
if (bo->exec_obj_index < exec->bo_count &&
exec->bos[bo->exec_obj_index] == bo)
obj = &exec->objects[bo->exec_obj_index];
@@ -1262,8 +1258,7 @@ anv_cmd_buffer_process_relocs(struct anv_cmd_buffer *cmd_buffer,
struct anv_reloc_list *list)
{
for (size_t i = 0; i < list->num_relocs; i++) {
list->relocs[i].target_handle =
anv_bo_unwrap(list->reloc_bos[i])->exec_obj_index;
list->relocs[i].target_handle = list->reloc_bos[i]->exec_obj_index;
}
}
@@ -1273,10 +1268,8 @@ anv_reloc_list_apply(struct anv_device *device,
struct anv_bo *bo,
bool always_relocate)
{
bo = anv_bo_unwrap(bo);
for (size_t i = 0; i < list->num_relocs; i++) {
struct anv_bo *target_bo = anv_bo_unwrap(list->reloc_bos[i]);
struct anv_bo *target_bo = list->reloc_bos[i];
if (list->relocs[i].presumed_offset == target_bo->offset &&
!always_relocate)
continue;
@@ -1344,7 +1337,6 @@ execbuf_can_skip_relocations(struct anv_execbuf *exec)
* Invalid offsets are indicated by anv_bo::offset == (uint64_t)-1.
*/
for (uint32_t i = 0; i < exec->bo_count; i++) {
assert(!exec->bos[i]->is_wrapper);
if (exec->bos[i]->offset == (uint64_t)-1)
return false;
}
@@ -1362,7 +1354,7 @@ relocate_cmd_buffer(struct anv_cmd_buffer *cmd_buffer,
* given time. The only option is to always relocate them.
*/
struct anv_bo *surface_state_bo =
anv_bo_unwrap(cmd_buffer->device->surface_state_pool.block_pool.bo);
cmd_buffer->device->surface_state_pool.block_pool.bo;
anv_reloc_list_apply(cmd_buffer->device, &cmd_buffer->surface_relocs,
surface_state_bo,
true /* always relocate surface states */);

View File

@@ -494,7 +494,7 @@ struct anv_bo {
/* Map for internally mapped BOs.
*
* If ANV_BO_ALLOC_MAPPED is set in flags, this is the map for the whole
* BO. If ANV_BO_WRAPPER is set in flags, map points to the wrapped BO.
* BO.
*/
void *map;
@@ -528,15 +528,6 @@ struct anv_bo {
/** True if this BO may be shared with other processes */
bool is_external:1;
/** True if this BO is a wrapper
*
* When set to true, none of the fields in this BO are meaningful except
* for anv_bo::is_wrapper and anv_bo::map which points to the actual BO.
* See also anv_bo_unwrap(). Wrapper BOs are not allowed when use_softpin
* is set in the physical device.
*/
bool is_wrapper:1;
/** See also ANV_BO_ALLOC_FIXED_ADDRESS */
bool has_fixed_address:1;
@@ -557,14 +548,6 @@ anv_bo_ref(struct anv_bo *bo)
return bo;
}
static inline struct anv_bo *
anv_bo_unwrap(struct anv_bo *bo)
{
while (bo->is_wrapper)
bo = bo->map;
return bo;
}
struct anv_address {
struct anv_bo *bo;
int64_t offset;
@@ -646,13 +629,6 @@ struct anv_block_pool {
struct anv_device *device;
/* Wrapper BO for use in relocation lists. This BO is simply a wrapper
* around the actual BO so that we grow the pool after the wrapper BO has
* been put in a relocation list. This is only used in the non-softpin
* case.
*/
struct anv_bo wrapper_bo;
struct anv_bo *bos[ANV_MAX_BLOCK_POOL_BOS];
struct anv_bo *bo;
uint32_t nbos;