Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: [PATCH 04/14] drm/i915: Introduce intel_bo_fbdev_bios_fb_ok()
Date: Tue, 12 May 2026 00:41:12 +0300	[thread overview]
Message-ID: <20260511214122.8468-5-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20260511214122.8468-1-ville.syrjala@linux.intel.com>

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

Pull the "do we want to use stolen for the BIOS FB?" checks into
a new intel_bo_fbdev_bios_fb_ok() helper, and defer that decision
until we're ready to reallocate the fbdev FB. This way even if
we don't want to ultimately use the BIOS FB we'll keep the plane
enabled until the replacement FB is ready. Should hopefully result
in fewer display blinks during boot.

Ideally I'd like to move all this stuff fully to the display side,
but to do that I'll need to figure out how to abstract more of the
stolen memory stuff. So keep the checks on the i915/xe side for now.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_bo.c       |  5 +++++
 drivers/gpu/drm/i915/display/intel_bo.h       |  1 +
 drivers/gpu/drm/i915/display/intel_fbdev.c    |  5 +++++
 drivers/gpu/drm/i915/i915_bo.c                | 13 ++++++++++++-
 drivers/gpu/drm/i915/i915_bo.h                |  6 ------
 drivers/gpu/drm/i915/i915_initial_plane.c     | 14 --------------
 drivers/gpu/drm/xe/display/xe_display_bo.c    | 14 +++++++++++++-
 drivers/gpu/drm/xe/display/xe_display_bo.h    |  6 ------
 drivers/gpu/drm/xe/display/xe_initial_plane.c |  8 --------
 include/drm/intel/display_parent_interface.h  |  1 +
 10 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_bo.c b/drivers/gpu/drm/i915/display/intel_bo.c
index 8ecdbb7e39f3..370a3353193c 100644
--- a/drivers/gpu/drm/i915/display/intel_bo.c
+++ b/drivers/gpu/drm/i915/display/intel_bo.c
@@ -92,6 +92,11 @@ u32 intel_bo_fbdev_pitch_align(struct intel_display *display, u32 stride)
 	return display->parent->bo->fbdev_pitch_align(stride);
 }
 
