anv: Move PAT entry selection to common code
PAT entry will be needed to calculate mmap mode and also will be used during BO creating in Xe KMD when PAT uAPi lands. So here moving the PAT entry selection to common code. Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26099>
This commit is contained in:
committed by
Marge Bot
parent
66dce74d74
commit
ccde1dc18e
@@ -4955,3 +4955,15 @@ VkResult anv_GetPhysicalDeviceFragmentShadingRatesKHR(
|
||||
|
||||
return vk_outarray_status(&out);
|
||||
}
|
||||
|
||||
const struct intel_device_info_pat_entry *
|
||||
anv_device_get_pat_entry(struct anv_device *device,
|
||||
enum anv_bo_alloc_flags alloc_flags)
|
||||
{
|
||||
if (alloc_flags & (ANV_BO_ALLOC_SNOOPED))
|
||||
return &device->info->pat.coherent;
|
||||
else if (alloc_flags & (ANV_BO_ALLOC_EXTERNAL | ANV_BO_ALLOC_SCANOUT))
|
||||
return &device->info->pat.scanout;
|
||||
else
|
||||
return &device->info->pat.writeback;
|
||||
}
|
||||
|
||||
@@ -1874,6 +1874,9 @@ anv_gem_import_bo_alloc_flags_to_bo_flags(struct anv_device *device,
|
||||
struct anv_bo *bo,
|
||||
enum anv_bo_alloc_flags alloc_flags,
|
||||
uint32_t *bo_flags);
|
||||
const struct intel_device_info_pat_entry *
|
||||
anv_device_get_pat_entry(struct anv_device *device,
|
||||
enum anv_bo_alloc_flags alloc_flags);
|
||||
|
||||
uint64_t anv_vma_alloc(struct anv_device *device,
|
||||
uint64_t size, uint64_t align,
|
||||
|
||||
@@ -91,12 +91,7 @@ i915_gem_create(struct anv_device *device,
|
||||
struct drm_i915_gem_create_ext_set_pat set_pat_param = { 0 };
|
||||
if (device->info->has_set_pat_uapi) {
|
||||
/* Set PAT param */
|
||||
if (alloc_flags & (ANV_BO_ALLOC_SNOOPED))
|
||||
set_pat_param.pat_index = device->info->pat.coherent.index;
|
||||
else if (alloc_flags & (ANV_BO_ALLOC_EXTERNAL | ANV_BO_ALLOC_SCANOUT))
|
||||
set_pat_param.pat_index = device->info->pat.scanout.index;
|
||||
else
|
||||
set_pat_param.pat_index = device->info->pat.writeback.index;
|
||||
set_pat_param.pat_index = anv_device_get_pat_entry(device, alloc_flags)->index;
|
||||
intel_i915_gem_add_ext(&gem_create.extensions,
|
||||
I915_GEM_CREATE_EXT_SET_PAT,
|
||||
&set_pat_param.base);
|
||||
|
||||
Reference in New Issue
Block a user