[PATCH v2 4/5] drm/i915: pass struct drm_i915_private to i915_bo_fbdev_prefer_stolen()

Jani Nikula
2026-03-31T09:49:46Z

This is i915 core code, use struct drm_i915_private for simplicity.

Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
drivers/gpu/drm/i915/i915_bo.c | 6 ++----
drivers/gpu/drm/i915/i915_bo.h | 4 ++--
drivers/gpu/drm/i915/i915_initial_plane.c | 2 +-
3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_bo.c b/drivers/gpu/drm/i915/i915_bo.c
index 7e38d002478e..559341103ca7 100644
--- a/drivers/gpu/drm/i915/i915_bo.c
+++ b/drivers/gpu/drm/i915/i915_bo.c
@@ -150,10 +150,8 @@ static u32 i915_bo_fbdev_pitch_align(u32 stride)
return ALIGN(stride, 64);
}

-bool i915_bo_fbdev_prefer_stolen(struct drm_device *drm, unsigned int size)
+bool i915_bo_fbdev_prefer_stolen(struct drm_i915_private *i915, unsigned int size)
{
- struct drm_i915_private *i915 = to_i915(drm);
-
/* Skip stolen on MTL as Wa_22018444074 mitigation. */
if (IS_METEORLAKE(i915))
return false;
@@ -177,7 +175,7 @@ static struct drm_gem_object *i915_bo_fbdev_create(struct drm_device *drm, int s
I915_BO_ALLOC_CONTIGUOUS |
I915_BO_ALLOC_USER);
} else {
- if (i915_bo_fbdev_prefer_stolen(drm, size))
+ if (i915_bo_fbdev_prefer_stolen(i915, size))
obj = i915_gem_object_create_stolen(i915, size);
else
drm_info(drm, "Allocating fbdev: Stolen memory not preferred.\n");
diff --git a/drivers/gpu/drm/i915/i915_bo.h b/drivers/gpu/drm/i915/i915_bo.h
index 2a0f3050dd42..39ba62696550 100644
--- a/drivers/gpu/drm/i915/i915_bo.h
+++ b/drivers/gpu/drm/i915/i915_bo.h
@@ -6,9 +6,9 @@

#include <linux/types.h>

-struct drm_device;
+struct drm_i915_private;

-bool i915_bo_fbdev_prefer_stolen(struct drm_device *drm, unsigned int size);
+bool i915_bo_fbdev_prefer_stolen(struct drm_i915_private *i915, unsigned int size);

extern const struct intel_display_bo_interface i915_display_bo_interface;

diff --git a/drivers/gpu/drm/i915/i915_initial_plane.c b/drivers/gpu/drm/i915/i915_initial_plane.c
index f4d631a395d0..c1a12bf6b66c 100644
--- a/drivers/gpu/drm/i915/i915_initial_plane.c
+++ b/drivers/gpu/drm/i915/i915_initial_plane.c
@@ -118,7 +118,7 @@ initial_plane_vma(struct drm_i915_private *i915,
if (IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION) &&
IS_ENABLED(CONFIG_FRAMEBUFFER_CONSOLE) &&
mem == i915->mm.stolen_region &&
- !i915_bo_fbdev_prefer_stolen(&i915->drm, size)) {
+ !i915_bo_fbdev_prefer_stolen(i915, size)) {
drm_dbg_kms(&i915->drm, "Initial FB size exceeds half of stolen, discarding\n");
return NULL;
}
--
2.47.3