diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvc0_grctx.c')
| -rw-r--r-- | drivers/gpu/drm/nouveau/nvc0_grctx.c | 239 | 
1 files changed, 86 insertions, 153 deletions
diff --git a/drivers/gpu/drm/nouveau/nvc0_grctx.c b/drivers/gpu/drm/nouveau/nvc0_grctx.c index 6df06611413..31018eaf527 100644 --- a/drivers/gpu/drm/nouveau/nvc0_grctx.c +++ b/drivers/gpu/drm/nouveau/nvc0_grctx.c @@ -45,6 +45,9 @@ nv_mthd(struct drm_device *dev, u32 class, u32 mthd, u32 data)  static void  nvc0_grctx_generate_9097(struct drm_device *dev)  { +	u32 fermi = nvc0_graph_class(dev); +	u32 mthd; +  	nv_mthd(dev, 0x9097, 0x0800, 0x00000000);  	nv_mthd(dev, 0x9097, 0x0840, 0x00000000);  	nv_mthd(dev, 0x9097, 0x0880, 0x00000000); @@ -824,134 +827,10 @@ nvc0_grctx_generate_9097(struct drm_device *dev)  	nv_mthd(dev, 0x9097, 0x1eb8, 0x00000001);  	nv_mthd(dev, 0x9097, 0x1ed8, 0x00000001);  	nv_mthd(dev, 0x9097, 0x1ef8, 0x00000001); -	nv_mthd(dev, 0x9097, 0x3400, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3404, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3408, 0x00000000); -	nv_mthd(dev, 0x9097, 0x340c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3410, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3414, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3418, 0x00000000); -	nv_mthd(dev, 0x9097, 0x341c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3420, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3424, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3428, 0x00000000); -	nv_mthd(dev, 0x9097, 0x342c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3430, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3434, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3438, 0x00000000); -	nv_mthd(dev, 0x9097, 0x343c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3440, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3444, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3448, 0x00000000); -	nv_mthd(dev, 0x9097, 0x344c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3450, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3454, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3458, 0x00000000); -	nv_mthd(dev, 0x9097, 0x345c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3460, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3464, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3468, 0x00000000); -	nv_mthd(dev, 0x9097, 0x346c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3470, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3474, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3478, 0x00000000); -	nv_mthd(dev, 0x9097, 0x347c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3480, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3484, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3488, 0x00000000); -	nv_mthd(dev, 0x9097, 0x348c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3490, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3494, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3498, 0x00000000); -	nv_mthd(dev, 0x9097, 0x349c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34a0, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34a4, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34a8, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34ac, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34b0, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34b4, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34b8, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34bc, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34c0, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34c4, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34c8, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34cc, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34d0, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34d4, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34d8, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34dc, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34e0, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34e4, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34e8, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34ec, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34f0, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34f4, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34f8, 0x00000000); -	nv_mthd(dev, 0x9097, 0x34fc, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3500, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3504, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3508, 0x00000000); -	nv_mthd(dev, 0x9097, 0x350c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3510, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3514, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3518, 0x00000000); -	nv_mthd(dev, 0x9097, 0x351c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3520, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3524, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3528, 0x00000000); -	nv_mthd(dev, 0x9097, 0x352c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3530, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3534, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3538, 0x00000000); -	nv_mthd(dev, 0x9097, 0x353c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3540, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3544, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3548, 0x00000000); -	nv_mthd(dev, 0x9097, 0x354c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3550, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3554, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3558, 0x00000000); -	nv_mthd(dev, 0x9097, 0x355c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3560, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3564, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3568, 0x00000000); -	nv_mthd(dev, 0x9097, 0x356c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3570, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3574, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3578, 0x00000000); -	nv_mthd(dev, 0x9097, 0x357c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3580, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3584, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3588, 0x00000000); -	nv_mthd(dev, 0x9097, 0x358c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3590, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3594, 0x00000000); -	nv_mthd(dev, 0x9097, 0x3598, 0x00000000); -	nv_mthd(dev, 0x9097, 0x359c, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35a0, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35a4, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35a8, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35ac, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35b0, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35b4, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35b8, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35bc, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35c0, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35c4, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35c8, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35cc, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35d0, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35d4, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35d8, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35dc, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35e0, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35e4, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35e8, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35ec, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35f0, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35f4, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35f8, 0x00000000); -	nv_mthd(dev, 0x9097, 0x35fc, 0x00000000); +	if (fermi == 0x9097) { +		for (mthd = 0x3400; mthd <= 0x35fc; mthd += 4) +			nv_mthd(dev, 0x9097, mthd, 0x00000000); +	}  	nv_mthd(dev, 0x9097, 0x030c, 0x00000001);  	nv_mthd(dev, 0x9097, 0x1944, 0x00000000);  	nv_mthd(dev, 0x9097, 0x1514, 0x00000000); @@ -1321,6 +1200,37 @@ nvc0_grctx_generate_9097(struct drm_device *dev)  }  static void +nvc0_grctx_generate_9197(struct drm_device *dev) +{ +	u32 fermi = nvc0_graph_class(dev); +	u32 mthd; + +	if (fermi == 0x9197) { +		for (mthd = 0x3400; mthd <= 0x35fc; mthd += 4) +			nv_mthd(dev, 0x9197, mthd, 0x00000000); +	} +	nv_mthd(dev, 0x9197, 0x02e4, 0x0000b001); +} + +static void +nvc0_grctx_generate_9297(struct drm_device *dev) +{ +	u32 fermi = nvc0_graph_class(dev); +	u32 mthd; + +	if (fermi == 0x9297) { +		for (mthd = 0x3400; mthd <= 0x35fc; mthd += 4) +			nv_mthd(dev, 0x9297, mthd, 0x00000000); +	} +	nv_mthd(dev, 0x9297, 0x036c, 0x00000000); +	nv_mthd(dev, 0x9297, 0x0370, 0x00000000); +	nv_mthd(dev, 0x9297, 0x07a4, 0x00000000); +	nv_mthd(dev, 0x9297, 0x07a8, 0x00000000); +	nv_mthd(dev, 0x9297, 0x0374, 0x00000000); +	nv_mthd(dev, 0x9297, 0x0378, 0x00000020); +} + +static void  nvc0_grctx_generate_902d(struct drm_device *dev)  {  	nv_mthd(dev, 0x902d, 0x0200, 0x000000cf); @@ -1559,8 +1469,15 @@ nvc0_grctx_generate_unk47xx(struct drm_device *dev)  static void  nvc0_grctx_generate_shaders(struct drm_device *dev)  { -	nv_wr32(dev, 0x405800, 0x078000bf); -	nv_wr32(dev, 0x405830, 0x02180000); +	struct drm_nouveau_private *dev_priv = dev->dev_private; + +	if (dev_priv->chipset != 0xc1) { +		nv_wr32(dev, 0x405800, 0x078000bf); +		nv_wr32(dev, 0x405830, 0x02180000); +	} else { +		nv_wr32(dev, 0x405800, 0x0f8000bf); +		nv_wr32(dev, 0x405830, 0x02180218); +	}  	nv_wr32(dev, 0x405834, 0x00000000);  	nv_wr32(dev, 0x405838, 0x00000000);  	nv_wr32(dev, 0x405854, 0x00000000); @@ -1586,10 +1503,16 @@ nvc0_grctx_generate_unk60xx(struct drm_device *dev)  static void  nvc0_grctx_generate_unk64xx(struct drm_device *dev)  { +	struct drm_nouveau_private *dev_priv = dev->dev_private; +  	nv_wr32(dev, 0x4064a8, 0x00000000);  	nv_wr32(dev, 0x4064ac, 0x00003fff);  	nv_wr32(dev, 0x4064b4, 0x00000000);  	nv_wr32(dev, 0x4064b8, 0x00000000); +	if (dev_priv->chipset == 0xc1) { +		nv_wr32(dev, 0x4064c0, 0x80140078); +		nv_wr32(dev, 0x4064c4, 0x0086ffff); +	}  }  static void @@ -1622,21 +1545,14 @@ static void  nvc0_grctx_generate_rop(struct drm_device *dev)  {  	struct drm_nouveau_private *dev_priv = dev->dev_private; +	int chipset = dev_priv->chipset;  	/* ROPC_BROADCAST */  	nv_wr32(dev, 0x408800, 0x02802a3c);  	nv_wr32(dev, 0x408804, 0x00000040); -	nv_wr32(dev, 0x408808, 0x0003e00d); -	switch (dev_priv->chipset) { -	case 0xc0: -		nv_wr32(dev, 0x408900, 0x0080b801); -		break; -	case 0xc3: -	case 0xc4: -		nv_wr32(dev, 0x408900, 0x3080b801); -		break; -	} -	nv_wr32(dev, 0x408904, 0x02000001); +	nv_wr32(dev, 0x408808, chipset != 0xc1 ? 0x0003e00d : 0x1003e005); +	nv_wr32(dev, 0x408900, 0x3080b801); +	nv_wr32(dev, 0x408904, chipset != 0xc1 ? 0x02000001 : 0x62000001);  	nv_wr32(dev, 0x408908, 0x00c80929);  	nv_wr32(dev, 0x40890c, 0x00000000);  	nv_wr32(dev, 0x408980, 0x0000011d); @@ -1645,6 +1561,8 @@ nvc0_grctx_generate_rop(struct drm_device *dev)  static void  nvc0_grctx_generate_gpc(struct drm_device *dev)  { +	struct drm_nouveau_private *dev_priv = dev->dev_private; +	int chipset = dev_priv->chipset;  	int i;  	/* GPC_BROADCAST */ @@ -1676,7 +1594,7 @@ nvc0_grctx_generate_gpc(struct drm_device *dev)  	nv_wr32(dev, 0x41880c, 0x00000000);  	nv_wr32(dev, 0x418810, 0x00000000);  	nv_wr32(dev, 0x418828, 0x00008442); -	nv_wr32(dev, 0x418830, 0x00000001); +	nv_wr32(dev, 0x418830, chipset != 0xc1 ? 0x00000001 : 0x10000001);  	nv_wr32(dev, 0x4188d8, 0x00000008);  	nv_wr32(dev, 0x4188e0, 0x01000000);  	nv_wr32(dev, 0x4188e8, 0x00000000); @@ -1684,7 +1602,7 @@ nvc0_grctx_generate_gpc(struct drm_device *dev)  	nv_wr32(dev, 0x4188f0, 0x00000000);  	nv_wr32(dev, 0x4188f4, 0x00000000);  	nv_wr32(dev, 0x4188f8, 0x00000000); -	nv_wr32(dev, 0x4188fc, 0x00100000); +	nv_wr32(dev, 0x4188fc, chipset != 0xc1 ? 0x00100000 : 0x00100018);  	nv_wr32(dev, 0x41891c, 0x00ff00ff);  	nv_wr32(dev, 0x418924, 0x00000000);  	nv_wr32(dev, 0x418928, 0x00ffff00); @@ -1715,6 +1633,8 @@ nvc0_grctx_generate_gpc(struct drm_device *dev)  	nv_wr32(dev, 0x418c24, 0x00000000);  	nv_wr32(dev, 0x418c28, 0x00000000);  	nv_wr32(dev, 0x418c2c, 0x00000000); +	if (chipset == 0xc1) +		nv_wr32(dev, 0x418c6c, 0x00000001);  	nv_wr32(dev, 0x418c80, 0x20200004);  	nv_wr32(dev, 0x418c8c, 0x00000001);  	nv_wr32(dev, 0x419000, 0x00000780); @@ -1727,10 +1647,13 @@ static void  nvc0_grctx_generate_tp(struct drm_device *dev)  {  	struct drm_nouveau_private *dev_priv = dev->dev_private; +	int chipset = dev_priv->chipset;  	/* GPC_BROADCAST.TP_BROADCAST */ +	nv_wr32(dev, 0x419818, 0x00000000); +	nv_wr32(dev, 0x41983c, 0x00038bc7);  	nv_wr32(dev, 0x419848, 0x00000000); -	nv_wr32(dev, 0x419864, 0x0000012a); +	nv_wr32(dev, 0x419864, chipset != 0xc1 ? 0x0000012a : 0x00000129);  	nv_wr32(dev, 0x419888, 0x00000000);  	nv_wr32(dev, 0x419a00, 0x000001f0);  	nv_wr32(dev, 0x419a04, 0x00000001); @@ -1740,8 +1663,8 @@ nvc0_grctx_generate_tp(struct drm_device *dev)  	nv_wr32(dev, 0x419a14, 0x00000200);  	nv_wr32(dev, 0x419a1c, 0x00000000);  	nv_wr32(dev, 0x419a20, 0x00000800); -	if (dev_priv->chipset != 0xc0) -		nv_wr32(dev, 0x00419ac4, 0x0007f440); /* 0xc3 */ +	if (chipset != 0xc0 && chipset != 0xc8) +		nv_wr32(dev, 0x00419ac4, 0x0007f440);  	nv_wr32(dev, 0x419b00, 0x0a418820);  	nv_wr32(dev, 0x419b04, 0x062080e6);  	nv_wr32(dev, 0x419b08, 0x020398a4); @@ -1749,17 +1672,19 @@ nvc0_grctx_generate_tp(struct drm_device *dev)  	nv_wr32(dev, 0x419b10, 0x0a418820);  	nv_wr32(dev, 0x419b14, 0x000000e6);  	nv_wr32(dev, 0x419bd0, 0x00900103); -	nv_wr32(dev, 0x419be0, 0x00000001); +	nv_wr32(dev, 0x419be0, chipset != 0xc1 ? 0x00000001 : 0x00400001);  	nv_wr32(dev, 0x419be4, 0x00000000);  	nv_wr32(dev, 0x419c00, 0x00000002);  	nv_wr32(dev, 0x419c04, 0x00000006);  	nv_wr32(dev, 0x419c08, 0x00000002);  	nv_wr32(dev, 0x419c20, 0x00000000); -	nv_wr32(dev, 0x419cbc, 0x28137606); +	nv_wr32(dev, 0x419cb0, 0x00060048); //XXX: 0xce 0x00020048  	nv_wr32(dev, 0x419ce8, 0x00000000);  	nv_wr32(dev, 0x419cf4, 0x00000183); -	nv_wr32(dev, 0x419d20, 0x02180000); +	nv_wr32(dev, 0x419d20, chipset != 0xc1 ? 0x02180000 : 0x12180000);  	nv_wr32(dev, 0x419d24, 0x00001fff); +	if (chipset == 0xc1) +		nv_wr32(dev, 0x419d44, 0x02180218);  	nv_wr32(dev, 0x419e04, 0x00000000);  	nv_wr32(dev, 0x419e08, 0x00000000);  	nv_wr32(dev, 0x419e0c, 0x00000000); @@ -1785,11 +1710,11 @@ nvc0_grctx_generate_tp(struct drm_device *dev)  	nv_wr32(dev, 0x419e8c, 0x00000000);  	nv_wr32(dev, 0x419e90, 0x00000000);  	nv_wr32(dev, 0x419e98, 0x00000000); -	if (dev_priv->chipset != 0xc0) +	if (chipset != 0xc0 && chipset != 0xc8)  		nv_wr32(dev, 0x419ee0, 0x00011110);  	nv_wr32(dev, 0x419f50, 0x00000000);  	nv_wr32(dev, 0x419f54, 0x00000000); -	if (dev_priv->chipset != 0xc0) +	if (chipset != 0xc0 && chipset != 0xc8)  		nv_wr32(dev, 0x419f58, 0x00000000);  } @@ -1801,6 +1726,7 @@ nvc0_grctx_generate(struct nouveau_channel *chan)  	struct nvc0_graph_chan *grch = chan->engctx[NVOBJ_ENGINE_GR];  	struct drm_device *dev = chan->dev;  	int i, gpc, tp, id; +	u32 fermi = nvc0_graph_class(dev);  	u32 r000260, tmp;  	r000260 = nv_rd32(dev, 0x000260); @@ -1857,10 +1783,11 @@ nvc0_grctx_generate(struct nouveau_channel *chan)  	nv_wr32(dev, 0x40587c, 0x00000000);  	if (1) { -		const u8 chipset_tp_max[] = { 16, 0, 0, 4, 8 }; +		const u8 chipset_tp_max[] = { 16, 4, 0, 4, 8, 0, 0, 0, +					      16, 0, 0, 0, 0, 0, 8, 0 };  		u8 max = chipset_tp_max[dev_priv->chipset & 0x0f];  		u8 tpnr[GPC_MAX]; -		u8 data[32]; +		u8 data[TP_MAX];  		memcpy(tpnr, priv->tp_nr, sizeof(priv->tp_nr));  		memset(data, 0x1f, sizeof(data)); @@ -2633,6 +2560,8 @@ nvc0_grctx_generate(struct nouveau_channel *chan)  	nv_icmd(dev, 0x0000053f, 0xffff0000);  	nv_icmd(dev, 0x00000585, 0x0000003f);  	nv_icmd(dev, 0x00000576, 0x00000003); +	if (dev_priv->chipset == 0xc1) +		nv_icmd(dev, 0x0000057b, 0x00000059);  	nv_icmd(dev, 0x00000586, 0x00000040);  	nv_icmd(dev, 0x00000582, 0x00000080);  	nv_icmd(dev, 0x00000583, 0x00000080); @@ -2865,6 +2794,10 @@ nvc0_grctx_generate(struct nouveau_channel *chan)  	nv_wr32(dev, 0x404154, 0x00000400);  	nvc0_grctx_generate_9097(dev); +	if (fermi >= 0x9197) +		nvc0_grctx_generate_9197(dev); +	if (fermi >= 0x9297) +		nvc0_grctx_generate_9297(dev);  	nvc0_grctx_generate_902d(dev);  	nvc0_grctx_generate_9039(dev);  	nvc0_grctx_generate_90c0(dev);  |