On Fri, Jun 07, 2019 at 07:26:11PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrj...@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.syrj...@linux.intel.com>

I guess we're going boom right now, which is maybe a bit much? i.e.
Cc: sta...@vger.kernel.org

Reviewed-by: Daniel Vetter <daniel.vet...@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-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to