iris: Add iris_bufmgr_get_pat_entry_for_bo_flags()
Next patches will make of intel_device_info_pat_entry parameters other than index, so here adding a function to return it. While at it also renaming and adjusting parameter of iris_pat_index_for_bo_flags() to match other functions in iris_bufmgr.c/h. No changes in behavior expected here. 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
f25043feb4
commit
533082f384
@@ -111,7 +111,7 @@ i915_gem_create(struct iris_bufmgr *bufmgr,
|
||||
struct drm_i915_gem_create_ext_set_pat set_pat_param = { 0 };
|
||||
if (devinfo->has_set_pat_uapi) {
|
||||
set_pat_param.pat_index =
|
||||
iris_pat_index_for_bo_flags(devinfo, alloc_flags);
|
||||
iris_bufmgr_get_pat_index_for_bo_flags(bufmgr, alloc_flags);
|
||||
intel_i915_gem_add_ext(&create.extensions,
|
||||
I915_GEM_CREATE_EXT_SET_PAT,
|
||||
&set_pat_param.base);
|
||||
|
@@ -320,7 +320,7 @@ bucket_for_size(struct iris_bufmgr *bufmgr, uint64_t size,
|
||||
|
||||
const struct intel_device_info *devinfo = &bufmgr->devinfo;
|
||||
if (devinfo->has_set_pat_uapi &&
|
||||
iris_pat_index_for_bo_flags(devinfo, flags) != devinfo->pat.writeback.index)
|
||||
iris_bufmgr_get_pat_entry_for_bo_flags(bufmgr, flags) != &devinfo->pat.writeback)
|
||||
return NULL;
|
||||
|
||||
if (devinfo->kmd_type == INTEL_KMD_TYPE_XE &&
|
||||
@@ -2616,3 +2616,21 @@ iris_bufmgr_use_global_vm_id(struct iris_bufmgr *bufmgr)
|
||||
{
|
||||
return bufmgr->use_global_vm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the pat entry based on the bo heap and allocation flags.
|
||||
*/
|
||||
const struct intel_device_info_pat_entry *
|
||||
iris_bufmgr_get_pat_entry_for_bo_flags(const struct iris_bufmgr *bufmgr,
|
||||
unsigned alloc_flags)
|
||||
{
|
||||
const struct intel_device_info *devinfo = &bufmgr->devinfo;
|
||||
|
||||
if (alloc_flags & BO_ALLOC_COHERENT)
|
||||
return &devinfo->pat.coherent;
|
||||
|
||||
if (alloc_flags & (BO_ALLOC_SHARED | BO_ALLOC_SCANOUT))
|
||||
return &devinfo->pat.scanout;
|
||||
|
||||
return &devinfo->pat.writeback;
|
||||
}
|
||||
|
@@ -539,20 +539,18 @@ iris_bo_bump_seqno(struct iris_bo *bo, uint64_t seqno,
|
||||
prev_seqno = tmp;
|
||||
}
|
||||
|
||||
const struct intel_device_info_pat_entry *
|
||||
iris_bufmgr_get_pat_entry_for_bo_flags(const struct iris_bufmgr *bufmgr,
|
||||
unsigned alloc_flags);
|
||||
|
||||
/**
|
||||
* Return the pat index based on the bo allocation flags.
|
||||
*/
|
||||
static inline uint32_t
|
||||
iris_pat_index_for_bo_flags(const struct intel_device_info *devinfo,
|
||||
unsigned alloc_flags)
|
||||
iris_bufmgr_get_pat_index_for_bo_flags(const struct iris_bufmgr *bufmgr,
|
||||
unsigned alloc_flags)
|
||||
{
|
||||
if (alloc_flags & BO_ALLOC_COHERENT)
|
||||
return devinfo->pat.coherent.index;
|
||||
|
||||
if (alloc_flags & (BO_ALLOC_SHARED | BO_ALLOC_SCANOUT))
|
||||
return devinfo->pat.scanout.index;
|
||||
|
||||
return devinfo->pat.writeback.index;
|
||||
return iris_bufmgr_get_pat_entry_for_bo_flags(bufmgr, alloc_flags)->index;
|
||||
}
|
||||
|
||||
enum iris_memory_zone iris_memzone_for_address(uint64_t address);
|
||||
|
Reference in New Issue
Block a user