[Intel-gfx] [PATCH 6/8] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v7

Jesse Barnes jbarnes at virtuousgeek.org
Tue Dec 17 22:11:55 CET 2013


On Tue, 17 Dec 2013 19:29:00 +0000
Chris Wilson <chris at chris-wilson.co.uk> wrote:

> On Mon, Dec 16, 2013 at 04:34:27PM -0800, Jesse Barnes wrote:
> >  int intel_fbdev_init(struct drm_device *dev)
> > @@ -268,17 +461,25 @@ int intel_fbdev_init(struct drm_device *dev)
> >  	struct drm_i915_private *dev_priv = dev->dev_private;
> >  	int ret;
> >  
> > -	ifbdev = kzalloc(sizeof(*ifbdev), GFP_KERNEL);
> > -	if (!ifbdev)
> > -		return -ENOMEM;
> > +	/* This may fail, if so, dev_priv->fbdev won't be set below */
> > +	intel_fbdev_init_bios(dev);
> >  
> > -	dev_priv->fbdev = ifbdev;
> > -	ifbdev->helper.funcs = &intel_fb_helper_funcs;
> > +	if ((ifbdev = dev_priv->fbdev) == NULL) {
> > +		ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
> > +		if (ifbdev == NULL)
> > +			return -ENOMEM;
> > +
> > +		ifbdev->helper.funcs = &intel_fb_helper_funcs;
> > +		ifbdev->preferred_bpp = 32;
> > +
> > +		dev_priv->fbdev = ifbdev;
> > +	}
> 
> Since Daniel also mentioned the same bikeshed, I think this would look
> neater with the allocation here and ifbdev being passed to
> intel_fbdev_init_bios to fill in:
> 
> 	ifbdev = kzalloc(sizeof(*ifbdev), GFP_KERNEL);
> 	if (ifbdev == NULL)
> 		return -ENODEV;
> 	
> 	if (!intel_fbdev_init_bios(dev, ifbdev)) {
> 		ifbdev->helper.funcs = &intel_fb_helper_funcs;
> 		ifbdev->preferred_bpp = 32;
> 	}
> 
> 	dev_priv->fbdev = ifbdev;
> 	return 0;

Yeah, looks better that way.  Fixed.

-- 
Jesse Barnes, Intel Open Source Technology Center



More information about the Intel-gfx mailing list