Skip to contentSkip to conversation

drm/nv50: wait for fifo completion when needed

PATCH In review Maxime COSTE 3 participants 5 messages Jul 2, 2009 – Jul 4, 2009 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#1 lore raw
In reply to Maxime COSTE

This smells like taping over a bigger issue imo. The only reason the old code did this because it didn't have interrupts to signal clock changes (and such). I have no other solution, nor personal experience, because i've been away (and still am). I just want to give my 2 cents.

Maarten.

#3 lore raw
In reply to a message not in the archive
Quoted 4 lines · Maarten Maathuis

This smells like taping over a bigger issue imo. The only reason the old code did this because it didn't have interrupts to signal clock changes (and such). I have no other solution, nor personal experience, because i've been away (and still am). I just want to give my 2 cents.

I agree, this really should not be required. The display channel should stall on its own until the appropriate IRQs have been handled, if required.

It might be useful to know *which* of these "fixes" the issue to track down the real problem.

Ben.

Quoted 6 lines

Maarten.
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#0 lore raw

PATCH 1/1 drm/nv50: wait for fifo completion when needed

This fixes kms for 9800M and possibly 9600M

---
 drivers/gpu/drm/nouveau/nouveau_dma.h  |    8 ++++++++
 drivers/gpu/drm/nouveau/nv50_crtc.c    |    5 +++++
 drivers/gpu/drm/nouveau/nv50_cursor.c  |    2 ++
 drivers/gpu/drm/nouveau/nv50_display.c |    2 ++
 4 files changed, 17 insertions(+), 0 deletions(-)
drivers/gpu/drm/nouveau/nouveau_dma.h +8 -0
index 9498c45..399436f 100644
@@ -128,6 +128,14 @@ FIRE_RING(struct nouveau_channel *chan)
 }
 
 static inline void
+RING_WAIT(struct nouveau_channel *chan)
+{
+	nouveau_wait_until(chan->dev, 2000000000ULL, 
+		NV50_PDISPLAY_USER_GET(0), 0xffffffff,
+		(chan->dma.cur << 2) + chan->pushbuf_base);
+}
+
+static inline void
 WIND_RING(struct nouveau_channel *chan)
 {
 	chan->dma.cur = chan->dma.put;
drivers/gpu/drm/nouveau/nv50_crtc.c +5 -0
index d8e8f1b..dba8b93 100644
@@ -176,6 +176,7 @@ static int nv50_crtc_set_dither(struct nouveau_crtc *crtc, bool update)
 		BEGIN_RING(evo, 0, NV50_UPDATE_DISPLAY, 1);
 		OUT_RING  (evo, 0);
 		FIRE_RING (evo);
+		RING_WAIT (evo);
 	}
 
 	return 0;
@@ -294,6 +295,7 @@ nv50_crtc_set_scale(struct nouveau_crtc *crtc, int scaling_mode, bool update)
 		BEGIN_RING(evo, 0, NV50_UPDATE_DISPLAY, 1);
 		OUT_RING  (evo, 0);
 		FIRE_RING (evo);
+		RING_WAIT (evo);
 	}
 
 	return 0;
@@ -520,6 +522,7 @@ static void nv50_crtc_commit(struct drm_crtc *drm_crtc)
 	BEGIN_RING(evo, 0, NV50_UPDATE_DISPLAY, 1);
 	OUT_RING  (evo, 0);
 	FIRE_RING (evo);
+	RING_WAIT (evo);
 }
 
 static bool nv50_crtc_mode_fixup(struct drm_crtc *drm_crtc,
@@ -612,6 +615,7 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *drm_crtc, int x, int y,
 		BEGIN_RING(evo, 0, NV50_UPDATE_DISPLAY, 1);
 		OUT_RING  (evo, 0);
 		FIRE_RING (evo);
+		RING_WAIT (evo);
 	}
 
 	return 0;
@@ -726,6 +730,7 @@ nv50_crtc_mode_set(struct drm_crtc *drm_crtc, struct drm_display_mode *mode,
 	crtc->set_scale(crtc, connector->scaling_mode, false);
 
 	FIRE_RING (evo);
+	RING_WAIT (evo);
 	return nv50_crtc_do_mode_set_base(drm_crtc, x, y, old_fb, false);
 }
 
