anv: Nuke ANV_BO_ALLOC_WRITE_COMBINE

In i915 if the device has local memory it can only mmap bo with
I915_MMAP_OFFSET_FIXED, so all this set of ANV_BO_ALLOC_WRITE_COMBINE
were useless.

In Xe KMD there is no way to change mmap mode for all GPUs types.

So we can nuke bo->map_wc, ANV_BO_ALLOC_WRITE_COMBINE and related
dead code.

No changes in behavior expected here.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22483>
This commit is contained in:
José Roberto de Souza 2023-04-27 09:50:39 -07:00 committed by Marge Bot
parent a6c5746b37
commit fd99b671ff
4 changed files with 4 additions and 28 deletions

View file

@ -376,8 +376,7 @@ anv_block_pool_init(struct anv_block_pool *pool,
ANV_BO_ALLOC_FIXED_ADDRESS |
ANV_BO_ALLOC_MAPPED |
ANV_BO_ALLOC_SNOOPED |
ANV_BO_ALLOC_CAPTURE |
(device->info->has_local_mem ? ANV_BO_ALLOC_WRITE_COMBINE : 0);
ANV_BO_ALLOC_CAPTURE;
result = anv_block_pool_expand_range(pool, initial_size);
if (result != VK_SUCCESS)
@ -1095,8 +1094,7 @@ anv_bo_pool_init(struct anv_bo_pool *pool, struct anv_device *device,
pool->bo_alloc_flags =
ANV_BO_ALLOC_MAPPED |
ANV_BO_ALLOC_SNOOPED |
ANV_BO_ALLOC_CAPTURE |
(device->info->has_local_mem ? ANV_BO_ALLOC_WRITE_COMBINE : 0);
ANV_BO_ALLOC_CAPTURE;
for (unsigned i = 0; i < ARRAY_SIZE(pool->free_list); i++) {
util_sparse_array_free_list_init(&pool->free_list[i],
@ -1513,7 +1511,6 @@ anv_device_alloc_bo(struct anv_device *device,
(alloc_flags & ANV_BO_ALLOC_CLIENT_VISIBLE_ADDRESS) != 0,
.has_implicit_ccs = ccs_size > 0 ||
(device->info->verx10 >= 125 && !(alloc_flags & ANV_BO_ALLOC_NO_LOCAL_MEM)),
.map_wc = alloc_flags & ANV_BO_ALLOC_WRITE_COMBINE,
.vram_only = nregions == 1 &&
regions[0] == device->physical->vram_non_mappable.region,
};

View file

@ -3229,9 +3229,7 @@ VkResult anv_CreateDevice(
result = anv_device_alloc_bo(device, "workaround", 4096,
ANV_BO_ALLOC_CAPTURE |
ANV_BO_ALLOC_MAPPED |
(device->info->has_local_mem ?
ANV_BO_ALLOC_WRITE_COMBINE : 0),
ANV_BO_ALLOC_MAPPED,
0 /* explicit_address */,
&device->workaround_bo);
if (result != VK_SUCCESS)
@ -3741,14 +3739,6 @@ VkResult anv_AllocateMemory(
if (!mem_heap->is_local_mem)
alloc_flags |= ANV_BO_ALLOC_NO_LOCAL_MEM;
/* If the allocated buffer might end up in local memory and it's host
* visible and uncached, enable CPU write-combining. It should be faster.
*/
if (mem_heap->is_local_mem &&
(mem_type->propertyFlags & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) == 0 &&
(mem_type->propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))
alloc_flags |= ANV_BO_ALLOC_WRITE_COMBINE;
if (mem->vk.alloc_flags & VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT)
alloc_flags |= ANV_BO_ALLOC_CLIENT_VISIBLE_ADDRESS;

View file

@ -378,14 +378,8 @@ enum anv_bo_alloc_flags {
/** For non device local allocations */
ANV_BO_ALLOC_NO_LOCAL_MEM = (1 << 11),
/** For local memory, ensure that the writes are combined.
*
* Should be faster for bo pools, which write but do not read
*/
ANV_BO_ALLOC_WRITE_COMBINE = (1 << 12),
/** This buffer will be scanout to display */
ANV_BO_ALLOC_SCANOUT = (1 << 13),
ANV_BO_ALLOC_SCANOUT = (1 << 12),
};
struct anv_bo {
@ -473,9 +467,6 @@ struct anv_bo {
/** True if this BO has implicit CCS data attached to it */
bool has_implicit_ccs:1;
/** True if this BO should be mapped with Write Combine enabled */
bool map_wc:1;
/** True if this BO can only live in VRAM */
bool vram_only:1;
};

View file

@ -134,8 +134,6 @@ mmap_calc_flags(struct anv_device *device, struct anv_bo *bo,
if (!device->info->has_llc &&
(property_flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT))
flags |= I915_MMAP_WC;
if (bo->map_wc)
flags |= I915_MMAP_WC;
if (!(property_flags & VK_MEMORY_PROPERTY_HOST_CACHED_BIT))
flags |= I915_MMAP_WC;