All of lore.kernel.org
 help / color / mirror / Atom feed
* Remaining set of small patches for -rc1
@ 2010-08-11  9:31 Chris Wilson
  2010-08-11  9:31 ` [PATCH 01/11] drm/i915: Avoid using msleep under kdb and wait_for() Chris Wilson
                   ` (11 more replies)
  0 siblings, 12 replies; 21+ messages in thread
From: Chris Wilson @ 2010-08-11  9:31 UTC (permalink / raw)
  To: jbarnes; +Cc: intel-gfx

A couple of patches to tidy the merge with atomic modesetting. 2 patches
to fix the offset page-flipping. A patch to workaround one common cause of
hangs after modesetting whilst page-flipping, it's not the full patch but
it should prevent the hang in 99% of cases [statistic made up on the
spot], and with the additional reset in hangcheck should prevent a fatal
hang on i915. A couple of trivial patches that should help with a couple
of bugs. And the most fun, the asynchronous fbdev init which has been
tested by Meego and a few other adventurous fast booters.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 01/11] drm/i915: Avoid using msleep under kdb and wait_for()
  2010-08-11  9:31 Remaining set of small patches for -rc1 Chris Wilson
@ 2010-08-11  9:31 ` Chris Wilson
  2010-08-11 15:20   ` Jesse Barnes
  2010-08-11  9:31 ` [PATCH 02/11] drm/i915: Include a generation number in the device info Chris Wilson
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: Chris Wilson @ 2010-08-11  9:31 UTC (permalink / raw)
  To: jbarnes; +Cc: intel-gfx

wait_for() uses msleep() to yield the cpu whilst spinning waiting for a
register to change. kdb asserts that mode changes are atomic and so
prohibits msleep. The alternative would be to use mdelay or to simply
probe the register more often instead of busy waiting.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_drv.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index e6351e6..d93b7f0 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -41,7 +41,7 @@
 			ret__ = -ETIMEDOUT;				\
 			break;						\
 		}							\
-		if (W) msleep(W);					\
+		if (W && !in_dbg_master()) msleep(W);			\
 	}								\
 	ret__;								\
 })
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 02/11] drm/i915: Include a generation number in the device info
  2010-08-11  9:31 Remaining set of small patches for -rc1 Chris Wilson
  2010-08-11  9:31 ` [PATCH 01/11] drm/i915: Avoid using msleep under kdb and wait_for() Chris Wilson
