intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915: Fix PIPE_CONTROL command on Sandybridge
@ 2010-05-27  2:26 Zhenyu Wang
  2010-05-27  2:26 ` [PATCH 2/2] drm/i915: Unmask interrupt for render engine " Zhenyu Wang
  2010-05-28 18:12 ` [PATCH 1/2] drm/i915: Fix PIPE_CONTROL command " Eric Anholt
  0 siblings, 2 replies; 3+ messages in thread
From: Zhenyu Wang @ 2010-05-27  2:26 UTC (permalink / raw)
  To: eric; +Cc: intel-gfx

Sandybridge(Gen6) has new format for PIPE_CONTROL command,
the flush and post-op control are in dword 1 now. This
changes command length field for difference between Ironlake
and Sandybridge.

I tried to test this with noop request and issue PIPE_CONTROL
command for each sequence and track notify interrupts, which
seems work fine. Hopefully we don't need workaround like on
Ironlake for Sandybridge.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c |   77 +++++++++++++++++++++++----------------
 drivers/gpu/drm/i915/i915_reg.h |   11 +++++-
 2 files changed, 55 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 112699f..aad41b7 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1595,7 +1595,7 @@ i915_gem_process_flushing_list(struct drm_device *dev,
 
 #define PIPE_CONTROL_FLUSH(addr)					\
 	OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE |		\
-		 PIPE_CONTROL_DEPTH_STALL);				\
+		 PIPE_CONTROL_DEPTH_STALL | 2);				\
 	OUT_RING(addr | PIPE_CONTROL_GLOBAL_GTT);			\
 	OUT_RING(0);							\
 	OUT_RING(0);							\
