On Tue, 12 May 2026, Ville Syrjala <[email protected]> wrote: > From: Ville Syrjälä <[email protected]> > > Pull the "is the BIOS FB OK?" checks to a helper function. We'll > add other relevant checks there later. > > Signed-off-by: Ville Syrjälä <[email protected]>
Reviewed-by: Jani Nikula <[email protected]> > --- > drivers/gpu/drm/i915/display/intel_fbdev.c | 26 +++++++++++++++------- > 1 file changed, 18 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c > b/drivers/gpu/drm/i915/display/intel_fbdev.c > index df1d3d9dc3e5..f9c135400453 100644 > --- a/drivers/gpu/drm/i915/display/intel_fbdev.c > +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c > @@ -262,6 +262,23 @@ __intel_fbdev_fb_alloc(struct intel_display *display, > > } > > +static bool bios_fb_ok(const struct intel_framebuffer *fb, > + const struct drm_fb_helper_surface_size *sizes) > +{ > + struct intel_display *display = to_intel_display(fb->base.dev); > + int width = fb->base.width; > + int height = fb->base.height; > + > + 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", > + width, height, sizes->fb_width, sizes->fb_height); > + return false; > + } > + > + return true; > +} > + > int intel_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper, > struct drm_fb_helper_surface_size *sizes) > { > @@ -279,14 +296,7 @@ int intel_fbdev_driver_fbdev_probe(struct drm_fb_helper > *helper, > > ifbdev->fb = NULL; > > - if (fb && > - (sizes->fb_width > fb->base.width || > - sizes->fb_height > fb->base.height)) { > - drm_dbg_kms(display->drm, > - "BIOS fb too small (%dx%d), we require (%dx%d)," > - " releasing it\n", > - fb->base.width, fb->base.height, > - sizes->fb_width, sizes->fb_height); > + if (fb && !bios_fb_ok(fb, sizes)) { > drm_framebuffer_put(&fb->base); > fb = NULL; > } -- Jani Nikula, Intel
