summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nvc0_grctx.c
diff options
context:
space:
mode:
authorBen Skeggs2010-12-24 00:33:33 +0100
committerBen Skeggs2010-12-29 01:51:27 +0100
commitb1cd916ab96e5fcd16e2009410af2e8edfae2962 (patch)
treebdacd0667d133053b9c9c91465b42de89fbd251d /drivers/gpu/drm/nouveau/nvc0_grctx.c
parentdrm/nouveau: Validate channel indices passed from userspace. (diff)
downloadkernel-qcow2-linux-b1cd916ab96e5fcd16e2009410af2e8edfae2962.tar.gz
kernel-qcow2-linux-b1cd916ab96e5fcd16e2009410af2e8edfae2962.tar.xz
kernel-qcow2-linux-b1cd916ab96e5fcd16e2009410af2e8edfae2962.zip
drm/nvc0: kill off a couple more magics
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvc0_grctx.c')
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_grctx.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/nvc0_grctx.c b/drivers/gpu/drm/nouveau/nvc0_grctx.c
index 88fa6211ac19..fddfab73a58d 100644
--- a/drivers/gpu/drm/nouveau/nvc0_grctx.c
+++ b/drivers/gpu/drm/nouveau/nvc0_grctx.c
@@ -1875,9 +1875,11 @@ nvc0_grctx_generate(struct nouveau_channel *chan)
}
if (1) {
- u32 data[6] = {};
+ u32 data[6] = {}, data2[2] = {};
u8 tpnr[GPC_MAX];
+ u8 shift, ntpcv;
+ /* calculate first set of magics */
memcpy(tpnr, priv->tp_nr, sizeof(priv->tp_nr));
for (tp = 0; tp < priv->tp_total; tp++) {
@@ -1892,6 +1894,20 @@ nvc0_grctx_generate(struct nouveau_channel *chan)
for (; tp < 32; tp++)
data[tp / 6] |= 7 << ((tp % 6) * 5);
+ /* and the second... */
+ shift = 0;
+ ntpcv = priv->tp_total;
+ while (!(ntpcv & (1 << 4))) {
+ ntpcv <<= 1;
+ shift++;
+ }
+
+ data2[0] = (ntpcv << 16);
+ data2[0] |= (shift << 21);
+ data2[0] |= (((1 << (0 + 5)) % ntpcv) << 24);
+ for (i = 1; i < 7; i++)
+ data2[1] |= ((1 << (i + 5)) % ntpcv) << ((i - 1) * 5);
+
// GPC_BROADCAST
nv_wr32(dev, 0x418bb8, (priv->tp_total << 8) |
priv->magic_not_rop_nr);
@@ -1900,9 +1916,9 @@ nvc0_grctx_generate(struct nouveau_channel *chan)
// GPC_BROADCAST.TP_BROADCAST
nv_wr32(dev, 0x419bd0, (priv->tp_total << 8) |
- priv->magic_not_rop_nr |
- priv->magic419bd0);
- nv_wr32(dev, 0x419be4, priv->magic419be4);
+ priv->magic_not_rop_nr |
+ data2[0]);
+ nv_wr32(dev, 0x419be4, data2[1]);
for (i = 0; i < 6; i++)
nv_wr32(dev, 0x419b00 + (i * 4), data[i]);