[Intel-gfx] [PATCH 10/25] drm/i915: Check pixel format for fbc

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Wed Jun 18 19:58:43 CEST 2014


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

fbc is only possible with certain pixel formats. Check for those before
enabling fbc.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 50 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index b09d1a2..0fcc0c6 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -508,6 +508,32 @@ static bool intel_fbc1_possible(struct intel_crtc *crtc)
 		return false;
 	}
 
+	/*
+	 * Planes A & B don't support alpha, so
+	 * the "A" formats and "X" formats are
+	 * one and the same.
+	 */
+	switch (fb->pixel_format) {
+	case DRM_FORMAT_XRGB8888:
+	case DRM_FORMAT_ARGB8888:
+	case DRM_FORMAT_XBGR8888:
+	case DRM_FORMAT_ABGR8888:
+		break;
+	case DRM_FORMAT_XRGB1555:
+	case DRM_FORMAT_ARGB1555:
+	case DRM_FORMAT_RGB565:
+		/* 16bpp not supported on gen2 */
+		if (!IS_GEN2(dev))
+			break;
+
+		/* fall through */
+	default:
+		DRM_DEBUG("FBC pipe %c, plane %c: framebuffer format (%s) unsupported\n",
+			  pipe_name(crtc->pipe), plane_name(crtc->plane),
+			  drm_get_format_name(fb->pixel_format));
+		return false;
+	}
+
 	obj = to_intel_framebuffer(fb)->obj;
 
 	if (obj->tiling_mode != I915_TILING_X ||
@@ -597,6 +623,30 @@ static bool intel_fbc2_possible(struct intel_crtc *crtc)
 		return false;
 	}
 
+	/*
+	 * Primary planes don't support alpha, so
+	 * the "A" formats and "X" formats are
+	 * one and the same.
+	 */
+	switch (fb->pixel_format) {
+	case DRM_FORMAT_XRGB8888:
+	case DRM_FORMAT_ARGB8888:
+	case DRM_FORMAT_XBGR8888:
+	case DRM_FORMAT_ABGR8888:
+		break;
+	case DRM_FORMAT_RGB565:
+		/* WaFbcOnly1to1Ratio:ctg */
+		if (!IS_G4X(dev))
+			break;
+
+		/* fall through */
+	default:
+		DRM_DEBUG("FBC pipe %c, plane %c: framebuffer format (%s) unsupported\n",
+			  pipe_name(crtc->pipe), plane_name(crtc->plane),
+			  drm_get_format_name(fb->pixel_format));
+		return false;
+	}
+
 	obj = to_intel_framebuffer(fb)->obj;
 
 	if (obj->tiling_mode != I915_TILING_X ||
-- 
1.8.5.5




More information about the Intel-gfx mailing list