aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-07-08 01:40:18 -0400
committerBen Skeggs <bskeggs@redhat.com>2010-07-12 20:13:50 -0400
commitc50a5681e7d0ce1dd6de06fd70a7eff56ebfb9e9 (patch)
tree6c15d5aefc9e961406e079de47d1adfe7090f8c9 /drivers/gpu/drm/nouveau
parentac94a343c74fe0504663583a7590e89257214f0d (diff)
drm/nv20-nv30: move context table object out of dev_priv
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h7
-rw-r--r--drivers/gpu/drm/nouveau/nv20_graph.c33
2 files changed, 18 insertions, 22 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index f3dbce20332b..47fa28ddec75 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -333,6 +333,9 @@ struct nouveau_pgraph_engine {
333 bool accel_blocked; 333 bool accel_blocked;
334 int grctx_size; 334 int grctx_size;
335 335
336 /* NV2x/NV3x context table (0x400780) */
337 struct nouveau_gpuobj_ref *ctx_table;
338
336 int (*init)(struct drm_device *); 339 int (*init)(struct drm_device *);
337 void (*takedown)(struct drm_device *); 340 void (*takedown)(struct drm_device *);
338 341
@@ -580,10 +583,6 @@ struct drm_nouveau_private {
580 583
581 struct drm_mm ramin_heap; 584 struct drm_mm ramin_heap;
582 585
583 /* context table pointed to be NV_PGRAPH_CHANNEL_CTX_TABLE (0x400780) */
584 uint32_t ctx_table_size;
585 struct nouveau_gpuobj_ref *ctx_table;
586
587 struct list_head gpuobj_list; 586 struct list_head gpuobj_list;
588 587
589 struct nvbios vbios; 588 struct nvbios vbios;
diff --git a/drivers/gpu/drm/nouveau/nv20_graph.c b/drivers/gpu/drm/nouveau/nv20_graph.c
index 0c776ee81e85..17f309b36c91 100644
--- a/drivers/gpu/drm/nouveau/nv20_graph.c
+++ b/drivers/gpu/drm/nouveau/nv20_graph.c
@@ -416,8 +416,8 @@ nv20_graph_create_context(struct nouveau_channel *chan)
416 nv_wo32(dev, chan->ramin_grctx->gpuobj, idoffs, 416 nv_wo32(dev, chan->ramin_grctx->gpuobj, idoffs,
417 (chan->id << 24) | 0x1); /* CTX_USER */ 417 (chan->id << 24) | 0x1); /* CTX_USER */
418 418
419 nv_wo32(dev, dev_priv->ctx_table->gpuobj, chan->id, 419 nv_wo32(dev, pgraph->ctx_table->gpuobj, chan->id,
420 chan->ramin_grctx->instance >> 4); 420 chan->ramin_grctx->instance >> 4);
421 return 0; 421 return 0;
422} 422}
423 423
@@ -426,11 +426,12 @@ nv20_graph_destroy_context(struct nouveau_channel *chan)
426{ 426{
427 struct drm_device *dev = chan->dev; 427 struct drm_device *dev = chan->dev;
428 struct drm_nouveau_private *dev_priv = dev->dev_private; 428 struct drm_nouveau_private *dev_priv = dev->dev_private;
429 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
429 430
430 if (chan->ramin_grctx) 431 if (chan->ramin_grctx)
431 nouveau_gpuobj_ref_del(dev, &chan->ramin_grctx); 432 nouveau_gpuobj_ref_del(dev, &chan->ramin_grctx);
432 433
433 nv_wo32(dev, dev_priv->ctx_table->gpuobj, chan->id, 0); 434 nv_wo32(dev, pgraph->ctx_table->gpuobj, chan->id, 0);
434} 435}
435 436
436int 437int
@@ -522,8 +523,7 @@ nv20_graph_set_region_tiling(struct drm_device *dev, int i, uint32_t addr,
522int 523int
523nv20_graph_init(struct drm_device *dev) 524nv20_graph_init(struct drm_device *dev)
524{ 525{
525 struct drm_nouveau_private *dev_priv = 526 struct drm_nouveau_private *dev_priv = dev->dev_private;
526 (struct drm_nouveau_private *)dev->dev_private;
527 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; 527 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
528 uint32_t tmp, vramsz; 528 uint32_t tmp, vramsz;
529 int ret, i; 529 int ret, i;
@@ -550,19 +550,17 @@ nv20_graph_init(struct drm_device *dev)
550 nv_wr32(dev, NV03_PMC_ENABLE, 550 nv_wr32(dev, NV03_PMC_ENABLE,
551 nv_rd32(dev, NV03_PMC_ENABLE) | NV_PMC_ENABLE_PGRAPH); 551 nv_rd32(dev, NV03_PMC_ENABLE) | NV_PMC_ENABLE_PGRAPH);
552 552
553 if (!dev_priv->ctx_table) { 553 if (!pgraph->ctx_table) {
554 /* Create Context Pointer Table */ 554 /* Create Context Pointer Table */
555 dev_priv->ctx_table_size = 32 * 4; 555 ret = nouveau_gpuobj_new_ref(dev, NULL, NULL, 0, 32 * 4, 16,
556 ret = nouveau_gpuobj_new_ref(dev, NULL, NULL, 0,
557 dev_priv->ctx_table_size, 16,
558 NVOBJ_FLAG_ZERO_ALLOC, 556 NVOBJ_FLAG_ZERO_ALLOC,
559 &dev_priv->ctx_table); 557 &pgraph->ctx_table);
560 if (ret) 558 if (ret)
561 return ret; 559 return ret;
562 } 560 }
563 561
564 nv_wr32(dev, NV20_PGRAPH_CHANNEL_CTX_TABLE, 562 nv_wr32(dev, NV20_PGRAPH_CHANNEL_CTX_TABLE,
565 dev_priv->ctx_table->instance >> 4); 563 pgraph->ctx_table->instance >> 4);
566 564
567 nv20_graph_rdi(dev); 565 nv20_graph_rdi(dev);
568 566
@@ -646,8 +644,9 @@ void
646nv20_graph_takedown(struct drm_device *dev) 644nv20_graph_takedown(struct drm_device *dev)
647{ 645{
648 struct drm_nouveau_private *dev_priv = dev->dev_private; 646 struct drm_nouveau_private *dev_priv = dev->dev_private;
647 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
649 648
650 nouveau_gpuobj_ref_del(dev, &dev_priv->ctx_table); 649 nouveau_gpuobj_ref_del(dev, &pgraph->ctx_table);
651} 650}
652 651
653int 652int
@@ -680,19 +679,17 @@ nv30_graph_init(struct drm_device *dev)
680 nv_wr32(dev, NV03_PMC_ENABLE, 679 nv_wr32(dev, NV03_PMC_ENABLE,
681 nv_rd32(dev, NV03_PMC_ENABLE) | NV_PMC_ENABLE_PGRAPH); 680 nv_rd32(dev, NV03_PMC_ENABLE) | NV_PMC_ENABLE_PGRAPH);
682 681
683 if (!dev_priv->ctx_table) { 682 if (!pgraph->ctx_table) {
684 /* Create Context Pointer Table */ 683 /* Create Context Pointer Table */
685 dev_priv->ctx_table_size = 32 * 4; 684 ret = nouveau_gpuobj_new_ref(dev, NULL, NULL, 0, 32 * 4, 16,
686 ret = nouveau_gpuobj_new_ref(dev, NULL, NULL, 0,
687 dev_priv->ctx_table_size, 16,
688 NVOBJ_FLAG_ZERO_ALLOC, 685 NVOBJ_FLAG_ZERO_ALLOC,
689 &dev_priv->ctx_table); 686 &pgraph->ctx_table);
690 if (ret) 687 if (ret)
691 return ret; 688 return ret;
692 } 689 }
693 690
694 nv_wr32(dev, NV20_PGRAPH_CHANNEL_CTX_TABLE, 691 nv_wr32(dev, NV20_PGRAPH_CHANNEL_CTX_TABLE,
695 dev_priv->ctx_table->instance >> 4); 692 pgraph->ctx_table->instance >> 4);
696 693
697 nv_wr32(dev, NV03_PGRAPH_INTR , 0xFFFFFFFF); 694 nv_wr32(dev, NV03_PGRAPH_INTR , 0xFFFFFFFF);
698 nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0xFFFFFFFF); 695 nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0xFFFFFFFF);