Skip to contentSkip to conversation

fixup pageflip for i8xx class hw

PATCH In review Daniel Vetter 5 participants 8 messages Aug 4, 2010

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

cover fixup pageflip for i8xx class hw

Hi all,

Kde4 started using pageflips and I started noticing that it's decently broken on my i855. These two patches fix things up, here.

Please review and merge for -next.

Thanks, Daniel

PS: Any news on a documentation drop for gen2/gen3? Switching on my X-ray vision and deducing the correct magic dance from the chip's circuit layout is slowly getting boring ... ;)

Daniel Vetter (2):
drm/i915: fixup pageflip ringbuffer commands for i8xx drm/i915: i8xx also doesn't like multiple oustanding pageflips

 drivers/gpu/drm/i915/intel_display.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
#1 lore raw

PATCH 1/2 drm/i915: fixup pageflip ringbuffer commands for i8xx

Add a new path for 2nd gen chips that uses the commands for i81x chips (where public docs do exist) augmented with the plane bits from i915. It seems to work and doesn't result in a black screen like before.

---
 drivers/gpu/drm/i915/intel_display.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/intel_display.c +7 -1
index 8359c50..8135ee0 100644
@@ -4933,12 +4933,18 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 		OUT_RING(obj_priv->gtt_offset | obj_priv->tiling_mode);
 		pipesrc = I915_READ(pipesrc_reg); 
 		OUT_RING(pipesrc & 0x0fff0fff);
