From: Ville Syrjälä <ville.syrj...@linux.intel.com>

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

Signed-off-by: Ville Syrjälä <ville.syrj...@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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to