drm/nvc0/gr: macro to determine fermi class, will use it in a few places
authorBen Skeggs <bskeggs@redhat.com>
Tue, 24 May 2011 04:37:41 +0000 (14:37 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 23 Jun 2011 05:57:07 +0000 (15:57 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvc0_graph.c
drivers/gpu/drm/nouveau/nvc0_graph.h

index ca6db204d644711dafcaa8e9eaf2c88deada27ae..a57fba3da9417d2b0488b28be285cf551de8cd8e 100644 (file)
@@ -675,13 +675,10 @@ nvc0_graph_create(struct drm_device *dev)
        struct drm_nouveau_private *dev_priv = dev->dev_private;
        struct nvc0_graph_priv *priv;
        int ret, gpc, i;
+       u32 fermi;
 
-       switch (dev_priv->chipset) {
-       case 0xc0:
-       case 0xc3:
-       case 0xc4:
-               break;
-       default:
+       fermi = nvc0_graph_class(dev);
+       if (!fermi) {
                NV_ERROR(dev, "PGRAPH: unsupported chipset, please report!\n");
                return 0;
        }
@@ -770,6 +767,10 @@ nvc0_graph_create(struct drm_device *dev)
        NVOBJ_CLASS(dev, 0x9039, GR); /* M2MF */
        NVOBJ_MTHD (dev, 0x9039, 0x0500, nvc0_graph_mthd_page_flip);
        NVOBJ_CLASS(dev, 0x9097, GR); /* 3D */
+       if (fermi >= 0x9197)
+               NVOBJ_CLASS(dev, 0x9197, GR); /* 3D (NVC1-) */
+       if (fermi >= 0x9297)
+               NVOBJ_CLASS(dev, 0x9297, GR); /* 3D (NVC8-) */
        NVOBJ_CLASS(dev, 0x90c0, GR); /* COMPUTE */
        return 0;
 
index f5d184e0689df4bad0f99ce792167c1c8ea960f9..2b667d4e88ca137067b382ede2a1ec13f0c1cbc7 100644 (file)
@@ -72,4 +72,26 @@ struct nvc0_graph_chan {
 
 int nvc0_grctx_generate(struct nouveau_channel *);
 
+/* nvc0_graph.c uses this also to determine supported chipsets */
+static inline u32
+nvc0_graph_class(struct drm_device *dev)
+{
+       struct drm_nouveau_private *dev_priv = dev->dev_private;
+
+       switch (dev_priv->chipset) {
+       case 0xc0:
+       case 0xc3:
+       case 0xc4:
+               return 0x9097;
+#if 0
+       case 0xc1:
+               return 0x9197;
+       case 0xc8:
+               return 0x9297;
+#endif
+       default:
+               return 0;
+       }
+}
+
 #endif