diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index 4f637f4f424..2d26772010e 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -1503,6 +1503,7 @@ 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, }; if (alloc_flags & ANV_BO_ALLOC_MAPPED) { @@ -1572,6 +1573,9 @@ anv_device_map_bo(struct anv_device *device, assert(!bo->from_host_ptr); assert(size > 0); + if (bo->map_wc) + gem_flags |= I915_MMAP_WC; + void *map = anv_gem_mmap(device, bo->gem_handle, offset, size, gem_flags); if (unlikely(map == MAP_FAILED)) return vk_errorf(device, VK_ERROR_MEMORY_MAP_FAILED, "mmap failed: %m"); diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index e2d0c0b0261..e52eadbf377 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -545,6 +545,9 @@ 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; }; static inline struct anv_bo * @@ -1268,6 +1271,12 @@ 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), }; VkResult anv_device_alloc_bo(struct anv_device *device,