anv: Track BOs that need a write-combined mapping
v2: simplify logic a bit (Lionel) Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18841>
This commit is contained in:
@@ -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");
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user