[PATCH 15/16] drm/xe: Use xe_fb_pin_ggtt_pin() for the initial FB pin

Ville Syrjala
2026-04-23T16:55:01Z

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

Use xe_fb_pin_ggtt_pin() instead of intel_fb_pin_to_ggtt() for
the initial FB pin. We want to get rid of intel_fb_pin_to_ggtt()
and just use the new fb_pin parent interface.

This still isn't quite the final solution since we bypass the
actual parent interface and call the implementation directly.
But sorting that out will require more cleanup to the initial
FB code.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/xe/display/xe_fb_pin.c | 21 +++++--------------
drivers/gpu/drm/xe/display/xe_fb_pin.h | 12 +++++++++++
drivers/gpu/drm/xe/display/xe_initial_plane.c | 18 ++++++++++------
3 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
index c3171625d150..c92c30ceba36 100644
--- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
+++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
@@ -413,22 +413,11 @@ static void __xe_unpin_fb_vma(struct i915_vma *vma)
kfree(vma);
}

-struct i915_vma *
-intel_fb_pin_to_ggtt(struct drm_gem_object *obj,
- const struct intel_fb_pin_params *pin_params,
- int *out_fence_id)
-{
- if (out_fence_id)
- *out_fence_id = -1;
-
- return __xe_pin_fb_vma(obj, false, pin_params);
-}
-
-static int xe_fb_pin_ggtt_pin(struct drm_gem_object *obj,
- const struct intel_fb_pin_params *pin_params,
- struct i915_vma **out_ggtt_vma,
- u32 *out_offset,
- int *out_fence_id)
+int xe_fb_pin_ggtt_pin(struct drm_gem_object *obj,
+ const struct intel_fb_pin_params *pin_params,
+ struct i915_vma **out_ggtt_vma,
+ u32 *out_offset,
+ int *out_fence_id)
{
struct i915_vma *ggtt_vma;

diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.h b/drivers/gpu/drm/xe/display/xe_fb_pin.h
index 8a42d4009f5d..20dd8a99a25f 100644
--- a/drivers/gpu/drm/xe/display/xe_fb_pin.h
+++ b/drivers/gpu/drm/xe/display/xe_fb_pin.h
@@ -4,6 +4,18 @@
#ifndef __XE_FB_PIN_H__
#define __XE_FB_PIN_H__

+#include <linux/types.h>
+
+struct drm_gem_object;
+struct i915_vma;
+struct intel_fb_pin_params;
+
+int xe_fb_pin_ggtt_pin(struct drm_gem_object *obj,
+ const struct intel_fb_pin_params *pin_params,
+ struct i915_vma **out_ggtt_vma,
+ u32 *out_offset,
+ int *out_fence_id);
+
extern const struct intel_display_fb_pin_interface xe_display_fb_pin_interface;

#endif /* __XE_FB_PIN_H__ */
diff --git a/drivers/gpu/drm/xe/display/xe_initial_plane.c b/drivers/gpu/drm/xe/display/xe_initial_plane.c
index 8e3c0c4b81fe..02b46cc3b6df 100644
--- a/drivers/gpu/drm/xe/display/xe_initial_plane.c
+++ b/drivers/gpu/drm/xe/display/xe_initial_plane.c
@@ -7,12 +7,16 @@

#include "regs/xe_gtt_defs.h"

-#include "intel_display_types.h"
+/* FIXME move intel_remapped_info_size() & co. */
#include "intel_fb.h"
-#include "intel_fb_pin.h"
+
+/* FIXME move intel_initial_plane_config */
+#include "intel_display_types.h"
+
#include "xe_bo.h"
#include "xe_display_bo.h"
#include "xe_display_vma.h"
+#include "xe_fb_pin.h"
#include "xe_ggtt.h"
#include "xe_mmio.h"
#include "xe_vram_types.h"
@@ -137,14 +141,16 @@ xe_initial_plane_setup(struct drm_plane_state *_plane_state,
struct intel_fb_pin_params pin_params = {
.view = &plane_state->view.gtt,
};
+ u32 offset;
+ int ret;

- vma = intel_fb_pin_to_ggtt(intel_fb_bo(fb), &pin_params, NULL);
- if (IS_ERR(vma))
- return PTR_ERR(vma);
+ ret = xe_fb_pin_ggtt_pin(intel_fb_bo(fb), &pin_params, &vma, &offset, NULL);
+ if (ret)
+ return ret;

plane_state->ggtt_vma = vma;

- plane_state->surf = xe_ggtt_node_addr(plane_state->ggtt_vma->node);
+ plane_state->surf = offset;

plane_config->vma = vma;

--
2.52.0