diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-04-30 20:14:07 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-05-24 02:56:00 -0400 |
commit | 67b342efc761046a22b73c327837479b58613a41 (patch) | |
tree | 86a7d34699e48b855a8a99d8aaab3465cd2f8cd3 | |
parent | 906c033e276877c1374c9159976b05746af3c86d (diff) |
drm/nouveau/fifo: remove all the "special" engine hooks
All the places this stuff is actually needed tends to be chipset-specific
anyway, so we're able to just inline the register bashing instead.
The parts of the common code that still directly touch PFIFO temporarily
have conditionals, these will be removed in subsequent commits that will
refactor the fifo modules into engine modules like graph/mpeg etc.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_channel.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 21 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_mem.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 41 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv04_fifo.c | 60 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv04_graph.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv10_fifo.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv40_fifo.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_fifo.c | 28 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_graph.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvc0_fifo.c | 28 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nve0_fifo.c | 6 |
13 files changed, 62 insertions, 187 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_channel.c b/drivers/gpu/drm/nouveau/nouveau_channel.c index 5762547ed8af..9f4a5c5d5903 100644 --- a/drivers/gpu/drm/nouveau/nouveau_channel.c +++ b/drivers/gpu/drm/nouveau/nouveau_channel.c | |||
@@ -190,7 +190,8 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret, | |||
190 | chan->user_get_hi = 0x60; | 190 | chan->user_get_hi = 0x60; |
191 | 191 | ||
192 | /* disable the fifo caches */ | 192 | /* disable the fifo caches */ |
193 | pfifo->reassign(dev, false); | 193 | if (dev_priv->card_type < NV_C0) |
194 | nv_wr32(dev, NV03_PFIFO_CACHES, 0); | ||
194 | 195 | ||
195 | /* Construct initial RAMFC for new channel */ | 196 | /* Construct initial RAMFC for new channel */ |
196 | ret = pfifo->create_context(chan); | 197 | ret = pfifo->create_context(chan); |
@@ -199,7 +200,8 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret, | |||
199 | return ret; | 200 | return ret; |
200 | } | 201 | } |
201 | 202 | ||
202 | pfifo->reassign(dev, true); | 203 | if (dev_priv->card_type < NV_C0) |
204 | nv_wr32(dev, NV03_PFIFO_CACHES, 1); | ||
203 | 205 | ||
204 | /* Insert NOPs for NOUVEAU_DMA_SKIPS */ | 206 | /* Insert NOPs for NOUVEAU_DMA_SKIPS */ |
205 | ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS); | 207 | ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS); |
@@ -304,7 +306,8 @@ nouveau_channel_put_unlocked(struct nouveau_channel **pchan) | |||
304 | nouveau_channel_idle(chan); | 306 | nouveau_channel_idle(chan); |
305 | 307 | ||
306 | /* boot it off the hardware */ | 308 | /* boot it off the hardware */ |
307 | pfifo->reassign(dev, false); | 309 | if (dev_priv->card_type < NV_C0) |
310 | nv_wr32(dev, NV03_PFIFO_CACHES, 0); | ||
308 | 311 | ||
309 | /* destroy the engine specific contexts */ | 312 | /* destroy the engine specific contexts */ |
310 | for (i = NVOBJ_ENGINE_NR - 1; i >= 0; i--) { | 313 | for (i = NVOBJ_ENGINE_NR - 1; i >= 0; i--) { |
@@ -315,7 +318,8 @@ nouveau_channel_put_unlocked(struct nouveau_channel **pchan) | |||
315 | pfifo->destroy_context(chan); | 318 | pfifo->destroy_context(chan); |
316 | } | 319 | } |
317 | 320 | ||
318 | pfifo->reassign(dev, true); | 321 | if (dev_priv->card_type < NV_C0) |
322 | nv_wr32(dev, NV03_PFIFO_CACHES, 1); | ||
319 | 323 | ||
320 | /* aside from its resources, the channel should now be dead, | 324 | /* aside from its resources, the channel should now be dead, |
321 | * remove it from the channel list | 325 | * remove it from the channel list |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index b394ecf787f6..adc6502d296c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c | |||
@@ -221,8 +221,12 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state) | |||
221 | nouveau_channel_idle(chan); | 221 | nouveau_channel_idle(chan); |
222 | } | 222 | } |
223 | 223 | ||
224 | pfifo->reassign(dev, false); | 224 | if (dev_priv->card_type < NV_C0) { |
225 | pfifo->disable(dev); | 225 | nv_wr32(dev, NV03_PFIFO_CACHES, 0); |
226 | nv_mask(dev, NV04_PFIFO_CACHE1_DMA_PUSH, 0x00000001, 0); | ||
227 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 0); | ||
228 | nv_mask(dev, NV04_PFIFO_CACHE1_PULL0, 0x00000001, 0); | ||
229 | } | ||
226 | pfifo->unload_context(dev); | 230 | pfifo->unload_context(dev); |
227 | 231 | ||
228 | for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) { | 232 | for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) { |
@@ -265,8 +269,11 @@ out_abort: | |||
265 | if (dev_priv->eng[e]) | 269 | if (dev_priv->eng[e]) |
266 | dev_priv->eng[e]->init(dev, e); | 270 | dev_priv->eng[e]->init(dev, e); |
267 | } | 271 | } |
268 | pfifo->enable(dev); | 272 | if (dev_priv->card_type < NV_C0) { |
269 | pfifo->reassign(dev, true); | 273 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 1); |
274 | nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, 1); | ||
275 | nv_wr32(dev, NV03_PFIFO_CACHES, 1); | ||
276 | } | ||
270 | return ret; | 277 | return ret; |
271 | } | 278 | } |
272 | 279 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 79eecf53ef2a..9943ccf764ce 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -357,13 +357,6 @@ struct nouveau_fifo_engine { | |||
357 | int (*init)(struct drm_device *); | 357 | int (*init)(struct drm_device *); |
358 | void (*takedown)(struct drm_device *); | 358 | void (*takedown)(struct drm_device *); |
359 | 359 | ||
360 | void (*disable)(struct drm_device *); | ||
361 | void (*enable)(struct drm_device *); | ||
362 | bool (*reassign)(struct drm_device *, bool enable); | ||
363 | bool (*cache_pull)(struct drm_device *dev, bool enable); | ||
364 | |||
365 | int (*channel_id)(struct drm_device *); | ||
366 | |||
367 | int (*create_context)(struct nouveau_channel *); | 360 | int (*create_context)(struct nouveau_channel *); |
368 | void (*destroy_context)(struct nouveau_channel *); | 361 | void (*destroy_context)(struct nouveau_channel *); |
369 | int (*load_context)(struct nouveau_channel *); | 362 | int (*load_context)(struct nouveau_channel *); |
@@ -1193,20 +1186,15 @@ extern void nvc0_fb_takedown(struct drm_device *); | |||
1193 | /* nv04_fifo.c */ | 1186 | /* nv04_fifo.c */ |
1194 | extern int nv04_fifo_init(struct drm_device *); | 1187 | extern int nv04_fifo_init(struct drm_device *); |
1195 | extern void nv04_fifo_fini(struct drm_device *); | 1188 | extern void nv04_fifo_fini(struct drm_device *); |
1196 | extern void nv04_fifo_disable(struct drm_device *); | ||
1197 | extern void nv04_fifo_enable(struct drm_device *); | ||
1198 | extern bool nv04_fifo_reassign(struct drm_device *, bool); | ||
1199 | extern bool nv04_fifo_cache_pull(struct drm_device *, bool); | ||
1200 | extern int nv04_fifo_channel_id(struct drm_device *); | ||
1201 | extern int nv04_fifo_create_context(struct nouveau_channel *); | 1189 | extern int nv04_fifo_create_context(struct nouveau_channel *); |
1202 | extern void nv04_fifo_destroy_context(struct nouveau_channel *); | 1190 | extern void nv04_fifo_destroy_context(struct nouveau_channel *); |
1203 | extern int nv04_fifo_load_context(struct nouveau_channel *); | 1191 | extern int nv04_fifo_load_context(struct nouveau_channel *); |
1204 | extern int nv04_fifo_unload_context(struct drm_device *); | 1192 | extern int nv04_fifo_unload_context(struct drm_device *); |
1205 | extern void nv04_fifo_isr(struct drm_device *); | 1193 | extern void nv04_fifo_isr(struct drm_device *); |
1194 | bool nv04_fifo_cache_pull(struct drm_device *, bool enable); | ||
1206 | 1195 | ||
1207 | /* nv10_fifo.c */ | 1196 | /* nv10_fifo.c */ |
1208 | extern int nv10_fifo_init(struct drm_device *); | 1197 | extern int nv10_fifo_init(struct drm_device *); |
1209 | extern int nv10_fifo_channel_id(struct drm_device *); | ||
1210 | extern int nv10_fifo_create_context(struct nouveau_channel *); | 1198 | extern int nv10_fifo_create_context(struct nouveau_channel *); |
1211 | extern int nv10_fifo_load_context(struct nouveau_channel *); | 1199 | extern int nv10_fifo_load_context(struct nouveau_channel *); |
1212 | extern int nv10_fifo_unload_context(struct drm_device *); | 1200 | extern int nv10_fifo_unload_context(struct drm_device *); |
@@ -1220,7 +1208,6 @@ extern int nv40_fifo_unload_context(struct drm_device *); | |||
1220 | /* nv50_fifo.c */ | 1208 | /* nv50_fifo.c */ |
1221 | extern int nv50_fifo_init(struct drm_device *); | 1209 | extern int nv50_fifo_init(struct drm_device *); |
1222 | extern void nv50_fifo_takedown(struct drm_device *); | 1210 | extern void nv50_fifo_takedown(struct drm_device *); |
1223 | extern int nv50_fifo_channel_id(struct drm_device *); | ||
1224 | extern int nv50_fifo_create_context(struct nouveau_channel *); | 1211 | extern int nv50_fifo_create_context(struct nouveau_channel *); |
1225 | extern void nv50_fifo_destroy_context(struct nouveau_channel *); | 1212 | extern void nv50_fifo_destroy_context(struct nouveau_channel *); |
1226 | extern int nv50_fifo_load_context(struct nouveau_channel *); | 1213 | extern int nv50_fifo_load_context(struct nouveau_channel *); |
@@ -1230,11 +1217,6 @@ extern void nv50_fifo_tlb_flush(struct drm_device *dev); | |||
1230 | /* nvc0_fifo.c */ | 1217 | /* nvc0_fifo.c */ |
1231 | extern int nvc0_fifo_init(struct drm_device *); | 1218 | extern int nvc0_fifo_init(struct drm_device *); |
1232 | extern void nvc0_fifo_takedown(struct drm_device *); | 1219 | extern void nvc0_fifo_takedown(struct drm_device *); |
1233 | extern void nvc0_fifo_disable(struct drm_device *); | ||
1234 | extern void nvc0_fifo_enable(struct drm_device *); | ||
1235 | extern bool nvc0_fifo_reassign(struct drm_device *, bool); | ||
1236 | extern bool nvc0_fifo_cache_pull(struct drm_device *, bool); | ||
1237 | extern int nvc0_fifo_channel_id(struct drm_device *); | ||
1238 | extern int nvc0_fifo_create_context(struct nouveau_channel *); | 1220 | extern int nvc0_fifo_create_context(struct nouveau_channel *); |
1239 | extern void nvc0_fifo_destroy_context(struct nouveau_channel *); | 1221 | extern void nvc0_fifo_destroy_context(struct nouveau_channel *); |
1240 | extern int nvc0_fifo_load_context(struct nouveau_channel *); | 1222 | extern int nvc0_fifo_load_context(struct nouveau_channel *); |
@@ -1243,7 +1225,6 @@ extern int nvc0_fifo_unload_context(struct drm_device *); | |||
1243 | /* nve0_fifo.c */ | 1225 | /* nve0_fifo.c */ |
1244 | extern int nve0_fifo_init(struct drm_device *); | 1226 | extern int nve0_fifo_init(struct drm_device *); |
1245 | extern void nve0_fifo_takedown(struct drm_device *); | 1227 | extern void nve0_fifo_takedown(struct drm_device *); |
1246 | extern int nve0_fifo_channel_id(struct drm_device *); | ||
1247 | extern int nve0_fifo_create_context(struct nouveau_channel *); | 1228 | extern int nve0_fifo_create_context(struct nouveau_channel *); |
1248 | extern void nve0_fifo_destroy_context(struct nouveau_channel *); | 1229 | extern void nve0_fifo_destroy_context(struct nouveau_channel *); |
1249 | extern int nve0_fifo_unload_context(struct drm_device *); | 1230 | extern int nve0_fifo_unload_context(struct drm_device *); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index 193521251773..fd7273459ad6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -51,7 +51,6 @@ nv10_mem_update_tile_region(struct drm_device *dev, | |||
51 | uint32_t size, uint32_t pitch, uint32_t flags) | 51 | uint32_t size, uint32_t pitch, uint32_t flags) |
52 | { | 52 | { |
53 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 53 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
54 | struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; | ||
55 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; | 54 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; |
56 | int i = tile - dev_priv->tile.reg, j; | 55 | int i = tile - dev_priv->tile.reg, j; |
57 | unsigned long save; | 56 | unsigned long save; |
@@ -65,8 +64,8 @@ nv10_mem_update_tile_region(struct drm_device *dev, | |||
65 | pfb->init_tile_region(dev, i, addr, size, pitch, flags); | 64 | pfb->init_tile_region(dev, i, addr, size, pitch, flags); |
66 | 65 | ||
67 | spin_lock_irqsave(&dev_priv->context_switch_lock, save); | 66 | spin_lock_irqsave(&dev_priv->context_switch_lock, save); |
68 | pfifo->reassign(dev, false); | 67 | nv_wr32(dev, NV03_PFIFO_CACHES, 0); |
69 | pfifo->cache_pull(dev, false); | 68 | nv04_fifo_cache_pull(dev, false); |
70 | 69 | ||
71 | nouveau_wait_for_idle(dev); | 70 | nouveau_wait_for_idle(dev); |
72 | 71 | ||
@@ -76,8 +75,8 @@ nv10_mem_update_tile_region(struct drm_device *dev, | |||
76 | dev_priv->eng[j]->set_tile_region(dev, i); | 75 | dev_priv->eng[j]->set_tile_region(dev, i); |
77 | } | 76 | } |
78 | 77 | ||
79 | pfifo->cache_pull(dev, true); | 78 | nv04_fifo_cache_pull(dev, true); |
80 | pfifo->reassign(dev, true); | 79 | nv_wr32(dev, NV03_PFIFO_CACHES, 1); |
81 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, save); | 80 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, save); |
82 | } | 81 | } |
83 | 82 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 1039e57d0aef..660a033b6ddf 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -71,11 +71,6 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
71 | engine->fifo.channels = 16; | 71 | engine->fifo.channels = 16; |
72 | engine->fifo.init = nv04_fifo_init; | 72 | engine->fifo.init = nv04_fifo_init; |
73 | engine->fifo.takedown = nv04_fifo_fini; | 73 | engine->fifo.takedown = nv04_fifo_fini; |
74 | engine->fifo.disable = nv04_fifo_disable; | ||
75 | engine->fifo.enable = nv04_fifo_enable; | ||
76 | engine->fifo.reassign = nv04_fifo_reassign; | ||
77 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
78 | engine->fifo.channel_id = nv04_fifo_channel_id; | ||
79 | engine->fifo.create_context = nv04_fifo_create_context; | 74 | engine->fifo.create_context = nv04_fifo_create_context; |
80 | engine->fifo.destroy_context = nv04_fifo_destroy_context; | 75 | engine->fifo.destroy_context = nv04_fifo_destroy_context; |
81 | engine->fifo.load_context = nv04_fifo_load_context; | 76 | engine->fifo.load_context = nv04_fifo_load_context; |
@@ -116,11 +111,6 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
116 | engine->fifo.channels = 32; | 111 | engine->fifo.channels = 32; |
117 | engine->fifo.init = nv10_fifo_init; | 112 | engine->fifo.init = nv10_fifo_init; |
118 | engine->fifo.takedown = nv04_fifo_fini; | 113 | engine->fifo.takedown = nv04_fifo_fini; |
119 | engine->fifo.disable = nv04_fifo_disable; | ||
120 | engine->fifo.enable = nv04_fifo_enable; | ||
121 | engine->fifo.reassign = nv04_fifo_reassign; | ||
122 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
123 | engine->fifo.channel_id = nv10_fifo_channel_id; | ||
124 | engine->fifo.create_context = nv10_fifo_create_context; | 114 | engine->fifo.create_context = nv10_fifo_create_context; |
125 | engine->fifo.destroy_context = nv04_fifo_destroy_context; | 115 | engine->fifo.destroy_context = nv04_fifo_destroy_context; |
126 | engine->fifo.load_context = nv10_fifo_load_context; | 116 | engine->fifo.load_context = nv10_fifo_load_context; |
@@ -167,11 +157,6 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
167 | engine->fifo.channels = 32; | 157 | engine->fifo.channels = 32; |
168 | engine->fifo.init = nv10_fifo_init; | 158 | engine->fifo.init = nv10_fifo_init; |
169 | engine->fifo.takedown = nv04_fifo_fini; | 159 | engine->fifo.takedown = nv04_fifo_fini; |
170 | engine->fifo.disable = nv04_fifo_disable; | ||
171 | engine->fifo.enable = nv04_fifo_enable; | ||
172 | engine->fifo.reassign = nv04_fifo_reassign; | ||
173 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
174 | engine->fifo.channel_id = nv10_fifo_channel_id; | ||
175 | engine->fifo.create_context = nv10_fifo_create_context; | 160 | engine->fifo.create_context = nv10_fifo_create_context; |
176 | engine->fifo.destroy_context = nv04_fifo_destroy_context; | 161 | engine->fifo.destroy_context = nv04_fifo_destroy_context; |
177 | engine->fifo.load_context = nv10_fifo_load_context; | 162 | engine->fifo.load_context = nv10_fifo_load_context; |
@@ -214,11 +199,6 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
214 | engine->fifo.channels = 32; | 199 | engine->fifo.channels = 32; |
215 | engine->fifo.init = nv10_fifo_init; | 200 | engine->fifo.init = nv10_fifo_init; |
216 | engine->fifo.takedown = nv04_fifo_fini; | 201 | engine->fifo.takedown = nv04_fifo_fini; |
217 | engine->fifo.disable = nv04_fifo_disable; | ||
218 | engine->fifo.enable = nv04_fifo_enable; | ||
219 | engine->fifo.reassign = nv04_fifo_reassign; | ||
220 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
221 | engine->fifo.channel_id = nv10_fifo_channel_id; | ||
222 | engine->fifo.create_context = nv10_fifo_create_context; | 202 | engine->fifo.create_context = nv10_fifo_create_context; |
223 | engine->fifo.destroy_context = nv04_fifo_destroy_context; | 203 | engine->fifo.destroy_context = nv04_fifo_destroy_context; |
224 | engine->fifo.load_context = nv10_fifo_load_context; | 204 | engine->fifo.load_context = nv10_fifo_load_context; |
@@ -264,11 +244,6 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
264 | engine->fifo.channels = 32; | 244 | engine->fifo.channels = 32; |
265 | engine->fifo.init = nv40_fifo_init; | 245 | engine->fifo.init = nv40_fifo_init; |
266 | engine->fifo.takedown = nv04_fifo_fini; | 246 | engine->fifo.takedown = nv04_fifo_fini; |
267 | engine->fifo.disable = nv04_fifo_disable; | ||
268 | engine->fifo.enable = nv04_fifo_enable; | ||
269 | engine->fifo.reassign = nv04_fifo_reassign; | ||
270 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
271 | engine->fifo.channel_id = nv10_fifo_channel_id; | ||
272 | engine->fifo.create_context = nv40_fifo_create_context; | 247 | engine->fifo.create_context = nv40_fifo_create_context; |
273 | engine->fifo.destroy_context = nv04_fifo_destroy_context; | 248 | engine->fifo.destroy_context = nv04_fifo_destroy_context; |
274 | engine->fifo.load_context = nv40_fifo_load_context; | 249 | engine->fifo.load_context = nv40_fifo_load_context; |
@@ -322,10 +297,6 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
322 | engine->fifo.channels = 128; | 297 | engine->fifo.channels = 128; |
323 | engine->fifo.init = nv50_fifo_init; | 298 | engine->fifo.init = nv50_fifo_init; |
324 | engine->fifo.takedown = nv50_fifo_takedown; | 299 | engine->fifo.takedown = nv50_fifo_takedown; |
325 | engine->fifo.disable = nv04_fifo_disable; | ||
326 | engine->fifo.enable = nv04_fifo_enable; | ||
327 | engine->fifo.reassign = nv04_fifo_reassign; | ||
328 | engine->fifo.channel_id = nv50_fifo_channel_id; | ||
329 | engine->fifo.create_context = nv50_fifo_create_context; | 300 | engine->fifo.create_context = nv50_fifo_create_context; |
330 | engine->fifo.destroy_context = nv50_fifo_destroy_context; | 301 | engine->fifo.destroy_context = nv50_fifo_destroy_context; |
331 | engine->fifo.load_context = nv50_fifo_load_context; | 302 | engine->fifo.load_context = nv50_fifo_load_context; |
@@ -397,10 +368,6 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
397 | engine->fifo.channels = 128; | 368 | engine->fifo.channels = 128; |
398 | engine->fifo.init = nvc0_fifo_init; | 369 | engine->fifo.init = nvc0_fifo_init; |
399 | engine->fifo.takedown = nvc0_fifo_takedown; | 370 | engine->fifo.takedown = nvc0_fifo_takedown; |
400 | engine->fifo.disable = nvc0_fifo_disable; | ||
401 | engine->fifo.enable = nvc0_fifo_enable; | ||
402 | engine->fifo.reassign = nvc0_fifo_reassign; | ||
403 | engine->fifo.channel_id = nvc0_fifo_channel_id; | ||
404 | engine->fifo.create_context = nvc0_fifo_create_context; | 371 | engine->fifo.create_context = nvc0_fifo_create_context; |
405 | engine->fifo.destroy_context = nvc0_fifo_destroy_context; | 372 | engine->fifo.destroy_context = nvc0_fifo_destroy_context; |
406 | engine->fifo.load_context = nvc0_fifo_load_context; | 373 | engine->fifo.load_context = nvc0_fifo_load_context; |
@@ -450,10 +417,6 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
450 | engine->fifo.channels = 128; | 417 | engine->fifo.channels = 128; |
451 | engine->fifo.init = nvc0_fifo_init; | 418 | engine->fifo.init = nvc0_fifo_init; |
452 | engine->fifo.takedown = nvc0_fifo_takedown; | 419 | engine->fifo.takedown = nvc0_fifo_takedown; |
453 | engine->fifo.disable = nvc0_fifo_disable; | ||
454 | engine->fifo.enable = nvc0_fifo_enable; | ||
455 | engine->fifo.reassign = nvc0_fifo_reassign; | ||
456 | engine->fifo.channel_id = nvc0_fifo_channel_id; | ||
457 | engine->fifo.create_context = nvc0_fifo_create_context; | 420 | engine->fifo.create_context = nvc0_fifo_create_context; |
458 | engine->fifo.destroy_context = nvc0_fifo_destroy_context; | 421 | engine->fifo.destroy_context = nvc0_fifo_destroy_context; |
459 | engine->fifo.load_context = nvc0_fifo_load_context; | 422 | engine->fifo.load_context = nvc0_fifo_load_context; |
@@ -501,10 +464,6 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
501 | engine->fifo.channels = 4096; | 464 | engine->fifo.channels = 4096; |
502 | engine->fifo.init = nve0_fifo_init; | 465 | engine->fifo.init = nve0_fifo_init; |
503 | engine->fifo.takedown = nve0_fifo_takedown; | 466 | engine->fifo.takedown = nve0_fifo_takedown; |
504 | engine->fifo.disable = nvc0_fifo_disable; | ||
505 | engine->fifo.enable = nvc0_fifo_enable; | ||
506 | engine->fifo.reassign = nvc0_fifo_reassign; | ||
507 | engine->fifo.channel_id = nve0_fifo_channel_id; | ||
508 | engine->fifo.create_context = nve0_fifo_create_context; | 467 | engine->fifo.create_context = nve0_fifo_create_context; |
509 | engine->fifo.destroy_context = nve0_fifo_destroy_context; | 468 | engine->fifo.destroy_context = nve0_fifo_destroy_context; |
510 | engine->fifo.load_context = nvc0_fifo_load_context; | 469 | engine->fifo.load_context = nvc0_fifo_load_context; |
diff --git a/drivers/gpu/drm/nouveau/nv04_fifo.c b/drivers/gpu/drm/nouveau/nv04_fifo.c index db465a3ee1b2..584c24d457f0 100644 --- a/drivers/gpu/drm/nouveau/nv04_fifo.c +++ b/drivers/gpu/drm/nouveau/nv04_fifo.c | |||
@@ -43,34 +43,6 @@ | |||
43 | #define RAMFC_WR(offset, val) nv_wo32(chan->ramfc, NV04_RAMFC_##offset, (val)) | 43 | #define RAMFC_WR(offset, val) nv_wo32(chan->ramfc, NV04_RAMFC_##offset, (val)) |
44 | #define RAMFC_RD(offset) nv_ro32(chan->ramfc, NV04_RAMFC_##offset) | 44 | #define RAMFC_RD(offset) nv_ro32(chan->ramfc, NV04_RAMFC_##offset) |
45 | 45 | ||
46 | void | ||
47 | nv04_fifo_disable(struct drm_device *dev) | ||
48 | { | ||
49 | uint32_t tmp; | ||
50 | |||
51 | tmp = nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_PUSH); | ||
52 | nv_wr32(dev, NV04_PFIFO_CACHE1_DMA_PUSH, tmp & ~1); | ||
53 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 0); | ||
54 | tmp = nv_rd32(dev, NV03_PFIFO_CACHE1_PULL1); | ||
55 | nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, tmp & ~1); | ||
56 | } | ||
57 | |||
58 | void | ||
59 | nv04_fifo_enable(struct drm_device *dev) | ||
60 | { | ||
61 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 1); | ||
62 | nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, 1); | ||
63 | } | ||
64 | |||
65 | bool | ||
66 | nv04_fifo_reassign(struct drm_device *dev, bool enable) | ||
67 | { | ||
68 | uint32_t reassign = nv_rd32(dev, NV03_PFIFO_CACHES); | ||
69 | |||
70 | nv_wr32(dev, NV03_PFIFO_CACHES, enable ? 1 : 0); | ||
71 | return (reassign == 1); | ||
72 | } | ||
73 | |||
74 | bool | 46 | bool |
75 | nv04_fifo_cache_pull(struct drm_device *dev, bool enable) | 47 | nv04_fifo_cache_pull(struct drm_device *dev, bool enable) |
76 | { | 48 | { |
@@ -100,13 +72,6 @@ nv04_fifo_cache_pull(struct drm_device *dev, bool enable) | |||
100 | return pull & 1; | 72 | return pull & 1; |
101 | } | 73 | } |
102 | 74 | ||
103 | int | ||
104 | nv04_fifo_channel_id(struct drm_device *dev) | ||
105 | { | ||
106 | return nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1) & | ||
107 | NV03_PFIFO_CACHE1_PUSH1_CHID_MASK; | ||
108 | } | ||
109 | |||
110 | #ifdef __BIG_ENDIAN | 75 | #ifdef __BIG_ENDIAN |
111 | #define DMA_FETCH_ENDIANNESS NV_PFIFO_CACHE1_BIG_ENDIAN | 76 | #define DMA_FETCH_ENDIANNESS NV_PFIFO_CACHE1_BIG_ENDIAN |
112 | #else | 77 | #else |
@@ -162,19 +127,21 @@ nv04_fifo_destroy_context(struct nouveau_channel *chan) | |||
162 | unsigned long flags; | 127 | unsigned long flags; |
163 | 128 | ||
164 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); | 129 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); |
165 | pfifo->reassign(dev, false); | 130 | nv_wr32(dev, NV03_PFIFO_CACHES, 0); |
166 | 131 | ||
167 | /* Unload the context if it's the currently active one */ | 132 | /* Unload the context if it's the currently active one */ |
168 | if (pfifo->channel_id(dev) == chan->id) { | 133 | if ((nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1) & 0xf) == chan->id) { |
169 | pfifo->disable(dev); | 134 | nv_mask(dev, NV04_PFIFO_CACHE1_DMA_PUSH, 0x00000001, 0); |
135 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 0); | ||
136 | nv_mask(dev, NV04_PFIFO_CACHE1_PULL0, 0x00000001, 0); | ||
170 | pfifo->unload_context(dev); | 137 | pfifo->unload_context(dev); |
171 | pfifo->enable(dev); | 138 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 1); |
139 | nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, 1); | ||
172 | } | 140 | } |
173 | 141 | ||
174 | /* Keep it from being rescheduled */ | 142 | /* Keep it from being rescheduled */ |
175 | nv_mask(dev, NV04_PFIFO_MODE, 1 << chan->id, 0); | 143 | nv_mask(dev, NV04_PFIFO_MODE, 1 << chan->id, 0); |
176 | 144 | nv_wr32(dev, NV03_PFIFO_CACHES, 1); | |
177 | pfifo->reassign(dev, true); | ||
178 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); | 145 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); |
179 | 146 | ||
180 | /* Free the channel resources */ | 147 | /* Free the channel resources */ |
@@ -231,7 +198,7 @@ nv04_fifo_unload_context(struct drm_device *dev) | |||
231 | uint32_t tmp; | 198 | uint32_t tmp; |
232 | int chid; | 199 | int chid; |
233 | 200 | ||
234 | chid = pfifo->channel_id(dev); | 201 | chid = nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1) & 0xf; |
235 | if (chid < 0 || chid >= dev_priv->engine.fifo.channels) | 202 | if (chid < 0 || chid >= dev_priv->engine.fifo.channels) |
236 | return 0; | 203 | return 0; |
237 | 204 | ||
@@ -313,8 +280,9 @@ nv04_fifo_init(struct drm_device *dev) | |||
313 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, pfifo->channels - 1); | 280 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, pfifo->channels - 1); |
314 | 281 | ||
315 | nv04_fifo_init_intr(dev); | 282 | nv04_fifo_init_intr(dev); |
316 | pfifo->enable(dev); | 283 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 1); |
317 | pfifo->reassign(dev, true); | 284 | nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, 1); |
285 | nv_wr32(dev, NV03_PFIFO_CACHES, 1); | ||
318 | 286 | ||
319 | for (i = 0; i < dev_priv->engine.fifo.channels; i++) { | 287 | for (i = 0; i < dev_priv->engine.fifo.channels; i++) { |
320 | if (dev_priv->channels.ptr[i]) { | 288 | if (dev_priv->channels.ptr[i]) { |
@@ -392,7 +360,6 @@ void | |||
392 | nv04_fifo_isr(struct drm_device *dev) | 360 | nv04_fifo_isr(struct drm_device *dev) |
393 | { | 361 | { |
394 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 362 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
395 | struct nouveau_engine *engine = &dev_priv->engine; | ||
396 | uint32_t status, reassign; | 363 | uint32_t status, reassign; |
397 | int cnt = 0; | 364 | int cnt = 0; |
398 | 365 | ||
@@ -402,7 +369,8 @@ nv04_fifo_isr(struct drm_device *dev) | |||
402 | 369 | ||
403 | nv_wr32(dev, NV03_PFIFO_CACHES, 0); | 370 | nv_wr32(dev, NV03_PFIFO_CACHES, 0); |
404 | 371 | ||
405 | chid = engine->fifo.channel_id(dev); | 372 | chid = nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1); |
373 | chid &= dev_priv->engine.fifo.channels - 1; | ||
406 | get = nv_rd32(dev, NV03_PFIFO_CACHE1_GET); | 374 | get = nv_rd32(dev, NV03_PFIFO_CACHE1_GET); |
407 | 375 | ||
408 | if (status & NV_PFIFO_INTR_CACHE_ERROR) { | 376 | if (status & NV_PFIFO_INTR_CACHE_ERROR) { |
diff --git a/drivers/gpu/drm/nouveau/nv04_graph.c b/drivers/gpu/drm/nouveau/nv04_graph.c index 442b4df44fad..5b5f3ba85f5c 100644 --- a/drivers/gpu/drm/nouveau/nv04_graph.c +++ b/drivers/gpu/drm/nouveau/nv04_graph.c | |||
@@ -998,7 +998,8 @@ nv04_graph_context_switch(struct drm_device *dev) | |||
998 | nv04_graph_unload_context(dev); | 998 | nv04_graph_unload_context(dev); |
999 | 999 | ||
1000 | /* Load context for next channel */ | 1000 | /* Load context for next channel */ |
1001 | chid = dev_priv->engine.fifo.channel_id(dev); | 1001 | chid = nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1) & |
1002 | NV03_PFIFO_CACHE1_PUSH1_CHID_MASK; | ||
1002 | chan = dev_priv->channels.ptr[chid]; | 1003 | chan = dev_priv->channels.ptr[chid]; |
1003 | if (chan) | 1004 | if (chan) |
1004 | nv04_graph_load_context(chan); | 1005 | nv04_graph_load_context(chan); |
diff --git a/drivers/gpu/drm/nouveau/nv10_fifo.c b/drivers/gpu/drm/nouveau/nv10_fifo.c index d2ecbff4bee1..476451c6f961 100644 --- a/drivers/gpu/drm/nouveau/nv10_fifo.c +++ b/drivers/gpu/drm/nouveau/nv10_fifo.c | |||
@@ -33,13 +33,6 @@ | |||
33 | #define NV10_RAMFC__SIZE ((dev_priv->chipset) >= 0x17 ? 64 : 32) | 33 | #define NV10_RAMFC__SIZE ((dev_priv->chipset) >= 0x17 ? 64 : 32) |
34 | 34 | ||
35 | int | 35 | int |
36 | nv10_fifo_channel_id(struct drm_device *dev) | ||
37 | { | ||
38 | return nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1) & | ||
39 | NV10_PFIFO_CACHE1_PUSH1_CHID_MASK; | ||
40 | } | ||
41 | |||
42 | int | ||
43 | nv10_fifo_create_context(struct nouveau_channel *chan) | 36 | nv10_fifo_create_context(struct nouveau_channel *chan) |
44 | { | 37 | { |
45 | struct drm_nouveau_private *dev_priv = chan->dev->dev_private; | 38 | struct drm_nouveau_private *dev_priv = chan->dev->dev_private; |
@@ -139,7 +132,7 @@ nv10_fifo_unload_context(struct drm_device *dev) | |||
139 | uint32_t fc, tmp; | 132 | uint32_t fc, tmp; |
140 | int chid; | 133 | int chid; |
141 | 134 | ||
142 | chid = pfifo->channel_id(dev); | 135 | chid = nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1) & 0x1f; |
143 | if (chid < 0 || chid >= dev_priv->engine.fifo.channels) | 136 | if (chid < 0 || chid >= dev_priv->engine.fifo.channels) |
144 | return 0; | 137 | return 0; |
145 | fc = NV10_RAMFC(chid); | 138 | fc = NV10_RAMFC(chid); |
@@ -232,8 +225,9 @@ nv10_fifo_init(struct drm_device *dev) | |||
232 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, pfifo->channels - 1); | 225 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, pfifo->channels - 1); |
233 | 226 | ||
234 | nv10_fifo_init_intr(dev); | 227 | nv10_fifo_init_intr(dev); |
235 | pfifo->enable(dev); | 228 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 1); |
236 | pfifo->reassign(dev, true); | 229 | nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, 1); |
230 | nv_wr32(dev, NV03_PFIFO_CACHES, 1); | ||
237 | 231 | ||
238 | for (i = 0; i < dev_priv->engine.fifo.channels; i++) { | 232 | for (i = 0; i < dev_priv->engine.fifo.channels; i++) { |
239 | if (dev_priv->channels.ptr[i]) { | 233 | if (dev_priv->channels.ptr[i]) { |
diff --git a/drivers/gpu/drm/nouveau/nv40_fifo.c b/drivers/gpu/drm/nouveau/nv40_fifo.c index 68cb2d991c88..8d346617f55f 100644 --- a/drivers/gpu/drm/nouveau/nv40_fifo.c +++ b/drivers/gpu/drm/nouveau/nv40_fifo.c | |||
@@ -149,7 +149,7 @@ nv40_fifo_unload_context(struct drm_device *dev) | |||
149 | uint32_t fc, tmp; | 149 | uint32_t fc, tmp; |
150 | int chid; | 150 | int chid; |
151 | 151 | ||
152 | chid = pfifo->channel_id(dev); | 152 | chid = nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1) & 0x1f; |
153 | if (chid < 0 || chid >= dev_priv->engine.fifo.channels) | 153 | if (chid < 0 || chid >= dev_priv->engine.fifo.channels) |
154 | return 0; | 154 | return 0; |
155 | fc = NV40_RAMFC(chid); | 155 | fc = NV40_RAMFC(chid); |
@@ -293,8 +293,9 @@ nv40_fifo_init(struct drm_device *dev) | |||
293 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, pfifo->channels - 1); | 293 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, pfifo->channels - 1); |
294 | 294 | ||
295 | nv40_fifo_init_intr(dev); | 295 | nv40_fifo_init_intr(dev); |
296 | pfifo->enable(dev); | 296 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 1); |
297 | pfifo->reassign(dev, true); | 297 | nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, 1); |
298 | nv_wr32(dev, NV03_PFIFO_CACHES, 1); | ||
298 | 299 | ||
299 | for (i = 0; i < dev_priv->engine.fifo.channels; i++) { | 300 | for (i = 0; i < dev_priv->engine.fifo.channels; i++) { |
300 | if (dev_priv->channels.ptr[i]) { | 301 | if (dev_priv->channels.ptr[i]) { |
diff --git a/drivers/gpu/drm/nouveau/nv50_fifo.c b/drivers/gpu/drm/nouveau/nv50_fifo.c index 3bc2a565c20b..3961c8778780 100644 --- a/drivers/gpu/drm/nouveau/nv50_fifo.c +++ b/drivers/gpu/drm/nouveau/nv50_fifo.c | |||
@@ -193,8 +193,9 @@ just_reset: | |||
193 | nv50_fifo_init_context_table(dev); | 193 | nv50_fifo_init_context_table(dev); |
194 | nv50_fifo_init_regs__nv(dev); | 194 | nv50_fifo_init_regs__nv(dev); |
195 | nv50_fifo_init_regs(dev); | 195 | nv50_fifo_init_regs(dev); |
196 | dev_priv->engine.fifo.enable(dev); | 196 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 1); |
197 | dev_priv->engine.fifo.reassign(dev, true); | 197 | nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, 1); |
198 | nv_wr32(dev, NV03_PFIFO_CACHES, 1); | ||
198 | 199 | ||
199 | return 0; | 200 | return 0; |
200 | } | 201 | } |
@@ -218,13 +219,6 @@ nv50_fifo_takedown(struct drm_device *dev) | |||
218 | } | 219 | } |
219 | 220 | ||
220 | int | 221 | int |
221 | nv50_fifo_channel_id(struct drm_device *dev) | ||
222 | { | ||
223 | return nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1) & | ||
224 | NV50_PFIFO_CACHE1_PUSH1_CHID_MASK; | ||
225 | } | ||
226 | |||
227 | int | ||
228 | nv50_fifo_create_context(struct nouveau_channel *chan) | 222 | nv50_fifo_create_context(struct nouveau_channel *chan) |
229 | { | 223 | { |
230 | struct drm_device *dev = chan->dev; | 224 | struct drm_device *dev = chan->dev; |
@@ -313,13 +307,16 @@ nv50_fifo_destroy_context(struct nouveau_channel *chan) | |||
313 | NV_DEBUG(dev, "ch%d\n", chan->id); | 307 | NV_DEBUG(dev, "ch%d\n", chan->id); |
314 | 308 | ||
315 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); | 309 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); |
316 | pfifo->reassign(dev, false); | 310 | nv_wr32(dev, NV03_PFIFO_CACHES, 0); |
317 | 311 | ||
318 | /* Unload the context if it's the currently active one */ | 312 | /* Unload the context if it's the currently active one */ |
319 | if (pfifo->channel_id(dev) == chan->id) { | 313 | if ((nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1) & 0x7f) == chan->id) { |
320 | pfifo->disable(dev); | 314 | nv_mask(dev, NV04_PFIFO_CACHE1_DMA_PUSH, 0x00000001, 0); |
315 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 0); | ||
316 | nv_mask(dev, NV04_PFIFO_CACHE1_PULL0, 0x00000001, 0); | ||
321 | pfifo->unload_context(dev); | 317 | pfifo->unload_context(dev); |
322 | pfifo->enable(dev); | 318 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 1); |
319 | nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, 1); | ||
323 | } | 320 | } |
324 | 321 | ||
325 | /* This will ensure the channel is seen as disabled. */ | 322 | /* This will ensure the channel is seen as disabled. */ |
@@ -332,7 +329,7 @@ nv50_fifo_destroy_context(struct nouveau_channel *chan) | |||
332 | nv50_fifo_channel_disable(dev, 127); | 329 | nv50_fifo_channel_disable(dev, 127); |
333 | nv50_fifo_playlist_update(dev); | 330 | nv50_fifo_playlist_update(dev); |
334 | 331 | ||
335 | pfifo->reassign(dev, true); | 332 | nv_wr32(dev, NV03_PFIFO_CACHES, 1); |
336 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); | 333 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); |
337 | 334 | ||
338 | /* Free the channel resources */ | 335 | /* Free the channel resources */ |
@@ -416,14 +413,13 @@ int | |||
416 | nv50_fifo_unload_context(struct drm_device *dev) | 413 | nv50_fifo_unload_context(struct drm_device *dev) |
417 | { | 414 | { |
418 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 415 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
419 | struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; | ||
420 | struct nouveau_gpuobj *ramfc, *cache; | 416 | struct nouveau_gpuobj *ramfc, *cache; |
421 | struct nouveau_channel *chan = NULL; | 417 | struct nouveau_channel *chan = NULL; |
422 | int chid, get, put, ptr; | 418 | int chid, get, put, ptr; |
423 | 419 | ||
424 | NV_DEBUG(dev, "\n"); | 420 | NV_DEBUG(dev, "\n"); |
425 | 421 | ||
426 | chid = pfifo->channel_id(dev); | 422 | chid = nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1) & 0x7f; |
427 | if (chid < 1 || chid >= dev_priv->engine.fifo.channels - 1) | 423 | if (chid < 1 || chid >= dev_priv->engine.fifo.channels - 1) |
428 | return 0; | 424 | return 0; |
429 | 425 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c index a46e060eb399..d262e31c2830 100644 --- a/drivers/gpu/drm/nouveau/nv50_graph.c +++ b/drivers/gpu/drm/nouveau/nv50_graph.c | |||
@@ -262,7 +262,6 @@ nv50_graph_context_del(struct nouveau_channel *chan, int engine) | |||
262 | struct nouveau_gpuobj *grctx = chan->engctx[engine]; | 262 | struct nouveau_gpuobj *grctx = chan->engctx[engine]; |
263 | struct drm_device *dev = chan->dev; | 263 | struct drm_device *dev = chan->dev; |
264 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 264 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
265 | struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; | ||
266 | int i, hdr = (dev_priv->chipset == 0x50) ? 0x200 : 0x20; | 265 | int i, hdr = (dev_priv->chipset == 0x50) ? 0x200 : 0x20; |
267 | unsigned long flags; | 266 | unsigned long flags; |
268 | 267 | ||
@@ -272,7 +271,7 @@ nv50_graph_context_del(struct nouveau_channel *chan, int engine) | |||
272 | return; | 271 | return; |
273 | 272 | ||
274 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); | 273 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); |
275 | pfifo->reassign(dev, false); | 274 | nv_wr32(dev, NV03_PFIFO_CACHES, 0); |
276 | nv50_graph_fifo_access(dev, false); | 275 | nv50_graph_fifo_access(dev, false); |
277 | 276 | ||
278 | if (nv50_graph_channel(dev) == chan) | 277 | if (nv50_graph_channel(dev) == chan) |
@@ -283,7 +282,7 @@ nv50_graph_context_del(struct nouveau_channel *chan, int engine) | |||
283 | dev_priv->engine.instmem.flush(dev); | 282 | dev_priv->engine.instmem.flush(dev); |
284 | 283 | ||
285 | nv50_graph_fifo_access(dev, true); | 284 | nv50_graph_fifo_access(dev, true); |
286 | pfifo->reassign(dev, true); | 285 | nv_wr32(dev, NV03_PFIFO_CACHES, 1); |
287 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); | 286 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); |
288 | 287 | ||
289 | nouveau_gpuobj_ref(NULL, &grctx); | 288 | nouveau_gpuobj_ref(NULL, &grctx); |
diff --git a/drivers/gpu/drm/nouveau/nvc0_fifo.c b/drivers/gpu/drm/nouveau/nvc0_fifo.c index f47f39645c3e..471723eaf8ad 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fifo.c +++ b/drivers/gpu/drm/nouveau/nvc0_fifo.c | |||
@@ -69,34 +69,6 @@ nvc0_fifo_playlist_update(struct drm_device *dev) | |||
69 | NV_ERROR(dev, "PFIFO - playlist update failed\n"); | 69 | NV_ERROR(dev, "PFIFO - playlist update failed\n"); |
70 | } | 70 | } |
71 | 71 | ||
72 | void | ||
73 | nvc0_fifo_disable(struct drm_device *dev) | ||
74 | { | ||
75 | } | ||
76 | |||
77 | void | ||
78 | nvc0_fifo_enable(struct drm_device *dev) | ||
79 | { | ||
80 | } | ||
81 | |||
82 | bool | ||
83 | nvc0_fifo_reassign(struct drm_device *dev, bool enable) | ||
84 | { | ||
85 | return false; | ||
86 | } | ||
87 | |||
88 | bool | ||
89 | nvc0_fifo_cache_pull(struct drm_device *dev, bool enable) | ||
90 | { | ||
91 | return false; | ||
92 | } | ||
93 | |||
94 | int | ||
95 | nvc0_fifo_channel_id(struct drm_device *dev) | ||
96 | { | ||
97 | return 127; | ||
98 | } | ||
99 | |||
100 | int | 72 | int |
101 | nvc0_fifo_create_context(struct nouveau_channel *chan) | 73 | nvc0_fifo_create_context(struct nouveau_channel *chan) |
102 | { | 74 | { |
diff --git a/drivers/gpu/drm/nouveau/nve0_fifo.c b/drivers/gpu/drm/nouveau/nve0_fifo.c index 82ad47cdeab9..52c54e0fdcee 100644 --- a/drivers/gpu/drm/nouveau/nve0_fifo.c +++ b/drivers/gpu/drm/nouveau/nve0_fifo.c | |||
@@ -92,12 +92,6 @@ nve0_fifo_playlist_update(struct drm_device *dev, u32 engine) | |||
92 | } | 92 | } |
93 | 93 | ||
94 | int | 94 | int |
95 | nve0_fifo_channel_id(struct drm_device *dev) | ||
96 | { | ||
97 | return 4095; | ||
98 | } | ||
99 | |||
100 | int | ||
101 | nve0_fifo_create_context(struct nouveau_channel *chan) | 95 | nve0_fifo_create_context(struct nouveau_channel *chan) |
102 | { | 96 | { |
103 | struct drm_device *dev = chan->dev; | 97 | struct drm_device *dev = chan->dev; |