aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-10-19 21:47:09 -0400
committerBen Skeggs <bskeggs@redhat.com>2010-12-03 00:10:44 -0500
commitf4512e6579ddaa9b1f8ab1d5659131243ffc421f (patch)
tree8e2a5b4457ce9eaf8e7ac6d619f7cf69074e0d66
parent3052be2cea64371300a0338d3ca5d3575fbd109c (diff)
drm/nv50: create graph and crypt contexts on demand
This really needs cleaning up somehow, and probably investigate what's needed to do this on earlier generations. NVIDIA do something similar there too. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_channel.c11
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_object.c23
2 files changed, 25 insertions, 9 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_channel.c b/drivers/gpu/drm/nouveau/nouveau_channel.c
index 8f2df6beb893..f2d674202369 100644
--- a/drivers/gpu/drm/nouveau/nouveau_channel.c
+++ b/drivers/gpu/drm/nouveau/nouveau_channel.c
@@ -112,7 +112,6 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret,
112 struct drm_nouveau_private *dev_priv = dev->dev_private; 112 struct drm_nouveau_private *dev_priv = dev->dev_private;
113 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; 113 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
114 struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; 114 struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
115 struct nouveau_crypt_engine *pcrypt = &dev_priv->engine.crypt;
116 struct nouveau_channel *chan; 115 struct nouveau_channel *chan;
117 unsigned long flags; 116 unsigned long flags;
118 int user, ret; 117 int user, ret;
@@ -209,14 +208,8 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret,
209 pfifo->reassign(dev, false); 208 pfifo->reassign(dev, false);
210 209
211 /* Create a graphics context for new channel */ 210 /* Create a graphics context for new channel */
212 ret = pgraph->create_context(chan); 211 if (dev_priv->card_type < NV_50) {
213 if (ret) { 212 ret = pgraph->create_context(chan);
214 nouveau_channel_put(&chan);
215 return ret;
216 }
217
218 if (pcrypt->create_context) {
219 ret = pcrypt->create_context(chan);
220 if (ret) { 213 if (ret) {
221 nouveau_channel_put(&chan); 214 nouveau_channel_put(&chan);
222 return ret; 215 return ret;
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c
index ee526534c6f4..54078186fe65 100644
--- a/drivers/gpu/drm/nouveau/nouveau_object.c
+++ b/drivers/gpu/drm/nouveau/nouveau_object.c
@@ -634,6 +634,29 @@ found:
634 if (oc->engine == NVOBJ_ENGINE_SW) 634 if (oc->engine == NVOBJ_ENGINE_SW)
635 return nouveau_gpuobj_sw_new(chan, class, gpuobj); 635 return nouveau_gpuobj_sw_new(chan, class, gpuobj);
636 636
637 switch (oc->engine) {
638 case NVOBJ_ENGINE_GR:
639 if (dev_priv->card_type >= NV_50 && !chan->ramin_grctx) {
640 struct nouveau_pgraph_engine *pgraph =
641 &dev_priv->engine.graph;
642
643 ret = pgraph->create_context(chan);
644 if (ret)
645 return ret;
646 }
647 break;
648 case NVOBJ_ENGINE_CRYPT:
649 if (!chan->crypt_ctx) {
650 struct nouveau_crypt_engine *pcrypt =
651 &dev_priv->engine.crypt;
652
653 ret = pcrypt->create_context(chan);
654 if (ret)
655 return ret;
656 }
657 break;
658 }
659
637 ret = nouveau_gpuobj_new(dev, chan, 660 ret = nouveau_gpuobj_new(dev, chan,
638 nouveau_gpuobj_class_instmem_size(dev, class), 661 nouveau_gpuobj_class_instmem_size(dev, class),
639 16, 662 16,