aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2010-08-26 17:07:02 -0400
committerBen Skeggs <bskeggs@redhat.com>2010-09-24 02:17:59 -0400
commit4295f188e8297660b498e021caee430a40558d8b (patch)
tree9cec49772202a50ed168c0215a48f6b22f79fc16
parent316f60a120a8f1dacb574f705d5faf7eac3e6e2a (diff)
drm/nv20: Use the nv30 CRTC bandwidth calculation code.
nv2x CRTC FIFOs are as large as in nv3x (4kB it seems), and the FIFO control registers have the same layout: we can make them share the same implementation. Previously we were using the nv1x code, but the calculated FIFO watermarks are usually too low for nv2x and they cause horrible scanout artifacts. They've gone unnoticed until now because we've been leaving one of the bandwidth regs uninitialized (CRE 47, which contains the most significant bits of FFLWM), so everything seemed to work fine except in some cases after a cold boot, depending on the memory bandwidth and pixel clocks used. Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_calc.c6
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_hw.c10
-rw-r--r--drivers/gpu/drm/nouveau/nv04_crtc.c2
3 files changed, 10 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_calc.c b/drivers/gpu/drm/nouveau/nouveau_calc.c
index ca85da784846..23d9896962f4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_calc.c
+++ b/drivers/gpu/drm/nouveau/nouveau_calc.c
@@ -234,7 +234,7 @@ nv04_update_arb(struct drm_device *dev, int VClk, int bpp,
234} 234}
235 235
236static void 236static void
237nv30_update_arb(int *burst, int *lwm) 237nv20_update_arb(int *burst, int *lwm)
238{ 238{
239 unsigned int fifo_size, burst_size, graphics_lwm; 239 unsigned int fifo_size, burst_size, graphics_lwm;
240 240
@@ -251,14 +251,14 @@ nouveau_calc_arb(struct drm_device *dev, int vclk, int bpp, int *burst, int *lwm
251{ 251{
252 struct drm_nouveau_private *dev_priv = dev->dev_private; 252 struct drm_nouveau_private *dev_priv = dev->dev_private;
253 253
254 if (dev_priv->card_type < NV_30) 254 if (dev_priv->card_type < NV_20)
255 nv04_update_arb(dev, vclk, bpp, burst, lwm); 255 nv04_update_arb(dev, vclk, bpp, burst, lwm);
256 else if ((dev->pci_device & 0xfff0) == 0x0240 /*CHIPSET_C51*/ || 256 else if ((dev->pci_device & 0xfff0) == 0x0240 /*CHIPSET_C51*/ ||
257 (dev->pci_device & 0xfff0) == 0x03d0 /*CHIPSET_C512*/) { 257 (dev->pci_device & 0xfff0) == 0x03d0 /*CHIPSET_C512*/) {
258 *burst = 128; 258 *burst = 128;
259 *lwm = 0x0480; 259 *lwm = 0x0480;
260 } else 260 } else
261 nv30_update_arb(burst, lwm); 261 nv20_update_arb(burst, lwm);
262} 262}
263 263
264static int 264static int
diff --git a/drivers/gpu/drm/nouveau/nouveau_hw.c b/drivers/gpu/drm/nouveau/nouveau_hw.c
index 7b613682e400..f8ec49b5308b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_hw.c
+++ b/drivers/gpu/drm/nouveau/nouveau_hw.c
@@ -866,10 +866,11 @@ nv_save_state_ext(struct drm_device *dev, int head,
866 rd_cio_state(dev, head, regp, NV_CIO_CRE_FFLWM__INDEX); 866 rd_cio_state(dev, head, regp, NV_CIO_CRE_FFLWM__INDEX);
867 rd_cio_state(dev, head, regp, NV_CIO_CRE_21); 867 rd_cio_state(dev, head, regp, NV_CIO_CRE_21);
868 868
869 if (dev_priv->card_type >= NV_30) { 869 if (dev_priv->card_type >= NV_20)
870 rd_cio_state(dev, head, regp, NV_CIO_CRE_47); 870 rd_cio_state(dev, head, regp, NV_CIO_CRE_47);
871
872 if (dev_priv->card_type >= NV_30)
871 rd_cio_state(dev, head, regp, 0x9f); 873 rd_cio_state(dev, head, regp, 0x9f);
872 }
873 874
874 rd_cio_state(dev, head, regp, NV_CIO_CRE_49); 875 rd_cio_state(dev, head, regp, NV_CIO_CRE_49);
875 rd_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR0_INDEX); 876 rd_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR0_INDEX);
@@ -976,10 +977,11 @@ nv_load_state_ext(struct drm_device *dev, int head,
976 wr_cio_state(dev, head, regp, NV_CIO_CRE_FF_INDEX); 977 wr_cio_state(dev, head, regp, NV_CIO_CRE_FF_INDEX);
977 wr_cio_state(dev, head, regp, NV_CIO_CRE_FFLWM__INDEX); 978 wr_cio_state(dev, head, regp, NV_CIO_CRE_FFLWM__INDEX);
978 979
979 if (dev_priv->card_type >= NV_30) { 980 if (dev_priv->card_type >= NV_20)
980 wr_cio_state(dev, head, regp, NV_CIO_CRE_47); 981 wr_cio_state(dev, head, regp, NV_CIO_CRE_47);
982
983 if (dev_priv->card_type >= NV_30)
981 wr_cio_state(dev, head, regp, 0x9f); 984 wr_cio_state(dev, head, regp, 0x9f);
982 }
983 985
984 wr_cio_state(dev, head, regp, NV_CIO_CRE_49); 986 wr_cio_state(dev, head, regp, NV_CIO_CRE_49);
985 wr_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR0_INDEX); 987 wr_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR0_INDEX);
diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c
index 497df8765f28..932c914743fc 100644
--- a/drivers/gpu/drm/nouveau/nv04_crtc.c
+++ b/drivers/gpu/drm/nouveau/nv04_crtc.c
@@ -826,7 +826,7 @@ nv04_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
826 crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_FF_INDEX); 826 crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_FF_INDEX);
827 crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_FFLWM__INDEX); 827 crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_FFLWM__INDEX);
828 828
829 if (dev_priv->card_type >= NV_30) { 829 if (dev_priv->card_type >= NV_20) {
830 regp->CRTC[NV_CIO_CRE_47] = arb_lwm >> 8; 830 regp->CRTC[NV_CIO_CRE_47] = arb_lwm >> 8;
831 crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_47); 831 crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_47);
832 } 832 }