@ 2010-08-11  9:31 ` Chris Wilson
  2010-08-11 15:22   ` Jesse Barnes
  2010-08-11  9:31 ` [PATCH 03/11] drm/i915: Fix offset page-flips on i965+ Chris Wilson
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: Chris Wilson @ 2010-08-11  9:31 UTC (permalink / raw)
  To: jbarnes; +Cc: intel-gfx

To simplify the IS_GEN[234] macros and to enable switching.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_drv.c |   61 ++++++++++++++++++---------------------
 drivers/gpu/drm/i915/i915_drv.h |   27 ++++-------------
 2 files changed, 34 insertions(+), 54 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 5044f65..8cc0b50 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -61,91 +61,86 @@ extern int intel_agp_enabled;
 	.driver_data = (unsigned long) info }
 
 static const struct intel_device_info intel_i830_info = {
-	.is_i8xx = 1, .is_mobile = 1, .cursor_needs_physical = 1,
+	.gen = 2, .is_i8xx = 1, .is_mobile = 1, .cursor_needs_physical = 1,
 };
 
 static const struct intel_device_info intel_845g_info = {
-	.is_i8xx = 1,
+	.gen = 2, .is_i8xx = 1,
 };
 
 static const struct intel_device_info intel_i85x_info = {
-	.is_i8xx = 1, .is_i85x = 1, .is_mobile = 1,
+	.gen = 2, .is_i8xx = 1, .is_i85x = 1, .is_mobile = 1,
 	.cursor_needs_physical = 1,
 };
 
 static const struct intel_device_info intel_i865g_info = {
-	.is_i8xx = 1,
+	.gen = 2, .is_i8xx = 1,
 };
 
 static const struct intel_device_info intel_i915g_info = {
-	.is_i915g = 1, .is_i9xx = 1, .cursor_needs_physical = 1,
+	.gen = 3, .is_i915g = 1, .is_i9xx = 1, .cursor_needs_physical = 1,
 };
 static const struct intel_device_info intel_i915gm_info = {
-	.is_i9xx = 1,  .is_mobile = 1,
+	.gen = 3, .is_i9xx = 1,  .is_mobile = 1,
 	.cursor_needs_physical = 1,
 };
 static const struct intel_device_info intel_i945g_info = {
-	.is_i9xx = 1, .has_hotplug = 1, .cursor_needs_physical = 1,
+	.gen = 3, .is_i9xx = 1, .has_hotplug = 1, .cursor_needs_physical = 1,
 };
 static const struct intel_device_info intel_i945gm_info = {
-	.is_i945gm = 1, .is_i9xx = 1, .is_mobile = 1,
+	.gen = 3, .is_i945gm = 1, .is_i9xx = 1, .is_mobile = 1,
 	.has_hotplug = 1, .cursor_needs_physical = 1,
 };
 
 static const struct intel_device_info intel_i965g_info = {
-	.is_broadwater = 1, .is_i965g = 1, .is_i9xx = 1, .has_hotplug = 1,
+	.gen = 4, .is_broadwater = 1, .is_i965g = 1, .is_i9xx = 1,
+	.has_hotplug = 1,
 };
 
 static const struct intel_device_info intel_i965gm_info = {
-	.is_crestline = 1, .is_i965g = 1, .is_i965gm = 1, .is_i9xx = 1,
-	.is_mobile = 1, .has_fbc = 1, .has_rc6 = 1,
-	.has_hotplug = 1,
+	.gen = 4, .is_crestline = 1, .is_i965g = 1, .is_i965gm = 1, .is_i9xx = 1,
+	.is_mobile = 1, .has_fbc = 1, .has_rc6 = 1, .has_hotplug = 1,
 };
 
 static const struct intel_device_info intel_g33_info = {
-	.is_g33 = 1, .is_i9xx = 1, .need_gfx_hws = 1,
-	.has_hotplug = 1,
+	.gen = 3, .is_g33 = 1, .is_i9xx = 1,
+	.need_gfx_hws = 1, .has_hotplug = 1,
 };
 
 static const struct intel_device_info intel_g45_info = {
-	.is_i965g = 1, .is_g4x = 1, .is_i9xx = 1, .need_gfx_hws = 1,
-	.has_pipe_cxsr = 1,
-	.has_hotplug = 1,
+	.gen = 4, .is_i965g = 1, .is_g4x = 1, .is_i9xx = 1, .need_gfx_hws = 1,
+	.has_pipe_cxsr = 1, .has_hotplug = 1,
 };
 
 static const struct intel_device_info intel_gm45_info = {
-	.is_i965g = 1, .is_g4x = 1, .is_i9xx = 1,
+	.gen = 4, .is_i965g = 1, .is_g4x = 1, .is_i9xx = 1,
 	.is_mobile = 1, .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1,
-	.has_pipe_cxsr = 1,
-	.has_hotplug = 1,
+	.has_pipe_cxsr = 1, .has_hotplug = 1,
 };
 
 static const struct intel_device_info intel_pineview_info = {
-	.is_g33 = 1, .is_pineview = 1, .is_mobile = 1, .is_i9xx = 1,
-	.need_gfx_hws = 1,
-	.has_hotplug = 1,
+	.gen = 3, .is_g33 = 1, .is_pineview = 1, .is_mobile = 1, .is_i9xx = 1,
+	.need_gfx_hws = 1, .has_hotplug = 1,
 };
 
 static const struct intel_device_info intel_ironlake_d_info = {
-	.is_ironlake = 1, .is_i965g = 1, .is_i9xx = 1, .need_gfx_hws = 1,
-	.has_pipe_cxsr = 1,
-	.has_hotplug = 1,
+	.gen = 5, .is_ironlake = 1, .is_i965g = 1, .is_i9xx = 1,
+	.need_gfx_hws = 1, .has_pipe_cxsr = 1, .has_hotplug = 1,
 };
 
 static const struct intel_device_info intel_ironlake_m_info = {
-	.is_ironlake = 1, .is_mobile = 1, .is_i965g = 1, .is_i9xx = 1,
-	.need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1,
-	.has_hotplug = 1,
+	.gen = 5, .is_ironlake = 1, .is_mobile = 1, .is_i965g = 1, .is_i9xx = 1,
+	.need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1, .has_hotplug = 1,
 };
 
 static const struct intel_device_info intel_sandybridge_d_info = {
-	.is_i965g = 1, .is_i9xx = 1, .need_gfx_hws = 1,
-	.has_hotplug = 1, .is_gen6 = 1,
+	.gen = 6, .is_i965g = 1, .is_i9xx = 1,
+	.need_gfx_hws = 1, .has_hotplug = 1,
 };
 
 static const struct intel_device_info intel_sandybridge_m_info = {
-	.is_i965g = 1, .is_mobile = 1, .is_i9xx = 1, .need_gfx_hws = 1,
-	.has_hotplug = 1, .is_gen6 = 1,
+	.gen = 6, .is_i965g = 1, .is_mobile = 1, .is_i9xx = 1,
+	.need_gfx_hws = 1, .has_hotplug = 1,
 };
 
 static const struct pci_device_id pciidlist[] = {		/* aka */
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 90b65cd..442e72e 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -191,6 +191,7 @@ struct drm_i915_display_funcs {
 };
 
 struct intel_device_info {
+	u8 gen;
 	u8 is_mobile : 1;
 	u8 is_i8xx : 1;
 	u8 is_i85x : 1;
@@ -206,7 +207,6 @@ struct intel_device_info {
 	u8 is_broadwater : 1;
 	u8 is_crestline : 1;
 	u8 is_ironlake : 1;
-	u8 is_gen6 : 1;
 	u8 has_fbc : 1;
 	u8 has_rc6 : 1;
 	u8 has_pipe_cxsr : 1;
@@ -1162,7 +1162,6 @@ extern void intel_overlay_print_error_state(struct seq_file *m, struct intel_ove
 #define IS_845G(dev)		((dev)->pci_device == 0x2562)
 #define IS_I85X(dev)		(INTEL_INFO(dev)->is_i85x)
 #define IS_I865G(dev)		((dev)->pci_device == 0x2572)
-#define IS_GEN2(dev)		(INTEL_INFO(dev)->is_i8xx)
 #define IS_I915G(dev)		(INTEL_INFO(dev)->is_i915g)
 #define IS_I915GM(dev)		((dev)->pci_device == 0x2592)
 #define IS_I945G(dev)		((dev)->pci_device == 0x2772)
@@ -1181,27 +1180,13 @@ extern void intel_overlay_print_error_state(struct seq_file *m, struct intel_ove
 #define IS_IRONLAKE_M(dev)	((dev)->pci_device == 0x0046)
 #define IS_IRONLAKE(dev)	(INTEL_INFO(dev)->is_ironlake)
 #define IS_I9XX(dev)		(INTEL_INFO(dev)->is_i9xx)
-#define IS_GEN6(dev)		(INTEL_INFO(dev)->is_gen6)
 #define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
 
-#define IS_GEN3(dev)	(IS_I915G(dev) ||			\
-			 IS_I915GM(dev) ||			\
-			 IS_I945G(dev) ||			\
-			 IS_I945GM(dev) ||			\
-			 IS_G33(dev) || \
-			 IS_PINEVIEW(dev))
-#define IS_GEN4(dev)	((dev)->pci_device == 0x2972 ||		\
-			 (dev)->pci_device == 0x2982 ||		\
-			 (dev)->pci_device == 0x2992 ||		\
-			 (dev)->pci_device == 0x29A2 ||		\
-			 (dev)->pci_device == 0x2A02 ||		\
-			 (dev)->pci_device == 0x2A12 ||		\
-			 (dev)->pci_device == 0x2E02 ||		\
-			 (dev)->pci_device == 0x2E12 ||		\
-			 (dev)->pci_device == 0x2E22 ||		\
-			 (dev)->pci_device == 0x2E32 ||		\
-			 (dev)->pci_device == 0x2A42 ||		\
-			 (dev)->pci_device == 0x2E42)
+#define IS_GEN2(dev)	(INTEL_INFO(dev)->gen == 2)
+#define IS_GEN3(dev)	(INTEL_INFO(dev)->gen == 3)
+#define IS_GEN4(dev)	(INTEL_INFO(dev)->gen == 4)
+#define IS_GEN5(dev)	(INTEL_INFO(dev)->gen == 5)
+#define IS_GEN6(dev)	(INTEL_INFO(dev)->gen == 6)
 
 #define HAS_BSD(dev)            (IS_IRONLAKE(dev) || IS_G4X(dev))
 #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 03/11] drm/i915: Fix offset page-flips on i965+
  2010-08-11  9:31 Remaining set of small patches for -rc1 Chris Wilson
  2010-08-11  9:31 ` [PATCH 01/11] drm/i915: Avoid using msleep under kdb and wait_for() Chris Wilson
  2010-08-11  9:31 ` [PATCH 02/11] drm/i915: Include a generation number in the device info Chris Wilson
@ 2010-08-11  9:31 ` Chris Wilson
  2010-08-11  9:31 ` [PATCH 04/11] drm/i915: Clear scanline waits after disabling the pipe Chris Wilson
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Chris Wilson @ 2010-08-11  9:31 UTC (permalink / raw)
  To: jbarnes; +Cc: intel-gfx

i965 uses the Display Registers to compute the offset from the display
base so the new base does not need adjusting when flipping. The older
chipsets use a fence to access the display and so do perceive the
surface as linear and have a single base register which is reprogrammed
using the flip.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Reported-by: Marty Jack <martyj19@comcast.net>
---
 drivers/gpu/drm/i915/intel_display.c |   67 ++++++++++++++++++++++++----------
 1 files changed, 48 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 6ae4f69..d5dd86f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5063,9 +5063,9 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct intel_unpin_work *work;
 	unsigned long flags, offset;
-	int pipesrc_reg = (intel_crtc->pipe == 0) ? PIPEASRC : PIPEBSRC;
-	int ret, pipesrc;
-	u32 flip_mask;
+	int pipe = intel_crtc->pipe;
+	u32 pf, pipesrc;
+	int ret;
 
 	work = kzalloc(sizeof *work, GFP_KERNEL);
 	if (work == NULL)
@@ -5114,12 +5114,14 @@ 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 = MI_WAIT_FOR_PLANE_B_FLIP;
-	else
-		flip_mask = MI_WAIT_FOR_PLANE_A_FLIP;
-
 	if (IS_GEN3(dev) || IS_GEN2(dev)) {
+		u32 flip_mask;
+
+		if (intel_crtc->plane)
+			flip_mask = MI_WAIT_FOR_PLANE_B_FLIP;
+		else
+			flip_mask = MI_WAIT_FOR_PLANE_A_FLIP;
+
 		BEGIN_LP_RING(2);
 		OUT_RING(MI_WAIT_FOR_EVENT | flip_mask);
 		OUT_RING(0);
@@ -5127,29 +5129,56 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	}
 
 	/* Offset into the new buffer for cases of shared fbs between CRTCs */
-	offset = obj_priv->gtt_offset;
-	offset += (crtc->y * fb->pitch) + (crtc->x * (fb->bits_per_pixel) / 8);
+	offset = crtc->y * fb->pitch + crtc->x * fb->bits_per_pixel/8;
 
 	BEGIN_LP_RING(4);
-	if (IS_I965G(dev)) {
+	switch(INTEL_INFO(dev)->gen) {
+	case 2:
 		OUT_RING(MI_DISPLAY_FLIP |
 			 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
 		OUT_RING(fb->pitch);
-		OUT_RING(offset | obj_priv->tiling_mode);
-		pipesrc = I915_READ(pipesrc_reg); 
-		OUT_RING(pipesrc & 0x0fff0fff);
-	} else if (IS_GEN3(dev)) {
+		OUT_RING(obj_priv->gtt_offset + offset);
+		OUT_RING(MI_NOOP);
+		break;
+
+	case 3:
 		OUT_RING(MI_DISPLAY_FLIP_I915 |
 			 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
 		OUT_RING(fb->pitch);
-		OUT_RING(offset);
+		OUT_RING(obj_priv->gtt_offset + offset);
 		OUT_RING(MI_NOOP);
-	} else {
+		break;
+
+	case 4:
+	case 5:
+		/* i965+ uses the linear or tiled offsets from the
+		 * Display Registers (which do not change across a page-flip)
+		 * so we need only reprogram the base address.
+		 */
 		OUT_RING(MI_DISPLAY_FLIP |
 			 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
 		OUT_RING(fb->pitch);
-		OUT_RING(offset);
-		OUT_RING(MI_NOOP);
+		OUT_RING(obj_priv->gtt_offset | obj_priv->tiling_mode);
+
+		/* XXX Enabling the panel-fitter across page-flip is so far
+		 * untested on non-native modes, so ignore it for now.
+		 * pf = I915_READ(pipe == 0 ? PFA_CTL_1 : PFB_CTL_1) & PF_ENABLE;
+		 */
+		pf = 0;
+		pipesrc = I915_READ(pipe == 0 ? PIPEASRC : PIPEBSRC) & 0x0fff0fff;
+		OUT_RING(pf | pipesrc);
+		break;
+
+	case 6:
+		OUT_RING(MI_DISPLAY_FLIP |
+			 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
+		OUT_RING(fb->pitch | obj_priv->tiling_mode);
+		OUT_RING(obj_priv->gtt_offset);
+
+		pf = I915_READ(pipe == 0 ? PFA_CTL_1 : PFB_CTL_1) & PF_ENABLE;
+		pipesrc = I915_READ(pipe == 0 ? PIPEASRC : PIPEBSRC) & 0x0fff0fff;
+		OUT_RING(pf | pipesrc);
+		break;
 	}
 	ADVANCE_LP_RING();
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 04/11] drm/i915: Clear scanline waits after disabling the pipe.
  2010-08-11  9:31 Remaining set of small patches for -rc1 Chris Wilson
                   ` (2 preceding siblings ...)
  2010-08-11  9:31 ` [PATCH 03/11] drm/i915: Fix offset page-flips on i965+ Chris Wilson
@ 2010-08-11  9:31 ` Chris Wilson
  2010-08-11 15:23   ` Jesse Barnes
  2010-08-11  9:31 ` [PATCH 05/11] drm/i915: Sanity check user framebuffer parameters on creation Chris Wilson
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: Chris Wilson @ 2010-08-11  9:31 UTC (permalink / raw)
  To: jbarnes; +Cc: intel-gfx

