diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv50_fifo.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_fifo.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_fifo.c b/drivers/gpu/drm/nouveau/nv50_fifo.c index 815960fe4f4..d3295aae0c4 100644 --- a/drivers/gpu/drm/nouveau/nv50_fifo.c +++ b/drivers/gpu/drm/nouveau/nv50_fifo.c | |||
@@ -292,10 +292,23 @@ void | |||
292 | nv50_fifo_destroy_context(struct nouveau_channel *chan) | 292 | nv50_fifo_destroy_context(struct nouveau_channel *chan) |
293 | { | 293 | { |
294 | struct drm_device *dev = chan->dev; | 294 | struct drm_device *dev = chan->dev; |
295 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
296 | struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; | ||
295 | struct nouveau_gpuobj *ramfc = NULL; | 297 | struct nouveau_gpuobj *ramfc = NULL; |
298 | unsigned long flags; | ||
296 | 299 | ||
297 | NV_DEBUG(dev, "ch%d\n", chan->id); | 300 | NV_DEBUG(dev, "ch%d\n", chan->id); |
298 | 301 | ||
302 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); | ||
303 | pfifo->reassign(dev, false); | ||
304 | |||
305 | /* Unload the context if it's the currently active one */ | ||
306 | if (pfifo->channel_id(dev) == chan->id) { | ||
307 | pfifo->disable(dev); | ||
308 | pfifo->unload_context(dev); | ||
309 | pfifo->enable(dev); | ||
310 | } | ||
311 | |||
299 | /* This will ensure the channel is seen as disabled. */ | 312 | /* This will ensure the channel is seen as disabled. */ |
300 | nouveau_gpuobj_ref(chan->ramfc, &ramfc); | 313 | nouveau_gpuobj_ref(chan->ramfc, &ramfc); |
301 | nouveau_gpuobj_ref(NULL, &chan->ramfc); | 314 | nouveau_gpuobj_ref(NULL, &chan->ramfc); |
@@ -306,6 +319,10 @@ nv50_fifo_destroy_context(struct nouveau_channel *chan) | |||
306 | nv50_fifo_channel_disable(dev, 127); | 319 | nv50_fifo_channel_disable(dev, 127); |
307 | nv50_fifo_playlist_update(dev); | 320 | nv50_fifo_playlist_update(dev); |
308 | 321 | ||
322 | pfifo->reassign(dev, true); | ||
323 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); | ||
324 | |||
325 | /* Free the channel resources */ | ||
309 | nouveau_gpuobj_ref(NULL, &ramfc); | 326 | nouveau_gpuobj_ref(NULL, &ramfc); |
310 | nouveau_gpuobj_ref(NULL, &chan->cache); | 327 | nouveau_gpuobj_ref(NULL, &chan->cache); |
311 | } | 328 | } |