[PATCH 4/4] drm/i915: Throw away the BIOS fb if has the wrong depth/bpp
Ville Syrjala
ville.syrjala at linux.intel.com
Fri Jun 7 16:26:11 UTC 2019
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>
---
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)) {
+ 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
More information about the dri-devel
mailing list