[Intel-gfx] [PATCH 4/4] drm/i915: Throw away the BIOS fb if has the wrong depth/bpp

Ville Syrjälä ville.syrjala at linux.intel.com
Tue Jun 11 17:51:07 UTC 2019


On Fri, Jun 07, 2019 at 08:43:56PM +0200, Daniel Vetter wrote:
> On Fri, Jun 07, 2019 at 07:26:11PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > 
> > Respect the user's choice of depth/bpp for the fbdev framebuffer
> > and throw out the fb we inherited from the BIOS if it doesn't
> > match.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> I guess we're going boom right now, which is maybe a bit much? i.e.
> Cc: stable at vger.kernel.org

I think currently it just ignores whatever the user said.
I didn't see any explosions.

> 
> Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> 
> > ---
> >  drivers/gpu/drm/i915/intel_fbdev.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> > index 0d3a6fa674e6..1a935dc74d23 100644
> > --- a/drivers/gpu/drm/i915/intel_fbdev.c
> > +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> > @@ -199,6 +199,17 @@ static int intelfb_create(struct drm_fb_helper *helper,
> >  		drm_framebuffer_put(&intel_fb->base);
> >  		intel_fb = ifbdev->fb = NULL;
> >  	}
> > +	if (intel_fb &&
> > +	    (sizes->surface_depth != intel_fb->base.format->depth ||
> > +	     sizes->surface_bpp != intel_fb->base.format->cpp[0] * 8)) {
> 
> Bikeshed: A little helper that does all these checks with debug output,
> and just one "throw bios fb away" path would look a lot neater.
> -Daniel
> 
> > +		DRM_DEBUG_KMS("BIOS fb using wrong depth/bpp (%d/%d), we require (%d/%d),"
> > +			      " releasing it\n",
> > +			      intel_fb->base.format->depth,
> > +			      intel_fb->base.format->cpp[0] * 8,
> > +			      sizes->surface_depth, sizes->surface_bpp);
> > +		drm_framebuffer_put(&intel_fb->base);
> > +		intel_fb = ifbdev->fb = NULL;
> > +	}
> >  	if (!intel_fb || WARN_ON(!intel_fb_obj(&intel_fb->base))) {
> >  		DRM_DEBUG_KMS("no BIOS fb, allocating a new one\n");
> >  		ret = intelfb_alloc(helper, sizes);
> > -- 
> > 2.21.0
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Ville Syrjälä
Intel


More information about the dri-devel mailing list