If we disable the pipe and the GPU is currently waiting on a scanline
WAIT_FOR_EVENT, the GPU will hang. Fortunately, there is a magic bit
which we can write on i915+ to break this wait after disabling the
pipe.

References:

  Bug 29252 - [Arrandale] Hung WAIT_FOR_EVENT when running rss-glx-skyrocket
  https://bugs.freedesktop.org/show_bug.cgi?id=29252

  Bug 28964 - [i965gm] GPU infinite MI_WAIT_FOR_EVENT while watching video in Totem
  https://bugs.freedesktop.org/show_bug.cgi?id=28964

and many others.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_reg.h      |    2 ++
 drivers/gpu/drm/i915/intel_display.c |   31 +++++++++++++++++++++++++++++--
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index a63e9a1..94e6275 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -295,6 +295,8 @@
 #define   RING_VALID_MASK	0x00000001
 #define   RING_VALID		0x00000001
 #define   RING_INVALID		0x00000000
+#define   RING_WAIT_I8XX	(1<<0) /* gen2, PRBx_HEAD */
+#define   RING_WAIT		(1<<11) /* gen3+, PRBx_CTL */
 #define PRB1_TAIL	0x02040 /* 915+ only */
 #define PRB1_HEAD	0x02044 /* 915+ only */
 #define PRB1_START	0x02048 /* 915+ only */
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index d5dd86f..4b98fa8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2439,6 +2439,26 @@ static int i9xx_crtc_dpms(struct drm_crtc *crtc, int mode)
 	return 0;
 }
 
