aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nv40_graph.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-08-01 20:31:47 -0400
committerDave Airlie <airlied@redhat.com>2010-08-01 20:31:47 -0400
commitd6486813d2d0658c34f62212ba9a64be4d01c317 (patch)
tree2fac929ee406d4b5612db89a643430a3f94742ee /drivers/gpu/drm/nouveau/nv40_graph.c
parent7827627107aeb629f1a056cb56b17bd4fb789e03 (diff)
parent05991110cf94117dd488f6d64dabdea56ff35107 (diff)
Merge remote branch 'nouveau/for-airlied' of ../drm-nouveau-next into drm-core-next
* 'nouveau/for-airlied' of ../drm-nouveau-next: (77 commits) drm/nouveau: set TASK_(UN)INTERRUPTIBLE before schedule_timeout() drm/nv50: fix some not-error error messages drm/nouveau: introduce gpio engine drm/nv50: correct wait condition for instmem flush drm/nouveau: Fix TV-out detection on unposted cards lacking a usable DCB table. drm/nouveau: Get rid of the remaining VGA CRTC locking. drm/nouveau: Move display init to a new nouveau_engine. drm/nouveau: Put back the old 2-messages I2C slave test. drm/nouveau: Reset AGP before running the init scripts. drm/nv30: Init the PFB+0x3xx memory timing regs. drm/nouveau: disable hotplug detect around DP link training drm/nv50: add function to control GPIO IRQ reporting drm/nouveau: add nv_mask register accessor drm/nouveau: fix build without CONFIG_ACPI drm/nouveau: Reset CRTC owner to 0 before BIOS init. drm/nouveau: No need to lock/unlock the VGA CRTC regs all the time. drm/nouveau: Remove useless CRTC_OWNER logging. drm/nouveau: Add some generic I2C gadget detection code. drm/i2c/ch7006: Don't assume that the specified config points to static memory. drm/nv04-nv3x: Implement init-compute-mem. ... Conflicts: drivers/gpu/drm/nouveau/nouveau_bios.c
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv40_graph.c')
-rw-r--r--drivers/gpu/drm/nouveau/nv40_graph.c58
1 files changed, 21 insertions, 37 deletions
diff --git a/drivers/gpu/drm/nouveau/nv40_graph.c b/drivers/gpu/drm/nouveau/nv40_graph.c
index 65b13b54c5ae..fd7d2b501316 100644
--- a/drivers/gpu/drm/nouveau/nv40_graph.c
+++ b/drivers/gpu/drm/nouveau/nv40_graph.c
@@ -58,6 +58,7 @@ nv40_graph_create_context(struct nouveau_channel *chan)
58 struct drm_device *dev = chan->dev; 58 struct drm_device *dev = chan->dev;
59 struct drm_nouveau_private *dev_priv = dev->dev_private; 59 struct drm_nouveau_private *dev_priv = dev->dev_private;
60 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; 60 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
61 struct nouveau_grctx ctx = {};
61 int ret; 62 int ret;
62 63
63 ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, pgraph->grctx_size, 64 ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, pgraph->grctx_size,
@@ -67,20 +68,13 @@ nv40_graph_create_context(struct nouveau_channel *chan)
67 return ret; 68 return ret;
68 69
69 /* Initialise default context values */ 70 /* Initialise default context values */
70 dev_priv->engine.instmem.prepare_access(dev, true); 71 ctx.dev = chan->dev;
71 if (!pgraph->ctxprog) { 72 ctx.mode = NOUVEAU_GRCTX_VALS;
72 struct nouveau_grctx ctx = {}; 73 ctx.data = chan->ramin_grctx->gpuobj;
73 74 nv40_grctx_init(&ctx);
74 ctx.dev = chan->dev; 75
75 ctx.mode = NOUVEAU_GRCTX_VALS;
76 ctx.data = chan->ramin_grctx->gpuobj;
77 nv40_grctx_init(&ctx);
78 } else {
79 nouveau_grctx_vals_load(dev, chan->ramin_grctx->gpuobj);
80 }
81 nv_wo32(dev, chan->ramin_grctx->gpuobj, 0, 76 nv_wo32(dev, chan->ramin_grctx->gpuobj, 0,
82 chan->ramin_grctx->gpuobj->im_pramin->start); 77 chan->ramin_grctx->gpuobj->im_pramin->start);
83 dev_priv->engine.instmem.finish_access(dev);
84 return 0; 78 return 0;
85} 79}
86 80
@@ -238,7 +232,8 @@ nv40_graph_init(struct drm_device *dev)
238 struct drm_nouveau_private *dev_priv = 232 struct drm_nouveau_private *dev_priv =
239 (struct drm_nouveau_private *)dev->dev_private; 233 (struct drm_nouveau_private *)dev->dev_private;
240 struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; 234 struct nouveau_fb_engine *pfb = &dev_priv->engine.fb;
241 uint32_t vramsz; 235 struct nouveau_grctx ctx = {};
236 uint32_t vramsz, *cp;
242 int i, j; 237 int i, j;
243 238
244 nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & 239 nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) &
@@ -246,32 +241,22 @@ nv40_graph_init(struct drm_device *dev)
246 nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) | 241 nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) |
247 NV_PMC_ENABLE_PGRAPH); 242 NV_PMC_ENABLE_PGRAPH);
248 243
249 if (nouveau_ctxfw) { 244 cp = kmalloc(sizeof(*cp) * 256, GFP_KERNEL);
250 nouveau_grctx_prog_load(dev); 245 if (!cp)
251 dev_priv->engine.graph.grctx_size = 175 * 1024; 246 return -ENOMEM;
252 }
253 247
254 if (!dev_priv->engine.graph.ctxprog) { 248 ctx.dev = dev;
255 struct nouveau_grctx ctx = {}; 249 ctx.mode = NOUVEAU_GRCTX_PROG;
256 uint32_t *cp; 250 ctx.data = cp;
251 ctx.ctxprog_max = 256;
252 nv40_grctx_init(&ctx);
253 dev_priv->engine.graph.grctx_size = ctx.ctxvals_pos * 4;
257 254
258 cp = kmalloc(sizeof(*cp) * 256, GFP_KERNEL); 255 nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0);
259 if (!cp) 256 for (i = 0; i < ctx.ctxprog_len; i++)
260 return -ENOMEM; 257 nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA, cp[i]);
261 258
262 ctx.dev = dev; 259 kfree(cp);
263 ctx.mode = NOUVEAU_GRCTX_PROG;
264 ctx.data = cp;
265 ctx.ctxprog_max = 256;
266 nv40_grctx_init(&ctx);
267 dev_priv->engine.graph.grctx_size = ctx.ctxvals_pos * 4;
268
269 nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0);
270 for (i = 0; i < ctx.ctxprog_len; i++)
271 nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA, cp[i]);
272
273 kfree(cp);
274 }
275 260
276 /* No context present currently */ 261 /* No context present currently */
277 nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0x00000000); 262 nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0x00000000);
@@ -407,7 +392,6 @@ nv40_graph_init(struct drm_device *dev)
407 392
408void nv40_graph_takedown(struct drm_device *dev) 393void nv40_graph_takedown(struct drm_device *dev)
409{ 394{
410 nouveau_grctx_fini(dev);
411} 395}
412 396
413struct nouveau_pgraph_object_class nv40_graph_grclass[] = { 397struct nouveau_pgraph_object_class nv40_graph_grclass[] = {