diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2025-03-13 17:08:35 +0300 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2025-04-02 02:21:12 +0300 |
commit | 0cd161e9472f2eb4be3436670c6db2dd0e3851e4 (patch) | |
tree | 5cc920cea5839748e8b6b8a8917141a5d8ac53c4 | |
parent | 4bef6b0e1049a952fc4d728b7defc42422cab599 (diff) | |
download | linux-0cd161e9472f2eb4be3436670c6db2dd0e3851e4.tar.xz |
drm/i915: Use a nicer way to lookup the memory region in BIOS FB takeover
Use intel_memory_region_by_type() to find the appropriate memory
region for the BIOS FB takeover.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250313140838.29742-8-ville.syrjala@linux.intel.com
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/display/intel_plane_initial.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_plane_initial.c b/drivers/gpu/drm/i915/display/intel_plane_initial.c index cf7d1a5ab524..5f75ef4ba3b1 100644 --- a/drivers/gpu/drm/i915/display/intel_plane_initial.c +++ b/drivers/gpu/drm/i915/display/intel_plane_initial.c @@ -52,6 +52,17 @@ intel_reuse_initial_plane_obj(struct intel_crtc *this, return false; } +static enum intel_memory_type +initial_plane_memory_type(struct drm_i915_private *i915) +{ + if (IS_DGFX(i915)) + return INTEL_MEMORY_LOCAL; + else if (HAS_LMEMBAR_SMEM_STOLEN(i915)) + return INTEL_MEMORY_STOLEN_LOCAL; + else + return INTEL_MEMORY_STOLEN_SYSTEM; +} + static bool initial_plane_phys_lmem(struct intel_display *display, struct intel_initial_plane_config *plane_config) @@ -59,6 +70,7 @@ initial_plane_phys_lmem(struct intel_display *display, struct drm_i915_private *i915 = to_i915(display->drm); struct i915_ggtt *ggtt = to_gt(i915)->ggtt; struct intel_memory_region *mem; + enum intel_memory_type mem_type; bool is_present, is_local; dma_addr_t dma_addr; u32 base; @@ -79,13 +91,12 @@ initial_plane_phys_lmem(struct intel_display *display, return false; } - if (IS_DGFX(i915)) - mem = i915->mm.regions[INTEL_REGION_LMEM_0]; - else - mem = i915->mm.stolen_region; + mem_type = initial_plane_memory_type(i915); + mem = intel_memory_region_by_type(i915, mem_type); if (!mem) { drm_dbg_kms(display->drm, - "Initial plane memory region not initialized\n"); + "Initial plane memory region (type %s) not initialized\n", + intel_memory_type_str(mem_type)); return false; } @@ -117,6 +128,7 @@ initial_plane_phys_smem(struct intel_display *display, struct drm_i915_private *i915 = to_i915(display->drm); struct i915_ggtt *ggtt = to_gt(i915)->ggtt; struct intel_memory_region *mem; + enum intel_memory_type mem_type; bool is_present, is_local; dma_addr_t dma_addr; u32 base; @@ -137,10 +149,12 @@ initial_plane_phys_smem(struct intel_display *display, return false; } - mem = i915->mm.stolen_region; + mem_type = initial_plane_memory_type(i915); + mem = intel_memory_region_by_type(i915, mem_type); if (!mem) { drm_dbg_kms(display->drm, - "Initial plane memory region not initialized\n"); + "Initial plane memory region (type %s) not initialized\n", + intel_memory_type_str(mem_type)); return false; } |