[PATCH 10/11] drm/xe: Eliminate intel_fb_uses_dpt() call from __xe_pin_fb_vma()

Ville Syrjala
2026-04-16T17:45:40Z

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Move the intel_fb_uses_dpt() out from __xe_pin_fb_vma() into
intel_plane_pin_fb() so the we don't any display stuff that deep
in the pinning code.

And intel_fb_pin_to_ggtt() can just say "this does not need DPT"
always since it's specifically about pinning the fb into GGTT.
The previous logic here was kinda insane with the high level code
assuming GGTT, and low level code potentially deciding otherwise.
In practice it should have been fine because intel_fb_pin_to_ggtt()
only gets used from the intiial_palne code, and there we are
not supposed to be have a framebuffer that needs DPT.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/xe/display/xe_fb_pin.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
index a4eb06cfa769..44562769fbc9 100644
--- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
+++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
@@ -318,7 +318,7 @@ static int __xe_pin_fb_vma_ggtt(const struct intel_framebuffer *fb,
return ret;
}

-static struct i915_vma *__xe_pin_fb_vma(const struct intel_framebuffer *fb,
+static struct i915_vma *__xe_pin_fb_vma(const struct intel_framebuffer *fb, bool is_dpt,
const struct intel_fb_pin_params *pin_params)
{
struct drm_device *dev = fb->base.dev;
@@ -375,7 +375,7 @@ static struct i915_vma *__xe_pin_fb_vma(const struct intel_framebuffer *fb,
goto err;

vma->bo = bo;
- if (intel_fb_uses_dpt(&fb->base))
+ if (is_dpt)
ret = __xe_pin_fb_vma_dpt(fb, pin_params, vma);
else
ret = __xe_pin_fb_vma_ggtt(fb, pin_params, vma);
@@ -419,7 +419,7 @@ intel_fb_pin_to_ggtt(const struct drm_framebuffer *fb,
if (out_fence_id)
*out_fence_id = -1;

- return __xe_pin_fb_vma(to_intel_framebuffer(fb), pin_params);
+ return __xe_pin_fb_vma(to_intel_framebuffer(fb), false, pin_params);
}

void intel_fb_unpin_vma(struct i915_vma *vma, int fence_id)
@@ -483,7 +483,8 @@ int intel_plane_pin_fb(struct intel_plane_state *new_plane_state,
/* We reject creating !SCANOUT fb's, so this is weird.. */
drm_WARN_ON(bo->ttm.base.dev, !(bo->flags & XE_BO_FLAG_FORCE_WC));

- vma = __xe_pin_fb_vma(intel_fb, &pin_params);
+ vma = __xe_pin_fb_vma(intel_fb, intel_fb_uses_dpt(&intel_fb->base),
+ &pin_params);

if (IS_ERR(vma))
return PTR_ERR(vma);
--
2.52.0