@@ -1635,37 +1635,50 @@ i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
 		dev_priv->mm.next_gem_seqno++;
 
 	if (HAS_PIPE_CONTROL(dev)) {
-		u32 scratch_addr = dev_priv->seqno_gfx_addr + 128;
+		if (IS_GEN6(dev)) {
+			BEGIN_LP_RING(6);
+			OUT_RING(GFX_OP_PIPE_CONTROL | 3);
+			OUT_RING(PIPE_CONTROL_QW_WRITE |
+				 PIPE_CONTROL_WC_FLUSH | PIPE_CONTROL_IS_FLUSH |
+				 PIPE_CONTROL_NOTIFY);
+			OUT_RING(dev_priv->seqno_gfx_addr | PIPE_CONTROL_GLOBAL_GTT);
+			OUT_RING(seqno);
+			OUT_RING(0);
+			OUT_RING(0);
+			ADVANCE_LP_RING();
+		} else {
+			u32 scratch_addr = dev_priv->seqno_gfx_addr + 128;
 
-		/*
-		 * Workaround qword write incoherence by flushing the
-		 * PIPE_NOTIFY buffers out to memory before requesting
-		 * an interrupt.
-		 */
-		BEGIN_LP_RING(32);
-		OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE |
-			 PIPE_CONTROL_WC_FLUSH | PIPE_CONTROL_TC_FLUSH);
-		OUT_RING(dev_priv->seqno_gfx_addr | PIPE_CONTROL_GLOBAL_GTT);
-		OUT_RING(seqno);
-		OUT_RING(0);
-		PIPE_CONTROL_FLUSH(scratch_addr);
-		scratch_addr += 128; /* write to separate cachelines */
-		PIPE_CONTROL_FLUSH(scratch_addr);
-		scratch_addr += 128;
-		PIPE_CONTROL_FLUSH(scratch_addr);
-		scratch_addr += 128;
-		PIPE_CONTROL_FLUSH(scratch_addr);
-		scratch_addr += 128;
-		PIPE_CONTROL_FLUSH(scratch_addr);
-		scratch_addr += 128;
-		PIPE_CONTROL_FLUSH(scratch_addr);
-		OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE |
-			 PIPE_CONTROL_WC_FLUSH | PIPE_CONTROL_TC_FLUSH |
-			 PIPE_CONTROL_NOTIFY);
-		OUT_RING(dev_priv->seqno_gfx_addr | PIPE_CONTROL_GLOBAL_GTT);
-		OUT_RING(seqno);
-		OUT_RING(0);
-		ADVANCE_LP_RING();
+			/*
+			 * Workaround qword write incoherence by flushing the
+			 * PIPE_NOTIFY buffers out to memory before requesting
+			 * an interrupt.
+			 */
+			BEGIN_LP_RING(32);
+			OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE |
+				 PIPE_CONTROL_WC_FLUSH | PIPE_CONTROL_TC_FLUSH | 2);
+			OUT_RING(dev_priv->seqno_gfx_addr | PIPE_CONTROL_GLOBAL_GTT);
+			OUT_RING(seqno);
+			OUT_RING(0);
+			PIPE_CONTROL_FLUSH(scratch_addr);
+			scratch_addr += 128; /* write to separate cachelines */
+			PIPE_CONTROL_FLUSH(scratch_addr);
+			scratch_addr += 128;
+			PIPE_CONTROL_FLUSH(scratch_addr);
+			scratch_addr += 128;
+			PIPE_CONTROL_FLUSH(scratch_addr);
+			scratch_addr += 128;
+			PIPE_CONTROL_FLUSH(scratch_addr);
+			scratch_addr += 128;
+			PIPE_CONTROL_FLUSH(scratch_addr);
+			OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE |
+				 PIPE_CONTROL_WC_FLUSH | PIPE_CONTROL_TC_FLUSH |
+				 PIPE_CONTROL_NOTIFY);
+			OUT_RING(dev_priv->seqno_gfx_addr | PIPE_CONTROL_GLOBAL_GTT);
+			OUT_RING(seqno);
+			OUT_RING(0);
+			ADVANCE_LP_RING();
+		}
 	} else {
 		BEGIN_LP_RING(4);
 		OUT_RING(MI_STORE_DWORD_INDEX);
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index f3e39cc..2740f09 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -230,7 +230,12 @@
 #define   ASYNC_FLIP                (1<<22)
 #define   DISPLAY_PLANE_A           (0<<20)
 #define   DISPLAY_PLANE_B           (1<<20)
-#define GFX_OP_PIPE_CONTROL	((0x3<<29)|(0x3<<27)|(0x2<<24)|2)
+#define GFX_OP_PIPE_CONTROL	((0x3<<29)|(0x3<<27)|(0x2<<24))
+#define   PIPE_CONTROL_CS_STALL	(1<<20)
+#define   PIPE_CONTROL_GLOBAL_SNAPSHOT_COUNT_RESET	(1<<19)
+#define   PIPE_CONTROL_TLB_INVALIDATE	(1<<18)
+#define   PIPE_CONTROL_SYNC_GFDT	(1<<17)
+#define   PIPE_CONTROL_MEDIA_STATE_CLEAR	(1<<16)
 #define   PIPE_CONTROL_QW_WRITE	(1<<14)
 #define   PIPE_CONTROL_DEPTH_STALL (1<<13)
 #define   PIPE_CONTROL_WC_FLUSH	(1<<12)
@@ -238,6 +243,10 @@
 #define   PIPE_CONTROL_TC_FLUSH (1<<10) /* GM45+ only */
 #define   PIPE_CONTROL_ISP_DIS	(1<<9)
 #define   PIPE_CONTROL_NOTIFY	(1<<8)
+#define   PIPE_CONTROL_VF_CACHE_INVALIDATE	(1<<4)
+#define   PIPE_CONTROL_CONST_CACHE_INVALIDATE	(1<<3)
+#define   PIPE_CONTROL_STATE_CACHE_INVALIDATE	(1<<2)
+#define   PIPE_CONTROL_DEPTH_CACHE_FLUSH	(1<<0)
 #define   PIPE_CONTROL_GLOBAL_GTT (1<<2) /* in addr dword */
 #define   PIPE_CONTROL_STALL_EN	(1<<1) /* in addr word, Ironlake+ only */
 
-- 
1.7.0.4

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

* [PATCH 2/2] drm/i915: Unmask interrupt for render engine on Sandybridge
  2010-05-27  2:26 [PATCH 1/2] drm/i915: Fix PIPE_CONTROL command on Sandybridge Zhenyu Wang
@ 2010-05-27  2:26 ` Zhenyu Wang
  2010-05-28 18:12 ` [PATCH 1/2] drm/i915: Fix PIPE_CONTROL command " Eric Anholt
  1 sibling, 0 replies; 3+ messages in thread
From: Zhenyu Wang @ 2010-05-27  2:26 UTC (permalink / raw)
  To: eric; +Cc: intel-gfx

With splitted engines on Sandybridge, each engine has its own
interrupt control as well. This unmasks the interrupt to properly
enable pipe control notify event for render engine.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c |    4 ++++
 drivers/gpu/drm/i915/i915_irq.c     |    2 ++
 drivers/gpu/drm/i915/i915_reg.h     |   19 +++++++++++++++++++
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 322070c..8818577 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -192,6 +192,10 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
 			   I915_READ(GTIIR));
 		seq_printf(m, "Graphics Interrupt mask:		%08x\n",
 			   I915_READ(GTIMR));
