[Mesa-dev] [PATCH 5/6] nv50, nvc0: make nv{50, c0} lookalike, kind of

Emil Velikov emil.l.velikov at gmail.com
Thu Apr 11 16:22:34 PDT 2013


Remove extra chipset check during nvc0_screen_create
Set the class_3d after the object is created

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/gallium/drivers/nv50/nv50_screen.c |  2 +-
 src/gallium/drivers/nvc0/nvc0_screen.c | 12 +-----------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index 55081be..4338ca1 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -705,7 +705,6 @@ nv50_screen_create(struct nouveau_device *dev)
       NOUVEAU_ERR("Not a known NV50 chipset: NV%02x\n", dev->chipset);
       goto fail;
    }
-   screen->base.class_3d = tesla_class;
 
    ret = nouveau_object_new(chan, 0xbeef5097, tesla_class,
                             NULL, 0, &screen->tesla);
@@ -713,6 +712,7 @@ nv50_screen_create(struct nouveau_device *dev)
       NOUVEAU_ERR("Failed to allocate PGRAPH context for 3D: %d\n", ret);
       goto fail;
    }
+   screen->base.class_3d = tesla_class;
 
    ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1 << 16,
                         3 << NV50_CODE_BO_SIZE_LOG2, NULL, &screen->code);
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c
index f2dd65b..8d1df18 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -532,7 +532,7 @@ nvc0_screen_resize_tls_area(struct nvc0_screen *screen,
 struct pipe_screen *
 nvc0_screen_create(struct nouveau_device *dev)
 {
-   struct nvc0_screen *screen;
+   struct nvc0_screen *screen = CALLOC_STRUCT(nvc0_screen);
    struct pipe_screen *pscreen;
    struct nouveau_object *chan;
    struct nouveau_pushbuf *push;
@@ -542,16 +542,6 @@ nvc0_screen_create(struct nouveau_device *dev)
    unsigned i;
    union nouveau_bo_config mm_config;
 
-   switch (dev->chipset & ~0xf) {
-   case 0xc0:
-   case 0xd0:
-   case 0xe0:
-      break;
-   default:
-      return NULL;
-   }
-
-   screen = CALLOC_STRUCT(nvc0_screen);
    if (!screen)
       return NULL;
    pscreen = &screen->base.base;
-- 
1.8.2.1



More information about the mesa-dev mailing list