+/*
+ * When we disable a pipe, we need to clear any pending scanline wait events
+ * to avoid hanging the ring, which we assume we are waiting on.
+ */
+static void intel_clear_scanline_wait(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 tmp;
+
+	if (IS_GEN2(dev))
+		/* Can't break the hang on i8xx */
+		return;
+
+	tmp = I915_READ(PRB0_CTL);
+	if (tmp & RING_WAIT) {
+		I915_WRITE(PRB0_CTL, tmp);
+		POSTING_READ(PRB0_CTL);
+	}
+}
+
 /**
  * Sets the power management mode of the pipe and plane.
  */
@@ -2458,7 +2478,8 @@ static int intel_crtc_dpms(struct drm_crtc *crtc, int mode)
 	 * with multiple pipes prior to enabling to new pipe.
 	 *
 	 * When switching off the display, make sure the cursor is
-	 * properly hidden prior to disabling the pipe.
+	 * properly hidden and there are no pending waits prior to
+	 * disabling the pipe.
 	 */
 	if (mode == DRM_MODE_DPMS_ON)
 		intel_update_watermarks(dev);
@@ -2469,8 +2490,14 @@ static int intel_crtc_dpms(struct drm_crtc *crtc, int mode)
 
 	if (mode == DRM_MODE_DPMS_ON)
 		intel_crtc_update_cursor(crtc);
-	else
+	else {
+		/* XXX Note that this is not a complete solution, but a hack
+		 * to avoid the most frequently hit hang.
+		 */
+		intel_clear_scanline_wait(dev);
+
 		intel_update_watermarks(dev);
+	}
 
 	if (!dev->primary->master)
 		return 0;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 05/11] drm/i915: Sanity check user framebuffer parameters on creation
  2010-08-11  9:31 Remaining set of small patches for -rc1 Chris Wilson
                   ` (3 preceding siblings ...)
  2010-08-11  9:31 ` [PATCH 04/11] drm/i915: Clear scanline waits after disabling the pipe Chris Wilson
