drm/i915: add Ivy Bridge page flip support
authorJesse Barnes <jbarnes@virtuousgeek.org>
Thu, 16 Jun 2011 19:18:54 +0000 (12:18 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 27 Jun 2011 02:11:22 +0000 (19:11 -0700)
Use the blit ring for submitting flips since the render ring doesn't
generate flip complete interrupts.

Fixes bugs:

https://bugs.freedesktop.org/show_bug.cgi?id=38362
https://bugs.freedesktop.org/show_bug.cgi?id=38392
https://bugs.freedesktop.org/show_bug.cgi?id=38393

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Tested-by: Jian J Zhao <jian.j.zhao@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
drivers/gpu/drm/i915/intel_display.c

index 0f4ed2a575a4e9bf6c7f23003383792abab7c81a..21b6f93fe9196d277b2b2c7b926a8faf729706b8 100644 (file)
@@ -6411,6 +6411,39 @@ out:
        return ret;
 }
 
+/*
+ * On gen7 we currently use the blit ring because (in early silicon at least)
+ * the render ring doesn't give us interrpts for page flip completion, which
+ * means clients will hang after the first flip is queued.  Fortunately the
+ * blit ring generates interrupts properly, so use it instead.
+ */
+static int intel_gen7_queue_flip(struct drm_device *dev,
+                                struct drm_crtc *crtc,
+                                struct drm_framebuffer *fb,
+                                struct drm_i915_gem_object *obj)
+{
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+       struct intel_ring_buffer *ring = &dev_priv->ring[BCS];
+       int ret;
+
+       ret = intel_pin_and_fence_fb_obj(dev, obj, ring);
+       if (ret)
+               goto out;
+
+       ret = intel_ring_begin(ring, 4);
+       if (ret)
+               goto out;
+
+       intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | (intel_crtc->plane << 19));
+       intel_ring_emit(ring, (fb->pitch | obj->tiling_mode));
+       intel_ring_emit(ring, (obj->gtt_offset));
+       intel_ring_emit(ring, (MI_NOOP));
+       intel_ring_advance(ring);
+out:
+       return ret;
+}
+
 static int intel_default_queue_flip(struct drm_device *dev,
                                    struct drm_crtc *crtc,
                                    struct drm_framebuffer *fb,
@@ -7758,6 +7791,9 @@ static void intel_init_display(struct drm_device *dev)
        case 6:
                dev_priv->display.queue_flip = intel_gen6_queue_flip;
                break;
+       case 7:
+               dev_priv->display.queue_flip = intel_gen7_queue_flip;
+               break;
        }
 }