diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv04_graph.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv04_graph.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nv04_graph.c b/drivers/gpu/drm/nouveau/nv04_graph.c index 98b9525c1eb..1e2ad394233 100644 --- a/drivers/gpu/drm/nouveau/nv04_graph.c +++ b/drivers/gpu/drm/nouveau/nv04_graph.c | |||
@@ -412,10 +412,25 @@ int nv04_graph_create_context(struct nouveau_channel *chan) | |||
412 | 412 | ||
413 | void nv04_graph_destroy_context(struct nouveau_channel *chan) | 413 | void nv04_graph_destroy_context(struct nouveau_channel *chan) |
414 | { | 414 | { |
415 | struct drm_device *dev = chan->dev; | ||
416 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
417 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
415 | struct graph_state *pgraph_ctx = chan->pgraph_ctx; | 418 | struct graph_state *pgraph_ctx = chan->pgraph_ctx; |
419 | unsigned long flags; | ||
420 | |||
421 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); | ||
422 | pgraph->fifo_access(dev, false); | ||
423 | |||
424 | /* Unload the context if it's the currently active one */ | ||
425 | if (pgraph->channel(dev) == chan) | ||
426 | pgraph->unload_context(dev); | ||
416 | 427 | ||
428 | /* Free the context resources */ | ||
417 | kfree(pgraph_ctx); | 429 | kfree(pgraph_ctx); |
418 | chan->pgraph_ctx = NULL; | 430 | chan->pgraph_ctx = NULL; |
431 | |||
432 | pgraph->fifo_access(dev, true); | ||
433 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); | ||
419 | } | 434 | } |
420 | 435 | ||
421 | int nv04_graph_load_context(struct nouveau_channel *chan) | 436 | int nv04_graph_load_context(struct nouveau_channel *chan) |