@ 2010-08-11  9:31 ` Chris Wilson
  2010-08-11  9:31 ` [PATCH 06/11] drm/i915: Re-use set_base_atomic to share setting of the display registers Chris Wilson
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Chris Wilson @ 2010-08-11  9:31 UTC (permalink / raw)
  To: jbarnes; +Cc: intel-gfx

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_display.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 4b98fa8..c8da303 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5481,8 +5481,25 @@ int intel_framebuffer_init(struct drm_device *dev,
 			   struct drm_mode_fb_cmd *mode_cmd,
 			   struct drm_gem_object *obj)
 {
+	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 	int ret;
 
+	if (obj_priv->tiling_mode == I915_TILING_Y)
+		return -EINVAL;
+
+	if (mode_cmd->pitch & 63)
+		return -EINVAL;
+
+	switch (mode_cmd->bpp) {
+	case 8:
+	case 16:
+	case 24:
+	case 32:
+		break;
+	default:
+		return -EINVAL;
+	}
+
 	ret = drm_framebuffer_init(dev, &intel_fb->base, &intel_fb_funcs);
 	if (ret) {
 		DRM_ERROR("framebuffer init failed %d\n", ret);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 06/11] drm/i915: Re-use set_base_atomic to share setting of the display registers
  2010-08-11  9:31 Remaining set of small patches for -rc1 Chris Wilson
                   ` (4 preceding siblings ...)
  2010-08-11  9:31 ` [PATCH 05/11] drm/i915: Sanity check user framebuffer parameters on creation Chris Wilson
@ 2010-08-11  9:31 ` Chris Wilson
  2010-08-11 15:25   ` Jesse Barnes
  2010-08-11  9:31 ` [PATCH 07/11] drm/i915/sdvo: Propagate error from switching control buses Chris Wilson
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: Chris Wilson @ 2010-08-11  9:31 UTC (permalink / raw)
  To: jbarnes; +Cc: intel-gfx

Lets try to avoid duplicating bugs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_display.c |   80 ++++------------------------------
 1 files changed, 9 insertions(+), 71 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c8da303..16ba159 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1449,7 +1449,7 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb,
 			dspcntr &= ~DISPPLANE_TILED;
 	}
 
-	if (IS_IRONLAKE(dev))
+	if (HAS_PCH_SPLIT(dev))
 		/* must disable */
 		dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
 
@@ -1458,20 +1458,19 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb,
 	Start = obj_priv->gtt_offset;
 	Offset = y * fb->pitch + x * (fb->bits_per_pixel / 8);
 
-	DRM_DEBUG("Writing base %08lX %08lX %d %d\n", Start, Offset, x, y);
+	DRM_DEBUG_KMS("Writing base %08lX %08lX %d %d %d\n",
+		      Start, Offset, x, y, fb->pitch);
 	I915_WRITE(dspstride, fb->pitch);
 	if (IS_I965G(dev)) {
-		I915_WRITE(dspbase, Offset);
-		I915_READ(dspbase);
 		I915_WRITE(dspsurf, Start);
-		I915_READ(dspsurf);
 		I915_WRITE(dsptileoff, (y << 16) | x);
+		I915_WRITE(dspbase, Offset);
 	} else {
 		I915_WRITE(dspbase, Start + Offset);
-		I915_READ(dspbase);
 	}
+	POSTING_READ(dspbase);
 
-	if ((IS_I965G(dev) || plane == 0))
+	if (IS_I965G(dev) || plane == 0)
 		intel_update_fbc(crtc, &crtc->mode);
 
 	intel_wait_for_vblank(dev);
@@ -1485,7 +1484,6 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 		    struct drm_framebuffer *old_fb)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_i915_master_private *master_priv;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct intel_framebuffer *intel_fb;
@@ -1493,13 +1491,6 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 	struct drm_gem_object *obj;
 	int pipe = intel_crtc->pipe;
 	int plane = intel_crtc->plane;
-	unsigned long Start, Offset;
-	int dspbase = (plane == 0 ? DSPAADDR : DSPBADDR);
-	int dspsurf = (plane == 0 ? DSPASURF : DSPBSURF);
-	int dspstride = (plane == 0) ? DSPASTRIDE : DSPBSTRIDE;
-	int dsptileoff = (plane == 0 ? DSPATILEOFF : DSPBTILEOFF);
-	int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR;
-	u32 dspcntr;
 	int ret;
 
 	/* no fb bound */
@@ -1535,71 +1526,18 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 		return ret;
 	}
 
-	dspcntr = I915_READ(dspcntr_reg);
-	/* Mask out pixel format bits in case we change it */
-	dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
-	switch (crtc->fb->bits_per_pixel) {
-	case 8:
-		dspcntr |= DISPPLANE_8BPP;
-		break;
-	case 16:
-		if (crtc->fb->depth == 15)
-			dspcntr |= DISPPLANE_15_16BPP;
-		else
-			dspcntr |= DISPPLANE_16BPP;
-		break;
-	case 24:
-	case 32:
-		if (crtc->fb->depth == 30)
-			dspcntr |= DISPPLANE_32BPP_30BIT_NO_ALPHA;
-		else
-			dspcntr |= DISPPLANE_32BPP_NO_ALPHA;
-		break;
-	default:
-		DRM_ERROR("Unknown color depth\n");
+	ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y);
+	if (ret) {
 		i915_gem_object_unpin(obj);
 		mutex_unlock(&dev->struct_mutex);
-		return -EINVAL;
-	}
-	if (IS_I965G(dev)) {
-		if (obj_priv->tiling_mode != I915_TILING_NONE)
-			dspcntr |= DISPPLANE_TILED;
-		else
-			dspcntr &= ~DISPPLANE_TILED;
-	}
-
-	if (HAS_PCH_SPLIT(dev))
-		/* must disable */
-		dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
-
-	I915_WRITE(dspcntr_reg, dspcntr);
-
-	Start = obj_priv->gtt_offset;
-	Offset = y * crtc->fb->pitch + x * (crtc->fb->bits_per_pixel / 8);
-
-	DRM_DEBUG_KMS("Writing base %08lX %08lX %d %d %d\n",
-		      Start, Offset, x, y, crtc->fb->pitch);
-	I915_WRITE(dspstride, crtc->fb->pitch);
-	if (IS_I965G(dev)) {
-		I915_WRITE(dspsurf, Start);
-		I915_WRITE(dsptileoff, (y << 16) | x);
-		I915_WRITE(dspbase, Offset);
-	} else {
-		I915_WRITE(dspbase, Start + Offset);
+		return ret;
 	}
-	POSTING_READ(dspbase);
-
-	if ((IS_I965G(dev) || plane == 0))
-		intel_update_fbc(crtc, &crtc->mode);
-
-	intel_wait_for_vblank(dev);
 
 	if (old_fb) {
 		intel_fb = to_intel_framebuffer(old_fb);
 		obj_priv = to_intel_bo(intel_fb->obj);
 		i915_gem_object_unpin(intel_fb->obj);
 	}
-	intel_increase_pllclock(crtc, true);
 
 	mutex_unlock(&dev->struct_mutex);
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 07/11] drm/i915/sdvo: Propagate error from switching control buses.
  2010-08-11  9:31 Remaining set of small patches for -rc1 Chris Wilson
                   ` (5 preceding siblings ...)
  2010-08-11  9:31 ` [PATCH 06/11] drm/i915: Re-use set_base_atomic to share setting of the display registers Chris Wilson
@ 2010-08-11  9:31 ` Chris Wilson
  2010-08-11  9:31 ` [PATCH 08/11] drm/i915: Add RING_WAIT reset to hangcheck Chris Wilson
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Chris Wilson @ 2010-08-11  9:31 UTC (permalink / raw)
  To: jbarnes; +Cc: intel-gfx

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_sdvo.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 1f07ec6..2708631 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -525,8 +525,8 @@ static int intel_sdvo_get_pixel_multiplier(struct drm_display_mode *mode)
  * another I2C transaction after issuing the DDC bus switch, it will be
  * switched to the internal SDVO register.
  */
-static void intel_sdvo_set_control_bus_switch(struct intel_sdvo *intel_sdvo,
-					      u8 target)
+static int intel_sdvo_set_control_bus_switch(struct intel_sdvo *intel_sdvo,
+					     u8 target)
 {
 	u8 out_buf[2], cmd_buf[2], ret_value[2], ret;
 	struct i2c_msg msgs[] = {
@@ -567,14 +567,15 @@ static void intel_sdvo_set_control_bus_switch(struct intel_sdvo *intel_sdvo,
 	if (ret != 3) {
 		/* failure in I2C transfer */
 		DRM_DEBUG_KMS("I2c transfer returned %d\n", ret);
-		return;
+		return -EIO;
 	}
 	if (ret_value[0] != SDVO_CMD_STATUS_SUCCESS) {
 		DRM_DEBUG_KMS("DDC switch command returns response %d\n",
 					ret_value[0]);
-		return;
+		return -EIO;
 	}
-	return;
+
+	return 0;
 }
 
 static bool intel_sdvo_set_value(struct intel_sdvo *intel_sdvo, u8 cmd, const void *data, int len)
@@ -1987,6 +1988,7 @@ static int intel_sdvo_master_xfer(struct i2c_adapter *i2c_adap,
 	struct intel_sdvo *intel_sdvo;
 	struct i2c_algo_bit_data *algo_data;
 	const struct i2c_algorithm *algo;
+	int ret;
 
 	algo_data = (struct i2c_algo_bit_data *)i2c_adap->algo_data;
 	intel_sdvo =
@@ -1997,7 +1999,11 @@ static int intel_sdvo_master_xfer(struct i2c_adapter *i2c_adap,
 
 	algo = intel_sdvo->base.i2c_bus->algo;
 
-	intel_sdvo_set_control_bus_switch(intel_sdvo, intel_sdvo->ddc_bus);
+	ret = intel_sdvo_set_control_bus_switch(intel_sdvo,
+						intel_sdvo->ddc_bus);
+	if (ret)
+		return ret;
+
 	return algo->master_xfer(i2c_adap, msgs, num);
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 08/11] drm/i915: Add RING_WAIT reset to hangcheck
  2010-08-11  9:31 Remaining set of small patches for -rc1 Chris Wilson
                   ` (6 preceding siblings ...)
  2010-08-11  9:31 ` [PATCH 07/11] drm/i915/sdvo: Propagate error from switching control buses Chris Wilson
@ 2010-08-11  9:31 ` Chris Wilson
  2010-08-22  6:19   ` Eric Anholt
  2010-08-11  9:31 ` [PATCH 09/11] drm/i915/crt: Flush register prior to waiting for vblank Chris Wilson
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: Chris Wilson @ 2010-08-11  9:31 UTC (permalink / raw)
  To: jbarnes; +Cc: intel-gfx

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_irq.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 69a36fc..21c7d77 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1322,6 +1322,16 @@ void i915_hangcheck_elapsed(unsigned long data)
 	    dev_priv->last_instdone1 == instdone1) {
 		if (dev_priv->hangcheck_count++ > 1) {
 			DRM_ERROR("Hangcheck timer elapsed... GPU hung\n");
+
+			if (!IS_GEN2(dev)) {
+				u32 tmp = I915_READ(PRB0_CTL);
+				if (tmp & RING_WAIT) {
+					I915_WRITE(PRB0_CTL, tmp);
+					POSTING_READ(PRB0_CTL);
+					goto out;
+				}
+			}
+
 			i915_handle_error(dev, true);
 			return;
 		}
@@ -1333,6 +1343,7 @@ void i915_hangcheck_elapsed(unsigned long data)
 		dev_priv->last_instdone1 = instdone1;
 	}
 
