iris: Make an iris_heap_is_device_local() helper
We're going to have two system memory heaps and two device local heaps shortly. Make a helper to avoid having to check for both every time. Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25447>
This commit is contained in:
parent
e27e5ee55c
commit
7a67ea0a6e
3 changed files with 11 additions and 4 deletions
|
|
@ -176,7 +176,7 @@ i915_gem_mmap_offset(struct iris_bufmgr *bufmgr, struct iris_bo *bo)
|
|||
* across PCIe, it's always snooped. The only caching mode allowed by
|
||||
* DG1 hardware for LMEM is WC.
|
||||
*/
|
||||
if (bo->real.heap != IRIS_HEAP_SYSTEM_MEMORY)
|
||||
if (iris_heap_is_device_local(bo->real.heap))
|
||||
assert(bo->real.mmap_mode == IRIS_MMAP_WC);
|
||||
else
|
||||
assert(bo->real.mmap_mode == IRIS_MMAP_WB);
|
||||
|
|
|
|||
|
|
@ -1103,7 +1103,7 @@ iris_bo_alloc_get_mmap_mode(struct iris_bufmgr *bufmgr, enum iris_heap heap,
|
|||
return iris_xe_bo_flags_to_mmap_mode(bufmgr, heap, flags);
|
||||
|
||||
/* i915 */
|
||||
const bool local = heap != IRIS_HEAP_SYSTEM_MEMORY;
|
||||
const bool local = iris_heap_is_device_local(heap);
|
||||
const bool is_coherent = bufmgr->devinfo.has_llc ||
|
||||
(bufmgr->vram.size > 0 && !local) ||
|
||||
(flags & BO_ALLOC_COHERENT);
|
||||
|
|
@ -2155,7 +2155,7 @@ iris_bo_alloc_aux_map_get_mmap_mode(struct iris_bufmgr *bufmgr,
|
|||
{
|
||||
switch (bufmgr->devinfo.kmd_type) {
|
||||
case INTEL_KMD_TYPE_I915:
|
||||
return heap != IRIS_HEAP_SYSTEM_MEMORY ||
|
||||
return iris_heap_is_device_local(heap) ||
|
||||
bufmgr->devinfo.has_set_pat_uapi ?
|
||||
IRIS_MMAP_WC : IRIS_MMAP_WB;
|
||||
case INTEL_KMD_TYPE_XE:
|
||||
|
|
|
|||
|
|
@ -164,6 +164,13 @@ enum iris_heap {
|
|||
|
||||
extern const char *iris_heap_to_string[];
|
||||
|
||||
static inline bool
|
||||
iris_heap_is_device_local(enum iris_heap heap)
|
||||
{
|
||||
return heap == IRIS_HEAP_DEVICE_LOCAL ||
|
||||
heap == IRIS_HEAP_DEVICE_LOCAL_PREFERRED;
|
||||
}
|
||||
|
||||
#define IRIS_BATCH_COUNT 3
|
||||
|
||||
struct iris_bo_screen_deps {
|
||||
|
|
@ -455,7 +462,7 @@ iris_bo_likely_local(const struct iris_bo *bo)
|
|||
return false;
|
||||
|
||||
bo = iris_get_backing_bo((struct iris_bo *) bo);
|
||||
return bo->real.heap != IRIS_HEAP_SYSTEM_MEMORY;
|
||||
return iris_heap_is_device_local(bo->real.heap);
|
||||
}
|
||||
|
||||
static inline enum iris_mmap_mode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue