[Intel-gfx] [PATCH 6/8] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v7
Chris Wilson
chris at chris-wilson.co.uk
Tue Dec 17 20:29:00 CET 2013
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;
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list