+out:
 	/* Reset timer case chip hangs without another request being added */
 	mod_timer(&dev_priv->hangcheck_timer, jiffies + DRM_I915_HANGCHECK_PERIOD);
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 09/11] drm/i915/crt: Flush register prior to waiting for vblank.
  2010-08-11  9:31 Remaining set of small patches for -rc1 Chris Wilson
                   ` (7 preceding siblings ...)
  2010-08-11  9:31 ` [PATCH 08/11] drm/i915: Add RING_WAIT reset to hangcheck Chris Wilson
@ 2010-08-11  9:31 ` Chris Wilson
  2010-08-11  9:31 ` [PATCH 10/11] drm/i915/dp: Boost timeout for enabling transcoder to 100ms Chris Wilson
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Chris Wilson @ 2010-08-11  9:31 UTC (permalink / raw)
  To: jbarnes; +Cc: intel-gfx

If we don't flush the write then we can not be sure that the border
colour will have taken effect by the time we try to read it back.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_crt.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 236a63d..4846c51 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -328,6 +328,7 @@ intel_crt_load_detect(struct drm_crtc *crtc, struct intel_encoder *intel_encoder
 	if (IS_I9XX(dev)) {
 		uint32_t pipeconf = I915_READ(pipeconf_reg);
 		I915_WRITE(pipeconf_reg, pipeconf | PIPECONF_FORCE_BORDER);
+		POSTING_READ(pipeconf_reg);
 		/* Wait for next Vblank to substitue
 		 * border color for Color info */
 		intel_wait_for_vblank(dev);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 10/11] drm/i915/dp: Boost timeout for enabling transcoder to 100ms
  2010-08-11  9:31 Remaining set of small patches for -rc1 Chris Wilson
                   ` (8 preceding siblings ...)
  2010-08-11  9:31 ` [PATCH 09/11] drm/i915/crt: Flush register prior to waiting for vblank Chris Wilson
@ 2010-08-11  9:31 ` Chris Wilson
  2010-08-11  9:31 ` [PATCH 11/11] drm/i915: Perform initial configuration asynchronously Chris Wilson
  2010-08-11  9:46 ` Remaining set of small patches for -rc1 shadi
  11 siblings, 0 replies; 21+ messages in thread
From: Chris Wilson @ 2010-08-11  9:31 UTC (permalink / raw)
  To: jbarnes; +Cc: intel-gfx

Adam Hill reported that his Arrandale system required a much longer, up
to 200x500us, wait for the panel to initialise or else modesetting would
fail.

References:

  https://bugs.freedesktop.org/show_bug.cgi?id=29141

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-by: Adam Hill <sidepipeuk@yahoo.co.uk>
---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 16ba159..8c880a3 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2068,7 +2068,7 @@ static int ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
 			I915_WRITE(transconf_reg, temp | TRANS_ENABLE);
 			I915_READ(transconf_reg);
 
-			if (wait_for(I915_READ(transconf_reg) & TRANS_STATE_ENABLE, 10, 0))
+			if (wait_for(I915_READ(transconf_reg) & TRANS_STATE_ENABLE, 100, 1))
 				DRM_ERROR("failed to enable transcoder\n");
 		}
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 11/11] drm/i915: Perform initial configuration asynchronously
  2010-08-11  9:31 Remaining set of small patches for -rc1 Chris Wilson
                   ` (9 preceding siblings ...)
  2010-08-11  9:31 ` [PATCH 10/11] drm/i915/dp: Boost timeout for enabling transcoder to 100ms Chris Wilson
@ 2010-08-11  9:31 ` Chris Wilson
  2010-08-11  9:46 ` Remaining set of small patches for -rc1 shadi
  11 siblings, 0 replies; 21+ messages in thread
From: Chris Wilson @ 2010-08-11  9:31 UTC (permalink / raw)
  To: jbarnes; +Cc: Dave Airlie, intel-gfx

It takes over 0.5s to probe the outputs and configure the i915 console.
This can be performed in the background whilst the rest of the system
is booting.

Based on a patch by Arjan van de Van <arjan@linux.intel.com>

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/drm_drv.c       |    6 ++++++
 drivers/gpu/drm/i915/intel_fb.c |   13 +++++++++++--
 include/drm/drmP.h              |    2 ++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 90288ec..fc1f641 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -48,9 +48,12 @@
 
 #include <linux/debugfs.h>
 #include <linux/slab.h>
+#include <linux/async.h>
 #include "drmP.h"
 #include "drm_core.h"
 
+LIST_HEAD(drm_async_domain);
+EXPORT_SYMBOL_GPL(drm_async_domain);
 
 static int drm_version(struct drm_device *dev, void *data,
 		       struct drm_file *file_priv);
@@ -266,6 +269,9 @@ void drm_exit(struct drm_driver *driver)
 	struct drm_device *dev, *tmp;
 	DRM_DEBUG("\n");
 
+	/* make sure all async operations are finished */
+	async_synchronize_full_domain(&drm_async_domain);
+
 	if (driver->driver_features & DRIVER_MODESET) {
 		pci_unregister_driver(&driver->pci_driver);
 	} else {
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index fe2ab62..cb37c08 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -34,6 +34,7 @@
 #include <linux/delay.h>
 #include <linux/fb.h>
 #include <linux/init.h>
+#include <linux/async.h>
 #include <linux/vga_switcheroo.h>
 
 #include "drmP.h"
@@ -245,6 +246,14 @@ int intel_fbdev_destroy(struct drm_device *dev,
 	return 0;
 }
 
+static void intel_fbdev_init_async(void *ptr, async_cookie_t cookie)
+{
+	struct intel_fbdev *ifbdev = ptr;
+
+	drm_fb_helper_single_add_all_connectors(&ifbdev->helper);
+	drm_fb_helper_initial_config(&ifbdev->helper, 32);
+}
+
 int intel_fbdev_init(struct drm_device *dev)
 {
 	struct intel_fbdev *ifbdev;
@@ -266,8 +275,8 @@ int intel_fbdev_init(struct drm_device *dev)
 		return ret;
 	}
 
-	drm_fb_helper_single_add_all_connectors(&ifbdev->helper);
-	drm_fb_helper_initial_config(&ifbdev->helper, 32);
+	async_schedule_domain(intel_fbdev_init_async, ifbdev,
+			      &drm_async_domain);
 	return 0;
 }
 
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e2a4da7..4a5b902 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -326,6 +326,8 @@ struct drm_vma_entry {
 	pid_t pid;
 };
 
+extern struct list_head drm_async_domain;
+
 /**
  * DMA buffer.
  */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: Remaining set of small patches for -rc1
  2010-08-11  9:31 Remaining set of small patches for -rc1 Chris Wilson
                   ` (10 preceding siblings ...)
  2010-08-11  9:31 ` [PATCH 11/11] drm/i915: Perform initial configuration asynchronously Chris Wilson
@ 2010-08-11  9:46 ` shadi
  2010-08-11 15:21   ` Alan W. Irwin
  11 siblings, 1 reply; 21+ messages in thread
From: shadi @ 2010-08-11  9:46 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

Dear Chris,

Please stop sending me these messages.

Regards,
Shadi





> A couple of patches to tidy the merge with atomic modesetting. 2 patches
> to fix the offset page-flipping. A patch to workaround one common cause of
> hangs after modesetting whilst page-flipping, it's not the full patch but
> it should prevent the hang in 99% of cases [statistic made up on the
> spot], and with the additional reset in hangcheck should prevent a fatal
> hang on i915. A couple of trivial patches that should help with a couple
> of bugs. And the most fun, the asynchronous fbdev init which has been
> tested by Meego and a few other adventurous fast booters.
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 01/11] drm/i915: Avoid using msleep under kdb and wait_for()
  2010-08-11  9:31 ` [PATCH 01/11] drm/i915: Avoid using msleep under kdb and wait_for() Chris Wilson
@ 2010-08-11 15:20   ` Jesse Barnes
  0 siblings, 0 replies; 21+ messages in thread
From: Jesse Barnes @ 2010-08-11 15:20 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, 11 Aug 2010 10:31:26 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> wait_for() uses msleep() to yield the cpu whilst spinning waiting for a
> register to change. kdb asserts that mode changes are atomic and so
> prohibits msleep. The alternative would be to use mdelay or to simply
> probe the register more often instead of busy waiting.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/intel_drv.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index e6351e6..d93b7f0 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -41,7 +41,7 @@
>  			ret__ = -ETIMEDOUT;				\
>  			break;						\
>  		}							\
> -		if (W) msleep(W);					\
> +		if (W && !in_dbg_master()) msleep(W);			\
>  	}								\
>  	ret__;								\
>  })

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Remaining set of small patches for -rc1
  2010-08-11  9:46 ` Remaining set of small patches for -rc1 shadi
@ 2010-08-11 15:21   ` Alan W. Irwin
  0 siblings, 0 replies; 21+ messages in thread
From: Alan W. Irwin @ 2010-08-11 15:21 UTC (permalink / raw)
  To: shadi; +Cc: intel-gfx

On 2010-08-11 05:46-0400 shadi@35point5.com wrote:

> Dear Chris,
>
> Please stop sending me these messages.
>

Dear Chris and other Intel developers,

Please do keep sharing your excellent work with intel-gfx.

Dear Shadi:

It appears you have subscribed to the intel-gfx without being aware of
what type of traffic you will get from that list.  To say this in the
nicest way I can, you have two choices which are (a) to get used to
the type of traffic on this list or (b) to unsubscribe.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 02/11] drm/i915: Include a generation number in the device info
  2010-08-11  9:31 ` [PATCH 02/11] drm/i915: Include a generation number in the device info Chris Wilson
@ 2010-08-11 15:22   ` Jesse Barnes
  0 siblings, 0 replies; 21+ messages in thread
From: Jesse Barnes @ 2010-08-11 15:22 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, 11 Aug 2010 10:31:27 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> To simplify the IS_GEN[234] macros and to enable switching.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_drv.c |   61 ++++++++++++++++++---------------------
>  drivers/gpu/drm/i915/i915_drv.h |   27 ++++-------------
>  2 files changed, 34 insertions(+), 54 deletions(-)
> 

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

My only complaint about this patch is that our hardware isn't more
uniform; for any given feature we may need to check the generation,
something in VBT, whether it's a mobile chip, or the chip's specific
ID.  Really annoying but not really your fault. :)

-- 
Jesse Barnes, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 04/11] drm/i915: Clear scanline waits after disabling the pipe.
  2010-08-11  9:31 ` [PATCH 04/11] drm/i915: Clear scanline waits after disabling the pipe Chris Wilson
@ 2010-08-11 15:23   ` Jesse Barnes
  2010-08-11 16:12     ` Chris Wilson
  0 siblings, 1 reply; 21+ messages in thread
From: Jesse Barnes @ 2010-08-11 15:23 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, 11 Aug 2010 10:31:29 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> If we disable the pipe and the GPU is currently waiting on a scanline
> WAIT_FOR_EVENT, the GPU will hang. Fortunately, there is a magic bit
> which we can write on i915+ to break this wait after disabling the
> pipe.
> 
> References:
> 
>   Bug 29252 - [Arrandale] Hung WAIT_FOR_EVENT when running rss-glx-skyrocket
>   https://bugs.freedesktop.org/show_bug.cgi?id=29252
> 
>   Bug 28964 - [i965gm] GPU infinite MI_WAIT_FOR_EVENT while watching video in Totem
>   https://bugs.freedesktop.org/show_bug.cgi?id=28964
> 
> and many others.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
>  drivers/gpu/drm/i915/i915_reg.h      |    2 ++
>  drivers/gpu/drm/i915/intel_display.c |   31 +++++++++++++++++++++++++++++--
>  2 files changed, 31 insertions(+), 2 deletions(-)

Have we confirmed that this one actually works?  It seems safe enough,
though Eric's comment about idling things first still applies, right?

-- 
Jesse Barnes, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 06/11] drm/i915: Re-use set_base_atomic to share setting of the display registers
  2010-08-11  9:31 ` [PATCH 06/11] drm/i915: Re-use set_base_atomic to share setting of the display registers Chris Wilson
@ 2010-08-11 15:25   ` Jesse Barnes
  0 siblings, 0 replies; 21+ messages in thread
