diff mbox

[9/9] drm/i915: FBC only supports 16bpp and 32bpp

Message ID 1419338145-1912-10-git-send-email-przanoni@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paulo Zanoni Dec. 23, 2014, 12:35 p.m. UTC
From: Paulo Zanoni <paulo.r.zanoni@intel.com>

So check for this.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/intel_fbc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index 80bdbde..8c6fb1d 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -515,6 +515,7 @@  static void __intel_fbc_update(struct drm_device *dev)
 	struct drm_i915_gem_object *obj;
 	const struct drm_display_mode *adjusted_mode;
 	unsigned int max_width, max_height;
+	int fb_cpp;
 
 	lockdep_assert_held(&dev_priv->fbc.lock);
 
@@ -598,6 +599,13 @@  static void __intel_fbc_update(struct drm_device *dev)
 		goto out_disable;
 	}
 
+	fb_cpp = drm_format_plane_cpp(fb->pixel_format, 0);
+	if (!(fb_cpp == 2 || fb_cpp == 4)) {
+		if (set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED_MODE));
+			DRM_DEBUG_KMS("FBC only supports 16bpp and 32bpp\n");
+		goto out_disable;
+	}
+
 	/* If the kernel debugger is active, always disable compression */
 	if (in_dbg_master())
 		goto out_disable;
@@ -640,8 +648,7 @@  static void __intel_fbc_update(struct drm_device *dev)
 		__intel_fbc_disable(dev);
 	}
 
-	if (i915_gem_stolen_setup_compression(dev, obj->base.size,
-					      drm_format_plane_cpp(fb->pixel_format, 0))) {
+	if (i915_gem_stolen_setup_compression(dev, obj->base.size, fb_cpp)) {
 		if (set_no_fbc_reason(dev_priv, FBC_STOLEN_TOO_SMALL))
 			DRM_DEBUG_KMS("framebuffer too large, disabling compression\n");
 		return;