+		if (IS_GEN6(dev)) {
+			seq_printf(m, "Render Interrupt mask:		%08x\n",
+				   I915_READ(GEN6_RENDER_IMR));
+		}
 	}
 	seq_printf(m, "Interrupts received: %d\n",
 		   atomic_read(&dev_priv->irq_received));
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index a7e4b1f..5452300 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1330,6 +1330,8 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
 
 	I915_WRITE(GTIIR, I915_READ(GTIIR));
 	I915_WRITE(GTIMR, dev_priv->gt_irq_mask_reg);
+	if (IS_GEN6(dev))
+		I915_WRITE(GEN6_RENDER_IMR, ~GEN6_RENDER_PIPE_CONTROL_NOTIFY_INTERRUPT);
 	I915_WRITE(GTIER, dev_priv->gt_irq_enable_reg);
 	(void) I915_READ(GTIER);
 
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 2740f09..c7bd4ec 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -377,6 +377,25 @@
 #define BB_ADDR		0x02140 /* 8 bytes */
 #define GFX_FLSH_CNTL	0x02170 /* 915+ only */
 
+/* GEN6 interrupt control */
+#define GEN6_RENDER_HWSTAM	0x2098
+#define GEN6_RENDER_IMR		0x20a8
+#define   GEN6_RENDER_CONTEXT_SWITCH_INTERRUPT		(1 << 8)
+#define   GEN6_RENDER_PPGTT_PAGE_FAULT			(1 << 7)
+#define   GEN6_RENDER TIMEOUT_COUNTER_EXPIRED		(1 << 6)
+#define   GEN6_RENDER_L3_PARITY_ERROR			(1 << 5)
+#define   GEN6_RENDER_PIPE_CONTROL_NOTIFY_INTERRUPT	(1 << 4)
+#define   GEN6_RENDER_COMMAND_PARSER_MASTER_ERROR	(1 << 3)
+#define   GEN6_RENDER_SYNC_STATUS			(1 << 2)
+#define   GEN6_RENDER_DEBUG_INTERRUPT			(1 << 1)
+#define   GEN6_RENDER_USER_INTERRUPT			(1 << 0)
+
+#define GEN6_BLITTER_HWSTAM	0x22098
+#define GEN6_BLITTER_IMR	0x220a8
+#define   GEN6_BLITTER_MI_FLUSH_DW_NOTIFY_INTERRUPT	(1 << 26)
+#define   GEN6_BLITTER_COMMAND_PARSER_MASTER_ERROR	(1 << 25)
+#define   GEN6_BLITTER_SYNC_STATUS			(1 << 24)
+#define   GEN6_BLITTER_USER_INTERRUPT			(1 << 22)
 
 /*
  * Framebuffer compression (915+ only)
-- 
1.7.0.4

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

* Re: [PATCH 1/2] drm/i915: Fix PIPE_CONTROL command on Sandybridge
  2010-05-27  2:26 [PATCH 1/2] drm/i915: Fix PIPE_CONTROL command on Sandybridge Zhenyu Wang
  2010-05-27  2:26 ` [PATCH 2/2] drm/i915: Unmask interrupt for render engine " Zhenyu Wang
@ 2010-05-28 18:12 ` Eric Anholt
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Anholt @ 2010-05-28 18:12 UTC (permalink / raw)
  To: Zhenyu Wang; +Cc: intel-gfx


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

On Thu, 27 May 2010 10:26:42 +0800, Zhenyu Wang <zhenyuw@linux.intel.com> wrote:
> Sandybridge(Gen6) has new format for PIPE_CONTROL command,
> the flush and post-op control are in dword 1 now. This
> changes command length field for difference between Ironlake
> and Sandybridge.
> 
> I tried to test this with noop request and issue PIPE_CONTROL
> command for each sequence and track notify interrupts, which
> seems work fine. Hopefully we don't need workaround like on
> Ironlake for Sandybridge.
> 
> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>

I rebased this to drm-intel-next and just chained the if statements
instead of nesting the ironlake code farther down.

[-- 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] 3+ messages in thread

end of thread, other threads:[~2010-05-28 18:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-27  2:26 [PATCH 1/2] drm/i915: Fix PIPE_CONTROL command on Sandybridge Zhenyu Wang
2010-05-27  2:26 ` [PATCH 2/2] drm/i915: Unmask interrupt for render engine " Zhenyu Wang
2010-05-28 18:12 ` [PATCH 1/2] drm/i915: Fix PIPE_CONTROL command " Eric Anholt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).