[Intel-gfx] [PATCH v2] i915: use surface size for bios fb size check

Timo Teräs timo.teras at iki.fi
Tue Nov 1 08:30:11 UTC 2022


Lenovo laptop BIOS (possibly other vendors too) provide a framebuffer with
the size of the primary display. The BIOS selects the primary display to
be the internal display (lid open) or external display (lid closed).

Thus, if the external display supports higher resolution than the internal
one, and the lid is open during boot, the BIOS frame buffer size is not
large enough for the preferred resolution of the external display.

This causes the framebuffer to select non-preferred mode for the external
display. And this causes resolution change (and screen flicker) when
switching between framebuffer mode and drm mode (X11/Plymouth).

The fix is to make sure that the frame buffer is large enough to hold
data for the maximum surface size.

Signed-off-by: Timo Teräs <timo.teras at iki.fi>
---
v2: reword commit message, add signed-off-by

 drivers/gpu/drm/i915/display/intel_fbdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 112aa0447a0d..287b58a732e0 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -217,13 +217,13 @@ static int intelfb_create(struct drm_fb_helper *helper,
 		return ret;
 
 	if (intel_fb &&
-	    (sizes->fb_width > intel_fb->base.width ||
-	     sizes->fb_height > intel_fb->base.height)) {
+	    (sizes->surface_width > intel_fb->base.width ||
+	     sizes->surface_height > intel_fb->base.height)) {
 		drm_dbg_kms(&dev_priv->drm,
 			    "BIOS fb too small (%dx%d), we require (%dx%d),"
 			    " releasing it\n",
 			    intel_fb->base.width, intel_fb->base.height,
-			    sizes->fb_width, sizes->fb_height);
+			    sizes->surface_width, sizes->surface_height);
 		drm_framebuffer_put(&intel_fb->base);
 		intel_fb = ifbdev->fb = NULL;
 	}
-- 
2.38.1



More information about the Intel-gfx mailing list