Skip to content

Commit

Permalink
drm/i915: Eliminate the initial_plane_phys_{smem,lmem}() duplication
Browse files Browse the repository at this point in the history
initial_plane_phys_lmem() and initial_plane_phys_smem() are
now identical. Remove one of them.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250313140838.29742-11-ville.syrjala@linux.intel.com
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
  • Loading branch information
Ville Syrjälä committed Apr 1, 2025
1 parent 9d29347 commit 544813f
Showing 1 changed file with 2 additions and 73 deletions.
75 changes: 2 additions & 73 deletions drivers/gpu/drm/i915/display/intel_plane_initial.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,67 +64,8 @@ initial_plane_memory_type(struct drm_i915_private *i915)
}

static bool
initial_plane_phys_lmem(struct intel_display *display,
struct intel_initial_plane_config *plane_config)
{
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;

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 (type %s) not initialized\n",
intel_memory_type_str(mem_type));
return false;
}

base = round_down(plane_config->base, I915_GTT_MIN_ALIGNMENT);

dma_addr = intel_ggtt_read_entry(&ggtt->vm, base, &is_present, &is_local);

if (!is_present) {
drm_err(display->drm,
"Initial plane FB PTE not present\n");
return false;
}

if (intel_memory_type_is_local(mem->type) != is_local) {
drm_err(display->drm,
"Initial plane FB PTE unsuitable for %s\n",
mem->region.name);
return false;
}

/*
* On lmem we don't currently expect this to
* ever be placed in the stolen portion.
*/
if (dma_addr < mem->region.start || dma_addr > mem->region.end) {
drm_err(display->drm,
"Initial plane programming using invalid range, dma_addr=%pa (%s [%pa-%pa])\n",
&dma_addr, mem->region.name, &mem->region.start, &mem->region.end);
return false;
}

drm_dbg(display->drm,
"Using dma_addr=%pa, based on initial plane programming\n",
&dma_addr);

plane_config->phys_base = dma_addr - mem->region.start;
plane_config->mem = mem;

return true;
}

static bool
initial_plane_phys_smem(struct intel_display *display,
struct intel_initial_plane_config *plane_config)
initial_plane_phys(struct intel_display *display,
struct intel_initial_plane_config *plane_config)
{
struct drm_i915_private *i915 = to_i915(display->drm);
struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
Expand Down Expand Up @@ -177,18 +118,6 @@ initial_plane_phys_smem(struct intel_display *display,
return true;
}

static bool
initial_plane_phys(struct intel_display *display,
struct intel_initial_plane_config *plane_config)
{
struct drm_i915_private *i915 = to_i915(display->drm);

if (IS_DGFX(i915) || HAS_LMEMBAR_SMEM_STOLEN(i915))
return initial_plane_phys_lmem(display, plane_config);
else
return initial_plane_phys_smem(display, plane_config);
}

static struct i915_vma *
initial_plane_vma(struct intel_display *display,
struct intel_initial_plane_config *plane_config)
Expand Down

0 comments on commit 544813f

Please sign in to comment.