]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/i915: Use a nicer way to lookup the memory region in BIOS FB takeover
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 13 Mar 2025 14:08:35 +0000 (16:08 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 1 Apr 2025 23:21:12 +0000 (02:21 +0300)
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>
drivers/gpu/drm/i915/display/intel_plane_initial.c

index cf7d1a5ab52428fa686a9e9a7e940607ec63d78d..5f75ef4ba3b14d34458fdeb56cfdef8ea87131cb 100644 (file)
@@ -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;
        }