drivers/gpu/drm/nouveau/nv50_cursor.c +2 -0
index 23234e5..9d69888 100644
@@ -60,6 +60,7 @@ nv50_cursor_show(struct nouveau_crtc *crtc, bool update)
 		BEGIN_RING(evo, 0, NV50_UPDATE_DISPLAY, 1);
 		OUT_RING  (evo, 0);
 		FIRE_RING (evo);
+		RING_WAIT (evo);
 		crtc->cursor.visible = true;
 	}
 }
@@ -92,6 +93,7 @@ nv50_cursor_hide(struct nouveau_crtc *crtc, bool update)
 		BEGIN_RING(evo, 0, NV50_UPDATE_DISPLAY, 1);
 		OUT_RING  (evo, 0);
 		FIRE_RING (evo);
+		RING_WAIT (evo);
 		crtc->cursor.visible = false;
 	}
 }
drivers/gpu/drm/nouveau/nv50_display.c +2 -0
index 5c38c78..f264bae 100644
@@ -242,6 +242,7 @@ nv50_display_init(struct drm_device *dev)
 	BEGIN_RING(&evo->chan, 0, NV50_CRTC0_UNK82C, 1);
 	OUT_RING  (&evo->chan, 0);
 	FIRE_RING (&evo->chan);
+	RING_WAIT (&evo->chan);
 
 	/* enable clock change interrupts. */
 	nv_wr32(NV50_PDISPLAY_INTR_EN, (NV50_PDISPLAY_INTR_EN_CLK_UNK10 |
@@ -274,6 +275,7 @@ static int nv50_display_disable(struct drm_device *dev)
 	BEGIN_RING(&dev_priv->evo.chan, 0, NV50_UPDATE_DISPLAY, 1);
 	OUT_RING  (&dev_priv->evo.chan, 0);
 	FIRE_RING (&dev_priv->evo.chan);
+	RING_WAIT (&dev_priv->evo.chan);
 
 	/* Almost like ack'ing a vblank interrupt, maybe in the spirit of
 	 * cleaning up?
Signature · 1 line
1.6.3.3
#4 lore raw
In reply to Ben Skeggs
Quoted 2 lines · Ben Skeggs

It might be useful to know *which* of these "fixes" the issue to track down the real problem.

Okay, I'll check that by monday.

Regards,

Maxime Coste.

#5 lore raw

PATCH 1/1 drm/nv50: wait for fifo completion in nv50_display_init

Actually the only needed RING_WAIT is in nv50_display.

---
 drivers/gpu/drm/nouveau/nouveau_dma.h  |    8 ++++++++
 drivers/gpu/drm/nouveau/nv50_display.c |    1 +
 2 files changed, 9 insertions(+), 0 deletions(-)
drivers/gpu/drm/nouveau/nouveau_dma.h +8 -0
index 9498c45..399436f 100644
@@ -128,6 +128,14 @@ FIRE_RING(struct nouveau_channel *chan)
 }
 
 static inline void
+RING_WAIT(struct nouveau_channel *chan)
+{
+	nouveau_wait_until(chan->dev, 2000000000ULL, 
+		NV50_PDISPLAY_USER_GET(0), 0xffffffff,
+		(chan->dma.cur << 2) + chan->pushbuf_base);
+}
+
+static inline void
 WIND_RING(struct nouveau_channel *chan)
 {
 	chan->dma.cur = chan->dma.put;
drivers/gpu/drm/nouveau/nv50_display.c +1 -0
index 5c38c78..16b94d7 100644
@@ -242,6 +242,7 @@ nv50_display_init(struct drm_device *dev)
 	BEGIN_RING(&evo->chan, 0, NV50_CRTC0_UNK82C, 1);
 	OUT_RING  (&evo->chan, 0);
 	FIRE_RING (&evo->chan);
+	RING_WAIT (&evo->chan);
 
 	/* enable clock change interrupts. */
 	nv_wr32(NV50_PDISPLAY_INTR_EN, (NV50_PDISPLAY_INTR_EN_CLK_UNK10 |
Signature · 1 line
1.6.3.3