Commit f4512e65 authored by Ben Skeggs's avatar Ben Skeggs

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: default avatarBen Skeggs <bskeggs@redhat.com>
parent 3052be2c
...@@ -112,7 +112,6 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret, ...@@ -112,7 +112,6 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret,
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
struct nouveau_crypt_engine *pcrypt = &dev_priv->engine.crypt;
struct nouveau_channel *chan; struct nouveau_channel *chan;
unsigned long flags; unsigned long flags;
int user, ret; int user, ret;
...@@ -209,18 +208,12 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret, ...@@ -209,18 +208,12 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret,
pfifo->reassign(dev, false); pfifo->reassign(dev, false);
/* Create a graphics context for new channel */ /* Create a graphics context for new channel */
if (dev_priv->card_type < NV_50) {
ret = pgraph->create_context(chan); ret = pgraph->create_context(chan);
if (ret) { if (ret) {
nouveau_channel_put(&chan); nouveau_channel_put(&chan);
return ret; return ret;
} }
if (pcrypt->create_context) {
ret = pcrypt->create_context(chan);
if (ret) {
nouveau_channel_put(&chan);
return ret;
}
} }
/* Construct inital RAMFC for new channel */ /* Construct inital RAMFC for new channel */
......
...@@ -634,6 +634,29 @@ nouveau_gpuobj_gr_new(struct nouveau_channel *chan, int class, ...@@ -634,6 +634,29 @@ nouveau_gpuobj_gr_new(struct nouveau_channel *chan, int class,
if (oc->engine == NVOBJ_ENGINE_SW) if (oc->engine == NVOBJ_ENGINE_SW)
return nouveau_gpuobj_sw_new(chan, class, gpuobj); return nouveau_gpuobj_sw_new(chan, class, gpuobj);
switch (oc->engine) {
case NVOBJ_ENGINE_GR:
if (dev_priv->card_type >= NV_50 && !chan->ramin_grctx) {
struct nouveau_pgraph_engine *pgraph =
&dev_priv->engine.graph;
ret = pgraph->create_context(chan);
if (ret)
return ret;
}
break;
case NVOBJ_ENGINE_CRYPT:
if (!chan->crypt_ctx) {
struct nouveau_crypt_engine *pcrypt =
&dev_priv->engine.crypt;
ret = pcrypt->create_context(chan);
if (ret)
return ret;
}
break;
}
ret = nouveau_gpuobj_new(dev, chan, ret = nouveau_gpuobj_new(dev, chan,
nouveau_gpuobj_class_instmem_size(dev, class), nouveau_gpuobj_class_instmem_size(dev, class),
16, 16,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment