drm/i915: Reject page flips with changed format/offset/pitch
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 24 May 2012 18:08:59 +0000 (21:08 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 5 Jul 2012 11:29:45 +0000 (13:29 +0200)
MI display flips can't handle some changes in the framebuffer
format or layout. Return an error in such cases.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_display.c

index 4d84fcdd413f900714a9388472f33616173acdfe..7e31f7af0de8761bf3228f8281f92dced0af7f07 100644 (file)
@@ -6438,6 +6438,19 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
        unsigned long flags;
        int ret;
 
+       /* Can't change pixel format via MI display flips. */
+       if (fb->pixel_format != crtc->fb->pixel_format)
+               return -EINVAL;
+
+       /*
+        * TILEOFF/LINOFF registers can't be changed via MI display flips.
+        * Note that pitch changes could also affect these register.
+        */
+       if (INTEL_INFO(dev)->gen > 3 &&
+           (fb->offsets[0] != crtc->fb->offsets[0] ||
+            fb->pitches[0] != crtc->fb->pitches[0]))
+               return -EINVAL;
+
        work = kzalloc(sizeof *work, GFP_KERNEL);
        if (work == NULL)
                return -ENOMEM;