From: Jesse Barnes @ 2010-08-11 15:25 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, 11 Aug 2010 10:31:31 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> Lets try to avoid duplicating bugs.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---

Yes, thanks, I had a version that did this as well, but the
unconsolidated one ended up upstream.

Looks like it's not just code motion though, the IS_IRONLAKE ->
HAS_PCH_SPLIT change looks like a real bug fix.

-- 
Jesse Barnes, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 04/11] drm/i915: Clear scanline waits after disabling the pipe.
  2010-08-11 15:23   ` Jesse Barnes
@ 2010-08-11 16:12     ` Chris Wilson
  0 siblings, 0 replies; 21+ messages in thread
From: Chris Wilson @ 2010-08-11 16:12 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: intel-gfx

On Wed, 11 Aug 2010 08:23:23 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> Have we confirmed that this one actually works?

That's what testers are for ;-).

>  It seems safe enough,
> though Eric's comment about idling things first still applies, right?

Yes, this merely attempts to hide the fact that we are doing the wrong
thing, not to actually correct our behaviour.
-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 08/11] drm/i915: Add RING_WAIT reset to hangcheck
  2010-08-11  9:31 ` [PATCH 08/11] drm/i915: Add RING_WAIT reset to hangcheck Chris Wilson
@ 2010-08-22  6:19   ` Eric Anholt
  2010-08-22  8:50     ` [PATCH] drm/i915: Add ringbuffer wait " Chris Wilson
  0 siblings, 1 reply; 21+ messages in thread
From: Eric Anholt @ 2010-08-22  6:19 UTC (permalink / raw)
  To: Chris Wilson, jbarnes; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 225 bytes --]

On Wed, 11 Aug 2010 10:31:33 +0100, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Without breaking out the docs, I don't know what this does.  Better
commit message?

[-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --]

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

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH] drm/i915: Add ringbuffer wait reset to hangcheck
  2010-08-22  6:19   ` Eric Anholt