-	} else {
+	} else if (IS_GEN3(dev)) {
 		OUT_RING(MI_DISPLAY_FLIP_I915 |
 			 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
 		OUT_RING(fb->pitch);
 		OUT_RING(obj_priv->gtt_offset);
 		OUT_RING(MI_NOOP);
+	} else {
+		OUT_RING(MI_DISPLAY_FLIP |
+			 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
+		OUT_RING(fb->pitch);
+		OUT_RING(obj_priv->gtt_offset);
+		OUT_RING(MI_NOOP);
 	}
 	ADVANCE_LP_RING();
 
Signature · 1 line
1.7.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] drm/i915: fixup pageflip ringbuffer commands for i8xx

Quoted 24 lines · On Wed, 4 Aug 2010 21:22:09 +0200 Daniel Vetter <[email protected]> wrote:

Add a new path for 2nd gen chips that uses the commands for i81x chips (where public docs do exist) augmented with the plane bits from i915. It seems to work and doesn't result in a black screen like before.

---
 drivers/gpu/drm/i915/intel_display.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index 8359c50..8135ee0 100644
@@ -4933,12 +4933,18 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 		OUT_RING(obj_priv->gtt_offset | obj_priv->tiling_mode);
 		pipesrc = I915_READ(pipesrc_reg); 
 		OUT_RING(pipesrc & 0x0fff0fff);
-	} else {
+	} else if (IS_GEN3(dev)) {
 		OUT_RING(MI_DISPLAY_FLIP_I915 |
 			 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
 		OUT_RING(fb->pitch);

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

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +6 -0
 		OUT_RING(obj_priv->gtt_offset);
 		OUT_RING(MI_NOOP);
+	} else {
+		OUT_RING(MI_DISPLAY_FLIP |
+			 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
+		OUT_RING(fb->pitch);
+		OUT_RING(obj_priv->gtt_offset);
+		OUT_RING(MI_NOOP);
 	}
 	ADVANCE_LP_RING();

Yep, looks fine.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#3 lore raw

PATCH 2/2 drm/i915: i8xx also doesn't like multiple oustanding pageflips

In reply to Daniel Vetter

My i855GM suffers from a 80k/s interrupt storm without this. So add 2nd gen to the list of things that don't like more than one outstanding pageflip request.

Furthermore I've changed the busy loop into a ringbuffer wait. Busy-loops that don't check whether the chip died are simply evil. And performance should actually improve, because there's usually a decent amount of rendering queued on the gpu, hopefully rendering that MI_WAIT into a noop by the time it's executed.

The current code holds dev->struct_mutex while executing this loop, hence stalling all other gem activity anyway.

---
 drivers/gpu/drm/i915/intel_display.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +8 -5
index 8135ee0..7b6035e 100644
@@ -4916,14 +4916,17 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	work->pending_flip_obj = obj;
 
 	if (intel_crtc->plane)
-		flip_mask = I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
+		flip_mask = MI_WAIT_FOR_PLANE_B_FLIP;
 	else
-		flip_mask = I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT;
+		flip_mask = MI_WAIT_FOR_PLANE_A_FLIP;
 
 	/* Wait for any previous flip to finish */
-	if (IS_GEN3(dev))
-		while (I915_READ(ISR) & flip_mask)
-			;
+	if (IS_GEN3(dev) || IS_GEN2(dev)) {
+		BEGIN_LP_RING(2);
+		OUT_RING(MI_WAIT_FOR_EVENT | flip_mask);
+		OUT_RING(0);
+		ADVANCE_LP_RING();
+	}
 
 	BEGIN_LP_RING(4);
 	if (IS_I965G(dev)) {
Signature · 1 line
1.7.1
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] drm/i915: i8xx also doesn't like multiple oustanding pageflips

Quoted 36 lines · On Wed, 4 Aug 2010 21:22:10 +0200 Daniel Vetter <[email protected]> wrote:

My i855GM suffers from a 80k/s interrupt storm without this. So add 2nd gen to the list of things that don't like more than one outstanding pageflip request.

Furthermore I've changed the busy loop into a ringbuffer wait. Busy-loops that don't check whether the chip died are simply evil. And performance should actually improve, because there's usually a decent amount of rendering queued on the gpu, hopefully rendering that MI_WAIT into a noop by the time it's executed.

The current code holds dev->struct_mutex while executing this loop, hence stalling all other gem activity anyway.

---
 drivers/gpu/drm/i915/intel_display.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -4
index 8135ee0..7b6035e 100644
@@ -4916,14 +4916,17 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	work->pending_flip_obj = obj;
 
 	if (intel_crtc->plane)
-		flip_mask = I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
+		flip_mask = MI_WAIT_FOR_PLANE_B_FLIP;
 	else
-		flip_mask = I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT;
+		flip_mask = MI_WAIT_FOR_PLANE_A_FLIP;
 
 	/* Wait for any previous flip to finish */
-	if (IS_GEN3(dev))
-		while (I915_READ(ISR) & flip_mask)

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

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +6 -1
-			;
+	if (IS_GEN3(dev) || IS_GEN2(dev)) {
+		BEGIN_LP_RING(2);
+		OUT_RING(MI_WAIT_FOR_EVENT | flip_mask);
+		OUT_RING(0);
+		ADVANCE_LP_RING();
+	}
 
 	BEGIN_LP_RING(4);
 	if (IS_I965G(dev)) {

This looks nicer than what was there before. Hope it still works on 9xx...

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#5 lore raw

Re: [PATCH 2/2] drm/i915: i8xx also doesn't like multiple oustanding pageflips

Quoted 53 lines · Jesse Barnes
Quoted 44 lines · On Wed,  4 Aug 2010 21:22:10 +0200 Daniel Vetter <[email protected]> wrote:

My i855GM suffers from a 80k/s interrupt storm without this. So add 2nd gen to the list of things that don't like more than one outstanding pageflip request.

Furthermore I've changed the busy loop into a ringbuffer wait. Busy-loops that don't check whether the chip died are simply evil. And performance should actually improve, because there's usually a decent amount of rendering queued on the gpu, hopefully rendering that MI_WAIT into a noop by the time it's executed.

The current code holds dev->struct_mutex while executing this loop, hence stalling all other gem activity anyway.

---
 drivers/gpu/drm/i915/intel_display.c |   13 ++++++++-----

 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index 8135ee0..7b6035e 100644
@@ -4916,14 +4916,17 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
       work->pending_flip_obj = obj;
 
       if (intel_crtc->plane)
-             flip_mask = I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
+             flip_mask = MI_WAIT_FOR_PLANE_B_FLIP;

      else
-             flip_mask = I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT;
+             flip_mask = MI_WAIT_FOR_PLANE_A_FLIP;

      /* Wait for any previous flip to finish */
-     if (IS_GEN3(dev))
-             while (I915_READ(ISR) & flip_mask)
-                     ;
+     if (IS_GEN3(dev) || IS_GEN2(dev)) {
+             BEGIN_LP_RING(2);
+             OUT_RING(MI_WAIT_FOR_EVENT | flip_mask);
+             OUT_RING(0);
+             ADVANCE_LP_RING();
+     }

Quoted 2 lines

      BEGIN_LP_RING(4);
      if (IS_I965G(dev)) {

This looks nicer than what was there before.  Hope it still works on 9xx...

Quoted 9 lines

--
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Just to warn: you sent the patch to the wrong address ([email protected] instead of [email protected]).

Regards,
Pedro

#6 lore raw

Re: [PATCH 2/2] drm/i915: i8xx also does not like multiple oustanding pageflips

In reply to Daniel Vetter
Quoted 33 lines · Daniel Vetter

My i855GM suffers from a 80k/s interrupt storm without this. So add 2nd gen to the list of things that don't like more than one outstanding pageflip request.

Furthermore I've changed the busy loop into a ringbuffer wait. Busy-loops that don't check whether the chip died are simply evil. And performance should actually improve, because there's usually a decent amount of rendering queued on the gpu, hopefully rendering that MI_WAIT into a noop by the time it's executed.

The current code holds dev->struct_mutex while executing this loop, hence stalling all other gem activity anyway.

---
 drivers/gpu/drm/i915/intel_display.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
index 8135ee0..7b6035e 100644
@@ -4916,14 +4916,17 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	work->pending_flip_obj = obj;
 
 	if (intel_crtc->plane)
-		flip_mask = I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
+		flip_mask = MI_WAIT_FOR_PLANE_B_FLIP;
 	else
-		flip_mask = I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT;
+		flip_mask = MI_WAIT_FOR_PLANE_A_FLIP;
 

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

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +6 -3
 	/* Wait for any previous flip to finish */
-	if (IS_GEN3(dev))
-		while (I915_READ(ISR) & flip_mask)
-			;
+	if (IS_GEN3(dev) || IS_GEN2(dev)) {
+		BEGIN_LP_RING(2);
+		OUT_RING(MI_WAIT_FOR_EVENT | flip_mask);
+		OUT_RING(0);
+		ADVANCE_LP_RING();
+	}

If you move the if(intel_crtc->plane) inside the gen2/3 block, then I'll test it on my netbooks. :)

Starting to look like intel_overlay.c ;-)

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

Re: [PATCH 2/2] drm/i915: i8xx also does not like multiple oustanding pageflips

Quoted 2 lines · Chris Wilson

If you move the if(intel_crtc->plane) inside the gen2/3 block, then I'll test it on my netbooks. :)

I believe the compiler will happily do that for you ;)

Quoted 1 line

Starting to look like intel_overlay.c ;-)

Well, that's actually one of the things on my idea for drm/i915 projects:
To unify the overlay/display plane pageflip support code.

-Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48