+bool intel_bo_fbdev_bios_fb_ok(struct intel_display *display, int size)
+{
+	return display->parent->bo->fbdev_bios_fb_ok(display->drm, size);
+}
+
 struct drm_gem_object *intel_bo_fbdev_create(struct intel_display *display, int size)
 {
 	return display->parent->bo->fbdev_create(display->drm, size);
diff --git a/drivers/gpu/drm/i915/display/intel_bo.h b/drivers/gpu/drm/i915/display/intel_bo.h
index 348f7fa66960..e962cd3c5105 100644
--- a/drivers/gpu/drm/i915/display/intel_bo.h
+++ b/drivers/gpu/drm/i915/display/intel_bo.h
@@ -34,6 +34,7 @@ struct drm_gem_object *intel_bo_framebuffer_lookup(struct intel_display *display
 						   const struct drm_mode_fb_cmd2 *user_mode_cmd);
 
 u32 intel_bo_fbdev_pitch_align(struct intel_display *display, u32 stride);
+bool intel_bo_fbdev_bios_fb_ok(struct intel_display *display, int size);
 struct drm_gem_object *intel_bo_fbdev_create(struct intel_display *display, int size);
 void intel_bo_fbdev_destroy(struct drm_gem_object *obj);
 int intel_bo_fbdev_fill_info(struct drm_gem_object *obj, struct fb_info *info,
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 3754810cc187..4207c89f7c1e 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -271,6 +271,11 @@ static bool bios_fb_ok(const struct intel_framebuffer *fb,
 	int depth = fb->base.format->depth;
 	int bpp = fb->base.format->cpp[0] * 8;
 
+	if (!intel_bo_fbdev_bios_fb_ok(display, intel_fb_bo(&fb->base)->size)) {
+		drm_dbg_kms(display->drm, "BIOS fb unusable, releasing it\n");
+		return false;
+	}
+
 	if (sizes->fb_width > width || sizes->fb_height > height) {
 		drm_dbg_kms(display->drm,
 			    "BIOS fb too small (%dx%d), we require (%dx%d), releasing it\n",
diff --git a/drivers/gpu/drm/i915/i915_bo.c b/drivers/gpu/drm/i915/i915_bo.c
index 559341103ca7..662c519174cf 100644
--- a/drivers/gpu/drm/i915/i915_bo.c
+++ b/drivers/gpu/drm/i915/i915_bo.c
@@ -150,7 +150,7 @@ static u32 i915_bo_fbdev_pitch_align(u32 stride)
 	return ALIGN(stride, 64);
 }
 
-bool i915_bo_fbdev_prefer_stolen(struct drm_i915_private *i915, unsigned int size)
+static bool i915_bo_fbdev_prefer_stolen(struct drm_i915_private *i915, unsigned int size)
 {
 	/* Skip stolen on MTL as Wa_22018444074 mitigation. */
 	if (IS_METEORLAKE(i915))
@@ -164,6 +164,16 @@ bool i915_bo_fbdev_prefer_stolen(struct drm_i915_private *i915, unsigned int siz
 	return i915->dsm.usable_size >= size * 2;
 }
 
+static bool i915_bo_fbdev_bios_fb_ok(struct drm_device *drm, int size)
+{
+	struct drm_i915_private *i915 = to_i915(drm);
+
+	if (HAS_LMEM(i915))
+		return true;
+
+	return i915_bo_fbdev_prefer_stolen(i915, size);
+}
+
 static struct drm_gem_object *i915_bo_fbdev_create(struct drm_device *drm, int size)
 {
 	struct drm_i915_private *i915 = to_i915(drm);
@@ -262,6 +272,7 @@ const struct intel_display_bo_interface i915_display_bo_interface = {
 	.framebuffer_fini = i915_bo_framebuffer_fini,
 	.framebuffer_lookup = i915_bo_framebuffer_lookup,
 #if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)
+	.fbdev_bios_fb_ok = i915_bo_fbdev_bios_fb_ok,
 	.fbdev_create = i915_bo_fbdev_create,
 	.fbdev_destroy = i915_bo_fbdev_destroy,
 	.fbdev_fill_info = i915_bo_fbdev_fill_info,
diff --git a/drivers/gpu/drm/i915/i915_bo.h b/drivers/gpu/drm/i915/i915_bo.h
index 39ba62696550..57255d052dd9 100644
--- a/drivers/gpu/drm/i915/i915_bo.h
+++ b/drivers/gpu/drm/i915/i915_bo.h
@@ -4,12 +4,6 @@
 #ifndef __I915_BO_H__
 #define __I915_BO_H__
 
-#include <linux/types.h>
-
-struct drm_i915_private;
-
-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;
 
 #endif /* __I915_BO_H__ */
diff --git a/drivers/gpu/drm/i915/i915_initial_plane.c b/drivers/gpu/drm/i915/i915_initial_plane.c
index 4902c0748664..56d31f83707b 100644
--- a/drivers/gpu/drm/i915/i915_initial_plane.c
+++ b/drivers/gpu/drm/i915/i915_initial_plane.c
@@ -12,7 +12,6 @@
 #include "gem/i915_gem_lmem.h"
 #include "gem/i915_gem_region.h"
 
-#include "i915_bo.h"
 #include "i915_drv.h"
 #include "i915_initial_plane.h"
 
@@ -102,19 +101,6 @@ initial_plane_vma(struct drm_i915_private *i915,
 			mem->min_page_size);
 	size -= base;
 
-	/*
-	 * If the FB is too big, just don't use it since fbdev is not very
-	 * important and we should probably use that space with FBC or other
-	 * features.
-	 */
-	if (IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION) &&
-	    IS_ENABLED(CONFIG_FRAMEBUFFER_CONSOLE) &&
-	    mem == i915->mm.stolen_region &&
-	    !i915_bo_fbdev_prefer_stolen(i915, size)) {
-		drm_dbg_kms(&i915->drm, "Initial FB size exceeds half of stolen, discarding\n");
-		return NULL;
-	}
-
 	obj = i915_gem_object_create_region_at(mem, phys_base, size,
 					       I915_BO_ALLOC_USER |
 					       I915_BO_PREALLOC);
diff --git a/drivers/gpu/drm/xe/display/xe_display_bo.c b/drivers/gpu/drm/xe/display/xe_display_bo.c
index 7fbac223b097..02a906efb818 100644
--- a/drivers/gpu/drm/xe/display/xe_display_bo.c
+++ b/drivers/gpu/drm/xe/display/xe_display_bo.c
@@ -119,7 +119,7 @@ static u32 xe_display_bo_fbdev_pitch_align(u32 stride)
 	return ALIGN(stride, XE_PAGE_SIZE);
 }
 
-bool xe_display_bo_fbdev_prefer_stolen(struct xe_device *xe, unsigned int size)
+static bool xe_display_bo_fbdev_prefer_stolen(struct xe_device *xe, unsigned int size)
 {
 	struct ttm_resource_manager *stolen;
 
@@ -130,6 +130,7 @@ bool xe_display_bo_fbdev_prefer_stolen(struct xe_device *xe, unsigned int size)
 	if (IS_DGFX(xe))
 		return false;
 
+	/* machine hang when doing lots of LMEMBAR accesses */
 	if (XE_DEVICE_WA(xe, 22019338487_display))
 		return false;
 
@@ -141,6 +142,16 @@ bool xe_display_bo_fbdev_prefer_stolen(struct xe_device *xe, unsigned int size)
 	return stolen->size >= (size * 2) >> PAGE_SHIFT;
 }
 
+static bool xe_display_bo_fbdev_bios_fb_ok(struct drm_device *drm, int size)
+{
+	struct xe_device *xe = to_xe_device(drm);
+
+	if (IS_DGFX(xe))
+		return true;
+
+	return xe_display_bo_fbdev_prefer_stolen(xe, size);
+}
+
 static struct drm_gem_object *xe_display_bo_fbdev_create(struct drm_device *drm, int size)
 {
 	struct xe_device *xe = to_xe_device(drm);
@@ -224,6 +235,7 @@ const struct intel_display_bo_interface xe_display_bo_interface = {
 	.framebuffer_fini = xe_display_bo_framebuffer_fini,
 	.framebuffer_lookup = xe_display_bo_framebuffer_lookup,
 #if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)
+	.fbdev_bios_fb_ok = xe_display_bo_fbdev_bios_fb_ok,
 	.fbdev_create = xe_display_bo_fbdev_create,
 	.fbdev_destroy = xe_display_bo_fbdev_destroy,
 	.fbdev_fill_info = xe_display_bo_fbdev_fill_info,
diff --git a/drivers/gpu/drm/xe/display/xe_display_bo.h b/drivers/gpu/drm/xe/display/xe_display_bo.h
index c72056884ff4..6879c104b0b1 100644
--- a/drivers/gpu/drm/xe/display/xe_display_bo.h
+++ b/drivers/gpu/drm/xe/display/xe_display_bo.h
@@ -4,12 +4,6 @@
 #ifndef __XE_DISPLAY_BO_H__
 #define __XE_DISPLAY_BO_H__
 
-#include <linux/types.h>
-
-struct xe_device;
-
-bool xe_display_bo_fbdev_prefer_stolen(struct xe_device *xe, unsigned int size);
-
 extern const struct intel_display_bo_interface xe_display_bo_interface;
 
 #endif
diff --git a/drivers/gpu/drm/xe/display/xe_initial_plane.c b/drivers/gpu/drm/xe/display/xe_initial_plane.c
index 02b46cc3b6df..1f2919797f6f 100644
--- a/drivers/gpu/drm/xe/display/xe_initial_plane.c
+++ b/drivers/gpu/drm/xe/display/xe_initial_plane.c
@@ -14,7 +14,6 @@
 #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"
@@ -70,13 +69,6 @@ initial_plane_bo(struct xe_device *xe,
 			return NULL;
 		phys_base = base;
 		flags |= XE_BO_FLAG_STOLEN;
-
-		if (IS_ENABLED(CONFIG_FRAMEBUFFER_CONSOLE) &&
-		    IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION) &&
-		    !xe_display_bo_fbdev_prefer_stolen(xe, plane_config->size)) {
-			drm_info(&xe->drm, "Initial FB size exceeds half of stolen, discarding\n");
-			return NULL;
-		}
 	}
 
 	size = round_up(plane_config->base + plane_config->size,
diff --git a/include/drm/intel/display_parent_interface.h b/include/drm/intel/display_parent_interface.h
index 39991afeb173..7d7d848fd511 100644
--- a/include/drm/intel/display_parent_interface.h
+++ b/include/drm/intel/display_parent_interface.h
@@ -58,6 +58,7 @@ struct intel_display_bo_interface {
 						     struct drm_file *filp,
 						     const struct drm_mode_fb_cmd2 *user_mode_cmd);
 #if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)
+	bool (*fbdev_bios_fb_ok)(struct drm_device *drm, int size);
 	struct drm_gem_object *(*fbdev_create)(struct drm_device *drm, int size);
 	void (*fbdev_destroy)(struct drm_gem_object *obj);
 	int (*fbdev_fill_info)(struct drm_gem_object *obj, struct fb_info *info, struct i915_vma *vma);
-- 
2.52.0


  parent reply	other threads:[~2026-05-11 21:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 21:41 [PATCH 00/14] drm/{i915,xe}: BIOS FB takeover fixes Ville Syrjala
2026-05-11 21:41 ` [PATCH 01/14] drm/i915: Disable the plane if initial plane config readout failed Ville Syrjala
2026-05-12 10:25   ` Jani Nikula
2026-05-11 21:41 ` [PATCH 02/14] drm/i915/fbdev: Extract bios_fb_ok() Ville Syrjala
2026-05-12 10:29   ` Jani Nikula
2026-05-11 21:41 ` [PATCH 03/14] drm/i915: Throw away the BIOS fb if has the wrong depth/bpp Ville Syrjala
2026-05-12 10:33   ` Jani Nikula
2026-05-11 21:41 ` Ville Syrjala [this message]
2026-05-11 21:41 ` [PATCH 05/14] drm/i915: Use drm_dbg_kms() for initial FB debugs Ville Syrjala
2026-05-12 10:40   ` Jani Nikula
2026-05-11 21:41 ` [PATCH 06/14] drm/xe: Do the initial FB size alignment earlier Ville Syrjala
2026-05-11 21:41 ` [PATCH 07/14] drm/xe/ggtt: Decouple lmem/stolen physcial offset from GGTT offset Ville Syrjala
2026-05-11 21:41 ` [PATCH 08/14] drm/xe: Print a debug message if we have no stolen for the initial FB Ville Syrjala
2026-05-12 10:45   ` Jani Nikula
2026-05-11 21:41 ` [PATCH 09/14] drm/xe: Abstract the initial FB PTE checks a bit Ville Syrjala
2026-05-12 10:48   ` Jani Nikula
2026-05-11 21:41 ` [PATCH 10/14] drm/xe: Check the PTE local memory bit for initial FB in stolen Ville Syrjala
2026-05-11 21:41 ` [PATCH 11/14] drm/xe: s/bar2/lmembar/ Ville Syrjala
2026-05-12 10:49   ` Jani Nikula
2026-05-11 21:41 ` [PATCH 12/14] drm/xe: Use the correct stolen offset in initial FB readout Ville Syrjala
2026-05-11 21:41 ` [PATCH 13/14] drm/i915: Fix BIOS FB memory region name debug prints Ville Syrjala
2026-05-11 21:41 ` [PATCH 14/14] drm/i915: Print the phys_base in addition to the dma_addr for the BIOS FB Ville Syrjala
2026-05-11 22:27 ` ✓ i915.CI.BAT: success for drm/{i915,xe}: BIOS FB takeover fixes Patchwork
2026-05-12  7:02 ` ✓ i915.CI.Full: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260511214122.8468-5-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox