All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Andrew Lutomirski <luto@mit.edu>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [ANNOUNCE] xf86-video-intel 2.11.901
Date: Thu, 17 Jun 2010 13:32:17 -0700	[thread overview]
Message-ID: <20100617133217.5babef34@virtuousgeek.org> (raw)
In-Reply-To: <AANLkTingR0YaNlHJnIgJFx5HPufyyo_L5mm6YRRMaOwm@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1215 bytes --]

On Wed, 16 Jun 2010 11:07:21 -0400
Andrew Lutomirski <luto@mit.edu> wrote:

> On Wed, Jun 16, 2010 at 7:38 AM, Andrew Lutomirski <luto@mit.edu> wrote:
> > On Wed, Jun 16, 2010 at 7:25 AM, Marc Deop i Argemí <damnshock@gmail.com> wrote:
> >> On Wednesday June 16 2010 11:20:09 Chris Wilson wrote:
> >>
> >> Freeze is... freeze :P
> >>
> >> Now, seriously, the computer stops responding. I'm not able to switch between
> >> VT nor to ping nor login to the machine via my cell phone. If I'm playing
> >> sound the machine gets in kind of a loop with the last sound it played
> >> repeating again and again.
> >
> > No ping?  Sounds like a kernel bug to me.  You could try netconsole to
> > get a oops dump.
> 
> Hah.  I just got a freeze, too.  As in, frozen so hard that caps lock
> and magic sysrq didn't work.  This is git master from today
> (a25573d5c47ebea34c076075e1993233d7db2b4f).

Are these both on 945?  If so, can you guys try two of the patches I
posted earlier?  In particular:
  drm/i915: fix page flipping on gen3
  drm/i915: don't queue flips during a flip pending event

(attached but may only apply with fuzz).

-- 
Jesse Barnes, Intel Open Source Technology Center

[-- Attachment #2: 0006-drm-i915-fix-page-flipping-on-gen3.patch --]
[-- Type: text/x-patch, Size: 6935 bytes --]

>From 7153c638e0944af6fd81190a8f1ae3fc66054896 Mon Sep 17 00:00:00 2001
From: Jesse Barnes <jbarnes@virtuousgeek.org>
Date: Fri, 26 Mar 2010 10:35:20 -0700
Subject: [PATCH 6/7] drm/i915: fix page flipping on gen3

Gen3 chips have slightly different flip commands, and also contain a bit
that indicates whether a "flip pending" interrupt means the flip has
been queued or has been completed.

So implement support for the gen3 flip command, and make sure we use the
flip pending interrupt correctly depending on the value of ECOSKPD bit
0.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_dma.c      |    4 ++++
 drivers/gpu/drm/i915/i915_drv.h      |    1 +
 drivers/gpu/drm/i915/i915_irq.c      |   21 +++++++++++++++++----
 drivers/gpu/drm/i915/i915_reg.h      |    4 ++++
 drivers/gpu/drm/i915/intel_display.c |   29 ++++++++++++++++++++++++-----
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 6 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index a9f8589..193bf16 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1475,6 +1475,10 @@ static int i915_load_modeset_init(struct drm_device *dev,
 	if (ret)
 		goto destroy_ringbuffer;
 
+	/* IIR "flip pending" bit means done if this bit is set */
+	if (IS_GEN3(dev) && (I915_READ(ECOSKPD) & ECO_FLIP_DONE))
+		dev_priv->flip_pending_is_done = true;
+
 	intel_modeset_init(dev);
 
 	ret = drm_irq_install(dev);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index abf2713..4e41f0f 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -608,6 +608,7 @@ typedef struct drm_i915_private {
 	struct drm_crtc *plane_to_crtc_mapping[2];
 	struct drm_crtc *pipe_to_crtc_mapping[2];
 	wait_queue_head_t pending_flip_queue;
+	bool flip_pending_is_done;
 
 	/* Reclocking support */
 	bool render_reclock_avail;
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index b16bb0d..d5eeca6 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -924,22 +924,35 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
 			mod_timer(&dev_priv->hangcheck_timer, jiffies + DRM_I915_HANGCHECK_PERIOD);
 		}
 
-		if (iir & I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT)
+		if ((iir & I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT) &&
+		    !(pipeb_stats & pipe_vblank_mask)) {
+			DRM_ERROR("flip complete w/o vblank irq?\n");
+		}
+
+		if (iir & I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT) {
 			intel_prepare_page_flip(dev, 0);
+			if (dev_priv->flip_pending_is_done)
+				intel_finish_page_flip_plane(dev, 0);
+		}
 
-		if (iir & I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT)
+		if (iir & I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT) {
 			intel_prepare_page_flip(dev, 1);
+			if (dev_priv->flip_pending_is_done)
+				intel_finish_page_flip_plane(dev, 1);
+		}
 
 		if (pipea_stats & pipe_vblank_mask) {
 			vblank++;
 			drm_handle_vblank(dev, 0);
-			intel_finish_page_flip(dev, 0);
+			if (!dev_priv->flip_pending_is_done)
+				intel_finish_page_flip(dev, 0);
 		}
 
 		if (pipeb_stats & pipe_vblank_mask) {
 			vblank++;
 			drm_handle_vblank(dev, 1);
-			intel_finish_page_flip(dev, 1);
+			if (!dev_priv->flip_pending_is_done)
+				intel_finish_page_flip(dev, 1);
 		}
 
 		if ((pipeb_stats & PIPE_LEGACY_BLC_EVENT_STATUS) ||
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index df20187..9179b38 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -178,6 +178,7 @@
 #define   MI_OVERLAY_OFF	(0x2<<21)
 #define MI_LOAD_SCAN_LINES_INCL MI_INSTR(0x12, 0)
 #define MI_DISPLAY_FLIP		MI_INSTR(0x14, 2)
+#define MI_DISPLAY_FLIP_I915	MI_INSTR(0x14, 1)
 #define   MI_DISPLAY_FLIP_PLANE(n) ((n) << 20)
 #define MI_STORE_DWORD_IMM	MI_INSTR(0x20, 1)
 #define   MI_MEM_VIRTUAL	(1 << 22) /* 965+ only */
@@ -357,6 +358,9 @@
 #define   CM0_RC_OP_FLUSH_DISABLE (1<<0)
 #define BB_ADDR		0x02140 /* 8 bytes */
 #define GFX_FLSH_CNTL	0x02170 /* 915+ only */
+#define ECOSKPD		0x021d0
+#define   ECO_GATING_CX_ONLY	(1<<3)
+#define   ECO_FLIP_DONE		(1<<0)
 
 
 /*
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 92ca56c..cd6f8b7 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4136,10 +4136,10 @@ static void intel_unpin_work_fn(struct work_struct *__work)
 	kfree(work);
 }
 
-void intel_finish_page_flip(struct drm_device *dev, int pipe)
+static void do_intel_finish_page_flip(struct drm_device *dev,
+				      struct drm_crtc *crtc)
 {
 	drm_i915_private_t *dev_priv = dev->dev_private;
-	struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct intel_unpin_work *work;
 	struct drm_i915_gem_object *obj_priv;
@@ -4189,6 +4189,22 @@ void intel_finish_page_flip(struct drm_device *dev, int pipe)
 	schedule_work(&work->work);
 }
 
+void intel_finish_page_flip(struct drm_device *dev, int pipe)
+{
+	drm_i915_private_t *dev_priv = dev->dev_private;
+	struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+
+	do_intel_finish_page_flip(dev, crtc);
+}
+
+void intel_finish_page_flip_plane(struct drm_device *dev, int plane)
+{
+	drm_i915_private_t *dev_priv = dev->dev_private;
+	struct drm_crtc *crtc = dev_priv->plane_to_crtc_mapping[plane];
+
+	do_intel_finish_page_flip(dev, crtc);
+}
+
 void intel_prepare_page_flip(struct drm_device *dev, int plane)
 {
 	drm_i915_private_t *dev_priv = dev->dev_private;
@@ -4270,14 +4286,17 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	work->pending_flip_obj = obj;
 
 	BEGIN_LP_RING(4);
-	OUT_RING(MI_DISPLAY_FLIP |
-		 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
-	OUT_RING(fb->pitch);
 	if (IS_I965G(dev)) {
+		OUT_RING(MI_DISPLAY_FLIP |
+			 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
+		OUT_RING(fb->pitch);
 		OUT_RING(obj_priv->gtt_offset | obj_priv->tiling_mode);
 		pipesrc = I915_READ(pipesrc_reg); 
 		OUT_RING(pipesrc & 0x0fff0fff);
 	} else {
+		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);
 	}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 3a467ca..8323225 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -219,6 +219,7 @@ extern int intel_framebuffer_create(struct drm_device *dev,
 
 extern void intel_prepare_page_flip(struct drm_device *dev, int plane);
 extern void intel_finish_page_flip(struct drm_device *dev, int pipe);
+extern void intel_finish_page_flip_plane(struct drm_device *dev, int plane);
 
 extern void intel_setup_overlay(struct drm_device *dev);
 extern void intel_cleanup_overlay(struct drm_device *dev);
-- 
1.6.1.3


[-- Attachment #3: 0003-drm-i915-don-t-queue-flips-during-a-flip-pending-eve.patch --]
[-- Type: text/x-patch, Size: 1744 bytes --]

>From a8ddc8b3743abb72b6c7e26ce75ae98d93d92133 Mon Sep 17 00:00:00 2001
From: Jesse Barnes <jbarnes@virtuousgeek.org>
Date: Mon, 5 Apr 2010 14:03:51 -0700
Subject: [PATCH 3/3] drm/i915: don't queue flips during a flip pending event

Hardware will set the flip pending ISR bit as soon as it receives the
flip instruction, and (supposedly) clear it once the flip completes
(e.g. at the next vblank).  If we try to send down a flip instruction
while the ISR bit is set, the hardware can become very confused, and we
may never receive the corresponding flip pending interrupt, effectively
hanging the chip.

Fixes fdo bug #27040.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 6f5e7f5..24853e1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4235,6 +4235,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	unsigned long flags;
 	int pipesrc_reg = (intel_crtc->pipe == 0) ? PIPEASRC : PIPEBSRC;
 	int ret, pipesrc;
+	u32 flip_mask;
 	RING_LOCALS;
 
 	work = kzalloc(sizeof *work, GFP_KERNEL);
@@ -4285,6 +4286,15 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	atomic_inc(&obj_priv->pending_flip);
 	work->pending_flip_obj = obj;
 
+	if (intel_crtc->plane)
+		flip_mask = I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
+	else
+		flip_mask = I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT;
+
+	/* Wait for any previous flip to finish */
+	while (I915_READ(ISR) & flip_mask)
+		;
+
 	BEGIN_LP_RING(4);
 	if (IS_I965G(dev)) {
 		OUT_RING(MI_DISPLAY_FLIP |
-- 
1.6.6.1


[-- Attachment #4: Type: text/plain, Size: 159 bytes --]

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

  reply	other threads:[~2010-06-17 20:33 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15  0:39 [ANNOUNCE] xf86-video-intel 2.11.901 Carl Worth
2010-06-15  9:18 ` Julien Cristau
2010-06-15 16:46   ` Carl Worth
2010-06-15 16:51     ` Julien Cristau
2010-06-15 17:16   ` Sergio Monteiro Basto
2010-06-15 17:31     ` Julien Cristau
2010-06-15 17:46       ` Sergio Monteiro Basto
2010-06-15 14:05 ` Marc Deop i Argemí
2010-06-15 14:18   ` Julien Cristau
2010-06-15 15:02     ` Marc Deop i Argemí
2010-06-15 16:47   ` Carl Worth
2010-06-15 17:12     ` Marc Deop i Argemí
2010-06-15 21:23       ` Carl Worth
2010-06-16  8:45         ` Marc Deop i Argemí
2010-06-16 13:10           ` Marc Deop i Argemí
2010-06-16 13:57             ` Chris Wilson
2010-06-16 16:12               ` Marc Deop i Argemí
2010-06-17 13:30                 ` Marc Deop i Argemí
2010-06-17 21:34     ` Elias Gabriel Amaral da Silva
2010-06-18  6:09       ` Carl Worth
2010-06-21  5:09         ` Elias Gabriel Amaral da Silva
2010-06-21  6:08           ` Elias Gabriel Amaral da Silva
2010-06-21  6:37             ` Christopher James Halse Rogers
2010-06-22 18:42               ` Elias Gabriel Amaral da Silva
2010-06-21  5:31         ` Elias Gabriel Amaral da Silva
2010-06-25  6:23           ` Carl Worth
2010-06-25  8:53             ` Clemens Eisserer
2010-06-16  9:20   ` Chris Wilson
2010-06-16 11:25     ` Marc Deop i Argemí
2010-06-16 11:38       ` Andrew Lutomirski
2010-06-16 15:07         ` Andrew Lutomirski
2010-06-17 20:32           ` Jesse Barnes [this message]
2010-06-17 22:27             ` Marc Deop i Argemí
2010-06-18  0:17             ` Andrew Lutomirski
2010-06-18  0:20               ` Marc Deop i Argemí
2010-06-18  2:44                 ` Jesse Barnes
2010-06-18 20:04                   ` Jesse Barnes
2010-06-18 20:07                     ` Jesse Barnes
2010-06-19 16:35                     ` Marc Deop i Argemí
2010-06-20 15:29                     ` Andrew Lutomirski
2010-06-21 20:32                       ` Andrew Lutomirski
2010-06-23 16:07                         ` Jesse Barnes
2010-07-01 20:55                           ` Andrew Lutomirski
2010-07-01 21:21                             ` Jesse Barnes
2010-07-01 21:34                               ` Andrew Lutomirski
2010-06-15 14:54 ` Vasily Khoruzhick
2010-06-15 16:49   ` Carl Worth
2010-06-15 16:55     ` Vasily Khoruzhick
2010-06-15 17:36       ` Vasily Khoruzhick
2010-06-15 19:58   ` Clemens Eisserer
2010-06-15 20:15     ` Chris Wilson
2010-06-15 21:03       ` Clemens Eisserer
2010-06-15 21:26         ` Carl Worth
2010-06-15 21:40         ` Chris Wilson
2010-06-15 22:05           ` Clemens Eisserer
2010-06-15 22:24             ` Clemens Eisserer
2010-06-15 22:31             ` Chris Wilson
2010-06-15 22:56               ` Clemens Eisserer
2010-06-16  5:45       ` Vasily Khoruzhick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100617133217.5babef34@virtuousgeek.org \
    --to=jbarnes@virtuousgeek.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=luto@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.