@ 2010-08-22  8:50     ` Chris Wilson
  0 siblings, 0 replies; 21+ messages in thread
From: Chris Wilson @ 2010-08-22  8:50 UTC (permalink / raw)
  To: intel-gfx

The GPU records whether it is currently waiting for a completion of a
WAIT_FOR_EVENT in the RB_WAIT bit in the ringbuffer control registers.
On third generation chipsets and later, a write of 1 to this bit breaks
the hang and returns the GPU to arbitration, i.e. the GPU should
continue executing the reminder of the batchbuffer and return to normal
operations.

By adding this to hangcheck we can avoid a full GPU reset under these
conditions.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_irq.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 69a36fc..2bc9ce6 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1322,6 +1322,21 @@ void i915_hangcheck_elapsed(unsigned long data)
 	    dev_priv->last_instdone1 == instdone1) {
 		if (dev_priv->hangcheck_count++ > 1) {
 			DRM_ERROR("Hangcheck timer elapsed... GPU hung\n");
+
+			if (!IS_GEN2(dev)) {
+				/* Is the chip hanging on a WAIT_FOR_EVENT?
+				 * If so we can simply poke the RB_WAIT bit
+				 * and break the hang. This should work on
+				 * all but the second generation chipsets.
+				 */
+				u32 tmp = I915_READ(PRB0_CTL);
+				if (tmp & RING_WAIT) {
+					I915_WRITE(PRB0_CTL, tmp);
+					POSTING_READ(PRB0_CTL);
+					goto out;
+				}
+			}
+
 			i915_handle_error(dev, true);
 			return;
 		}
@@ -1333,6 +1348,7 @@ void i915_hangcheck_elapsed(unsigned long data)
 		dev_priv->last_instdone1 = instdone1;
 	}
 
+out:
 	/* Reset timer case chip hangs without another request being added */
 	mod_timer(&dev_priv->hangcheck_timer, jiffies + DRM_I915_HANGCHECK_PERIOD);
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2010-08-22  8:50 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-11  9:31 Remaining set of small patches for -rc1 Chris Wilson
2010-08-11  9:31 ` [PATCH 01/11] drm/i915: Avoid using msleep under kdb and wait_for() Chris Wilson
2010-08-11 15:20   ` Jesse Barnes
2010-08-11  9:31 ` [PATCH 02/11] drm/i915: Include a generation number in the device info Chris Wilson
2010-08-11 15:22   ` Jesse Barnes
2010-08-11  9:31 ` [PATCH 03/11] drm/i915: Fix offset page-flips on i965+ Chris Wilson
2010-08-11  9:31 ` [PATCH 04/11] drm/i915: Clear scanline waits after disabling the pipe Chris Wilson
2010-08-11 15:23   ` Jesse Barnes
2010-08-11 16:12     ` Chris Wilson
2010-08-11  9:31 ` [PATCH 05/11] drm/i915: Sanity check user framebuffer parameters on creation Chris Wilson
2010-08-11  9:31 ` [PATCH 06/11] drm/i915: Re-use set_base_atomic to share setting of the display registers Chris Wilson
2010-08-11 15:25   ` Jesse Barnes
2010-08-11  9:31 ` [PATCH 07/11] drm/i915/sdvo: Propagate error from switching control buses Chris Wilson
2010-08-11  9:31 ` [PATCH 08/11] drm/i915: Add RING_WAIT reset to hangcheck Chris Wilson
2010-08-22  6:19   ` Eric Anholt
2010-08-22  8:50     ` [PATCH] drm/i915: Add ringbuffer wait " Chris Wilson
2010-08-11  9:31 ` [PATCH 09/11] drm/i915/crt: Flush register prior to waiting for vblank Chris Wilson
2010-08-11  9:31 ` [PATCH 10/11] drm/i915/dp: Boost timeout for enabling transcoder to 100ms Chris Wilson
2010-08-11  9:31 ` [PATCH 11/11] drm/i915: Perform initial configuration asynchronously Chris Wilson
2010-08-11  9:46 ` Remaining set of small patches for -rc1 shadi
2010-08-11 15:21   ` Alan W. Irwin

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.