diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-01-03 21:41:37 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-01-06 23:03:58 -0500 |
commit | e457acaed4c56a6831b82365e17e8f42f1ee129c (patch) | |
tree | fe1d6ab6e926e118ad7dbdce56fa7a79671962c3 | |
parent | eeb9cc015f91ff08453040dd5b2fde0dbaac90d3 (diff) |
drm/nouveau: create grctx on the fly on all chipsets
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_channel.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_object.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv40_fifo.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv40_graph.c | 12 |
4 files changed, 14 insertions, 12 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_channel.c b/drivers/gpu/drm/nouveau/nouveau_channel.c index a57a1d2f3a11..3960d66d7aba 100644 --- a/drivers/gpu/drm/nouveau/nouveau_channel.c +++ b/drivers/gpu/drm/nouveau/nouveau_channel.c | |||
@@ -121,7 +121,6 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret, | |||
121 | uint32_t vram_handle, uint32_t gart_handle) | 121 | uint32_t vram_handle, uint32_t gart_handle) |
122 | { | 122 | { |
123 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 123 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
124 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
125 | struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; | 124 | struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; |
126 | struct nouveau_channel *chan; | 125 | struct nouveau_channel *chan; |
127 | unsigned long flags; | 126 | unsigned long flags; |
@@ -202,15 +201,6 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret, | |||
202 | /* disable the fifo caches */ | 201 | /* disable the fifo caches */ |
203 | pfifo->reassign(dev, false); | 202 | pfifo->reassign(dev, false); |
204 | 203 | ||
205 | /* Create a graphics context for new channel */ | ||
206 | if (dev_priv->card_type < NV_50) { | ||
207 | ret = pgraph->create_context(chan); | ||
208 | if (ret) { | ||
209 | nouveau_channel_put(&chan); | ||
210 | return ret; | ||
211 | } | ||
212 | } | ||
213 | |||
214 | /* Construct inital RAMFC for new channel */ | 204 | /* Construct inital RAMFC for new channel */ |
215 | ret = pfifo->create_context(chan); | 205 | ret = pfifo->create_context(chan); |
216 | if (ret) { | 206 | if (ret) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index d77b1fcd19d4..30b6544467ca 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
@@ -651,7 +651,8 @@ found: | |||
651 | } | 651 | } |
652 | break; | 652 | break; |
653 | case NVOBJ_ENGINE_GR: | 653 | case NVOBJ_ENGINE_GR: |
654 | if (dev_priv->card_type >= NV_50 && !chan->ramin_grctx) { | 654 | if ((dev_priv->card_type >= NV_20 && !chan->ramin_grctx) || |
655 | (dev_priv->card_type < NV_20 && !chan->pgraph_ctx)) { | ||
655 | struct nouveau_pgraph_engine *pgraph = | 656 | struct nouveau_pgraph_engine *pgraph = |
656 | &dev_priv->engine.graph; | 657 | &dev_priv->engine.graph; |
657 | 658 | ||
diff --git a/drivers/gpu/drm/nouveau/nv40_fifo.c b/drivers/gpu/drm/nouveau/nv40_fifo.c index c86e4d4e9b96..49b9a35a9cd6 100644 --- a/drivers/gpu/drm/nouveau/nv40_fifo.c +++ b/drivers/gpu/drm/nouveau/nv40_fifo.c | |||
@@ -64,7 +64,6 @@ nv40_fifo_create_context(struct nouveau_channel *chan) | |||
64 | NV_PFIFO_CACHE1_BIG_ENDIAN | | 64 | NV_PFIFO_CACHE1_BIG_ENDIAN | |
65 | #endif | 65 | #endif |
66 | 0x30000000 /* no idea.. */); | 66 | 0x30000000 /* no idea.. */); |
67 | nv_wi32(dev, fc + 56, chan->ramin_grctx->pinst >> 4); | ||
68 | nv_wi32(dev, fc + 60, 0x0001FFFF); | 67 | nv_wi32(dev, fc + 60, 0x0001FFFF); |
69 | 68 | ||
70 | /* enable the fifo dma operation */ | 69 | /* enable the fifo dma operation */ |
diff --git a/drivers/gpu/drm/nouveau/nv40_graph.c b/drivers/gpu/drm/nouveau/nv40_graph.c index 0618846a97ce..19ef92a0375a 100644 --- a/drivers/gpu/drm/nouveau/nv40_graph.c +++ b/drivers/gpu/drm/nouveau/nv40_graph.c | |||
@@ -62,6 +62,7 @@ nv40_graph_create_context(struct nouveau_channel *chan) | |||
62 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 62 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
63 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | 63 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; |
64 | struct nouveau_grctx ctx = {}; | 64 | struct nouveau_grctx ctx = {}; |
65 | unsigned long flags; | ||
65 | int ret; | 66 | int ret; |
66 | 67 | ||
67 | ret = nouveau_gpuobj_new(dev, chan, pgraph->grctx_size, 16, | 68 | ret = nouveau_gpuobj_new(dev, chan, pgraph->grctx_size, 16, |
@@ -76,6 +77,17 @@ nv40_graph_create_context(struct nouveau_channel *chan) | |||
76 | nv40_grctx_init(&ctx); | 77 | nv40_grctx_init(&ctx); |
77 | 78 | ||
78 | nv_wo32(chan->ramin_grctx, 0, chan->ramin_grctx->pinst); | 79 | nv_wo32(chan->ramin_grctx, 0, chan->ramin_grctx->pinst); |
80 | |||
81 | /* init grctx pointer in ramfc, and on PFIFO if channel is | ||
82 | * already active there | ||
83 | */ | ||
84 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); | ||
85 | nv_wo32(chan->ramfc, 0x38, chan->ramin_grctx->pinst >> 4); | ||
86 | nv_mask(dev, 0x002500, 0x00000001, 0x00000000); | ||
87 | if ((nv_rd32(dev, 0x003204) & 0x0000001f) == chan->id) | ||
88 | nv_wr32(dev, 0x0032e0, chan->ramin_grctx->pinst >> 4); | ||
89 | nv_mask(dev, 0x002500, 0x00000001, 0x00000001); | ||
90 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); | ||
79 | return 0; | 91 | return 0; |
80 | } | 92 | } |
81 | 93 | ||