Skip to contentSkip to conversation

drm/i915: split page flip queueing into per-chipset functions

PATCH In review Jesse Barnes 2 participants 5 messages Jun 14, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/i915: split page flip queueing into per-chipset functions

This makes things a little clearer and prevents us from running old code on a new chipset that may not be supported.

---
 drivers/gpu/drm/i915/i915_drv.h      |    3 +
 drivers/gpu/drm/i915/intel_display.c |  196 ++++++++++++++++++++++++---------
 2 files changed, 145 insertions(+), 54 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +3 -0
index f63ee16..eddabf6 100644
@@ -211,6 +211,9 @@ struct drm_i915_display_funcs {
 	void (*fdi_link_train)(struct drm_crtc *crtc);
 	void (*init_clock_gating)(struct drm_device *dev);
 	void (*init_pch_clock_gating)(struct drm_device *dev);
+	int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc,
+			  struct drm_framebuffer *fb,
+			  struct drm_i915_gem_object *obj);
 	/* clock updates for mode set */
 	/* cursor updates */
 	/* render clock increase/decrease */
drivers/gpu/drm/i915/intel_display.c +142 -54

226 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 2/2 drm/i915: add Ivy Bridge page flip support

Use the blit ring for submitting flips since the render ring doesn't generate flip complete interrupts.

---
 drivers/gpu/drm/i915/intel_display.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/intel_display.c +25 -0
index 06748f3a..3d095de 100644
@@ -6379,6 +6379,28 @@ out:
 	return ret;
 }
 
+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);
+	int ret;
+
+	ret = intel_ring_begin(&dev_priv->ring[BCS], 4);
+	if (ret)
+		goto out;
+
+	intel_ring_emit(&dev_priv->ring[BCS], (MI_DISPLAY_FLIP_I915 | (intel_crtc->plane << 19)) | (1 << 17));
+	intel_ring_emit(&dev_priv->ring[BCS], (fb->pitch | obj->tiling_mode));
+	intel_ring_emit(&dev_priv->ring[BCS], (obj->gtt_offset));
+	intel_ring_emit(&dev_priv->ring[BCS], (MI_NOOP));
+	intel_ring_advance(&dev_priv->ring[BCS]);
+out:
+	return ret;
+}
+
 static int intel_crtc_page_flip(struct drm_crtc *crtc,
 				struct drm_framebuffer *fb,
 				struct drm_pending_vblank_event *event)
@@ -7744,6 +7766,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;
 	}
 }
 
Signature · 1 line
1.7.4.1
#2 lore raw

Re: [PATCH 2/2] drm/i915: add Ivy Bridge page flip support

Quoted 13 lines · Jesse Barnes

Use the blit ring for submitting flips since the render ring doesn't generate flip complete interrupts.

---
 drivers/gpu/drm/i915/intel_display.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 06748f3a..3d095de 100644

drivers/gpu/drm/i915/intel_display.c out: · line 6388

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +7 -0
@@ -6379,6 +6379,28 @@ out:
 	return ret;
 }
 
+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];

drivers/gpu/drm/i915/intel_display.c out: · line 6395

Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +7 -0
+	int ret;
+
+	ret = intel_ring_begin(&dev_priv->ring[BCS], 4);
+	if (ret)
+		goto out;
+
+	intel_ring_emit(&dev_priv->ring[BCS], (MI_DISPLAY_FLIP_I915 | (intel_crtc->plane << 19)) | (1 << 17));

What's the magic number? 80 column limit?
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#3 lore raw

Re: [PATCH 2/2] drm/i915: add Ivy Bridge page flip support

Quoted 25 lines · On Tue, 14 Jun 2011 19:22:33 +0100 Chris Wilson <[email protected]>…
Quoted 13 lines · Jesse Barnes

Use the blit ring for submitting flips since the render ring doesn't generate flip complete interrupts.

---
 drivers/gpu/drm/i915/intel_display.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 06748f3a..3d095de 100644

drivers/gpu/drm/i915/intel_display.c out: · line 6388

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +7 -0
@@ -6379,6 +6379,28 @@ out:
 	return ret;
 }
 
+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];

Quoted 9 lines

drivers/gpu/drm/i915/intel_display.c out: · line 6395

Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +7 -0
+	int ret;
+
+	ret = intel_ring_begin(&dev_priv->ring[BCS], 4);
+	if (ret)
+		goto out;
+
+	intel_ring_emit(&dev_priv->ring[BCS], (MI_DISPLAY_FLIP_I915 | (intel_crtc->plane << 19)) | (1 << 17));

What's the magic number? 80 column limit?
-Chris

All good points. See the updated patches.

Thanks,

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#4 lore raw
In reply to Jesse Barnes

drivers/gpu/drm/i915/intel_display.c static int intel_crtc_page_flip(struct drm_crtc *crtc, · line 6466

Quoted 11 lines · Jesse Barnes
drivers/gpu/drm/i915/intel_display.c +6 -1
@@ -6343,7 +6458,12 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	/* Offset into the new buffer for cases of shared fbs between CRTCs */
 	offset = crtc->y * fb->pitch + crtc->x * fb->bits_per_pixel/8;
 
-	ret = BEGIN_LP_RING(4);
+	if (!dev_priv->display.queue_flip) {
+		ret = -ENODEV;
+		goto cleanup_objs;
+	}
+
+	ret = dev_priv->display.queue_flip(dev, crtc, fb, obj);

Neil Brown would recommend that we use a default queue_flip that returns -ENODEV which both removes lines of code from this complicated routine and optimises the common case. I agree with him. :)
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre