drm/i915: Extract intel_memory_type_is_local()

Extract the "is this memory region local?" check into a helper.
I'll have another use for this in the BIOS FB takeover.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250313140838.29742-2-ville.syrjala@linux.intel.com
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
This commit is contained in:
Ville Syrjälä
2025-03-13 16:08:29 +02:00
parent da1d515eb1
commit 33b3c4791e
3 changed files with 14 additions and 2 deletions

View File

@@ -48,8 +48,7 @@ bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
i915_gem_object_evictable(obj))
assert_object_held(obj);
#endif
return mr && (mr->type == INTEL_MEMORY_LOCAL ||
mr->type == INTEL_MEMORY_STOLEN_LOCAL);
return mr && intel_memory_type_is_local(mr->type);
}
/**

View File

@@ -171,6 +171,17 @@ intel_memory_region_by_type(struct drm_i915_private *i915,
return NULL;
}
bool intel_memory_type_is_local(enum intel_memory_type mem_type)
{
switch (mem_type) {
case INTEL_MEMORY_LOCAL:
case INTEL_MEMORY_STOLEN_LOCAL:
return true;
default:
return false;
}
}
/**
* intel_memory_region_reserve - Reserve a memory range
* @mem: The region for which we want to reserve a range.

View File

@@ -85,6 +85,8 @@ struct intel_memory_region {
void *region_private;
};
bool intel_memory_type_is_local(enum intel_memory_type mem_type);
struct intel_memory_region *
intel_memory_region_lookup(struct drm_i915_private *i915,
u16 class, u16 instance);