summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2007-06-24 18:55:23 +1000
committerBen Skeggs <skeggsb@gmail.com>2007-06-24 18:55:23 +1000
commit0afb3b518e1ece820b01f3eea64b25cff01c97bc (patch)
treea92461757e434fb47cd60114e39801e002920d5d
parent9dbf322d26642f9e671f144b34e7cd7d295e9b8e (diff)
nouveau: split PFIFO/PGRAPH context creation
-rw-r--r--shared-core/nouveau_fifo.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/shared-core/nouveau_fifo.c b/shared-core/nouveau_fifo.c
index cc4ff127..5bbd1c02 100644
--- a/shared-core/nouveau_fifo.c
+++ b/shared-core/nouveau_fifo.c
@@ -505,18 +505,16 @@ static int nouveau_fifo_alloc(drm_device_t* dev, int *chan_ret, DRMFILE filp)
NV_WRITE(NV03_PFIFO_CACHE1_PUSH0, 0x00000000);
NV_WRITE(NV04_PFIFO_CACHE1_PULL0, 0x00000000);
- /* Construct inital RAMFC for new channel */
+ /* Create a graphics context for new channel */
switch(dev_priv->card_type)
{
case NV_04:
case NV_05:
nv04_graph_context_create(dev, channel);
- nouveau_nv04_context_init(dev, channel);
break;
case NV_10:
case NV_17:
nv10_graph_context_create(dev, channel);
- nouveau_nv10_context_init(dev, channel);
break;
case NV_20:
ret = nv20_graph_context_create(dev, channel);
@@ -524,7 +522,6 @@ static int nouveau_fifo_alloc(drm_device_t* dev, int *chan_ret, DRMFILE filp)
nouveau_fifo_free(dev, channel);
return ret;
}
- nouveau_nv10_context_init(dev, channel);
break;
case NV_30:
ret = nv30_graph_context_create(dev, channel);
@@ -532,18 +529,45 @@ static int nouveau_fifo_alloc(drm_device_t* dev, int *chan_ret, DRMFILE filp)
nouveau_fifo_free(dev, channel);
return ret;
}
- nouveau_nv30_context_init(dev, channel);
break;
case NV_40:
case NV_44:
- case NV_50:
ret = nv40_graph_context_create(dev, channel);
if (ret) {
nouveau_fifo_free(dev, channel);
return ret;
}
- nouveau_nv40_context_init(dev, channel);
break;
+ default:
+ DRM_ERROR("grctx: unknown card type\n");
+ nouveau_fifo_free(dev, channel);
+ return DRM_ERR(EINVAL);
+ }
+
+ /* Construct inital RAMFC for new channel */
+ switch (dev_priv->card_type) {
+ case NV_04:
+ case NV_05:
+ nouveau_nv04_context_init(dev, channel);
+ break;
+ case NV_10:
+ case NV_17:
+ nouveau_nv10_context_init(dev, channel);
+ break;
+ case NV_20:
+ nouveau_nv10_context_init(dev, channel);
+ break;
+ case NV_30:
+ nouveau_nv30_context_init(dev, channel);
+ break;
+ case NV_40:
+ case NV_44:
+ nouveau_nv40_context_init(dev, channel);
+ break;
+ default:
+ DRM_ERROR("fifoctx: unknown card type\n");
+ nouveau_fifo_free(dev, channel);
+ return DRM_ERR(EINVAL);
}
/* enable the fifo dma operation */