nv30: remove u_simple_screen usage
authorBen Skeggs <bskeggs@redhat.com>
Thu, 4 Jun 2009 11:37:59 +0000 (21:37 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 5 Jun 2009 04:37:01 +0000 (14:37 +1000)
src/gallium/drivers/nv30/nv30_context.h
src/gallium/drivers/nv30/nv30_screen.c
src/gallium/drivers/nv30/nv30_screen.h
src/gallium/drivers/nv30/nv30_vbo.c

index 5ba474cc3385e1ca44134f52539b1d0b7506a71b..4229c0a0e1478bc33842e4416e0283fdf751dd73 100644 (file)
@@ -19,8 +19,6 @@
 #include "nouveau/nouveau_push.h"
 #include "nouveau/nouveau_stateobj.h"
 
-#define nouveau_bo(pb) nv30->screen->nvws->get_bo(pb)
-
 #include "nv30_state.h"
 
 #define NOUVEAU_ERR(fmt, args...) \
index 772eb78566a7ac5cf3507ed9fc80e503940bb205..f516038b9ca6b95d263925126d8656deb5ef28e6 100644 (file)
@@ -1,5 +1,7 @@
 #include "pipe/p_screen.h"
-#include "util/u_simple_screen.h"
+#include "pipe/p_state.h"
+
+#include "nouveau/nouveau_screen.h"
 
 #include "nv30_context.h"
 #include "nv30_screen.h"
@@ -8,23 +10,6 @@
 #define NV34TCL_CHIPSET_3X_MASK 0x00000010
 #define NV35TCL_CHIPSET_3X_MASK 0x000001e0
 
-static const char *
-nv30_screen_get_name(struct pipe_screen *pscreen)
-{
-       struct nv30_screen *screen = nv30_screen(pscreen);
-       struct nouveau_device *dev = screen->nvws->channel->device;
-       static char buffer[128];
-
-       snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset);
-       return buffer;
-}
-
-static const char *
-nv30_screen_get_vendor(struct pipe_screen *pscreen)
-{
-       return "nouveau";
-}
-
 static int
 nv30_screen_get_param(struct pipe_screen *pscreen, int param)
 {
@@ -155,29 +140,42 @@ struct pipe_screen *
 nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
 {
        struct nv30_screen *screen = CALLOC_STRUCT(nv30_screen);
+       struct nouveau_device *dev = nvws->channel->device;
+       struct pipe_screen *pscreen;
        struct nouveau_stateobj *so;
        unsigned rankine_class = 0;
-       unsigned chipset = nvws->channel->device->chipset;
        int ret, i;
 
        if (!screen)
                return NULL;
+       pscreen = &screen->base.base;
+
        screen->nvws = nvws;
 
+       pscreen->winsys = ws;
+       pscreen->destroy = nv30_screen_destroy;
+       pscreen->get_param = nv30_screen_get_param;
+       pscreen->get_paramf = nv30_screen_get_paramf;
+       pscreen->is_format_supported = nv30_screen_surface_format_supported;
+
+       nv30_screen_init_miptree_functions(pscreen);
+       nv30_screen_init_transfer_functions(pscreen);
+       nouveau_screen_init(&screen->base, dev);
+
        /* 2D engine setup */
        screen->eng2d = nv04_surface_2d_init(nvws);
        screen->eng2d->buf = nv30_surface_buffer;
 
        /* 3D object */
-       switch (chipset & 0xf0) {
+       switch (dev->chipset & 0xf0) {
        case 0x30:
-               if (NV30TCL_CHIPSET_3X_MASK & (1 << (chipset & 0x0f)))
+               if (NV30TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
                        rankine_class = 0x0397;
                else
-               if (NV34TCL_CHIPSET_3X_MASK & (1 << (chipset & 0x0f)))
+               if (NV34TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
                        rankine_class = 0x0697;
                else
-               if (NV35TCL_CHIPSET_3X_MASK & (1 << (chipset & 0x0f)))
+               if (NV35TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
                        rankine_class = 0x0497;
                break;
        default:
@@ -185,7 +183,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
        }
 
        if (!rankine_class) {
-               NOUVEAU_ERR("Unknown nv3x chipset: nv%02x\n", chipset);
+               NOUVEAU_ERR("Unknown nv3x chipset: nv%02x\n", dev->chipset);
                return NULL;
        }
 
@@ -199,7 +197,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
        ret = nvws->notifier_alloc(nvws, 1, &screen->sync);
        if (ret) {
                NOUVEAU_ERR("Error creating notifier object: %d\n", ret);
-               nv30_screen_destroy(&screen->pipe);
+               nv30_screen_destroy(pscreen);
                return NULL;
        }
 
@@ -207,21 +205,21 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
        ret = nvws->notifier_alloc(nvws, 32, &screen->query);
        if (ret) {
                NOUVEAU_ERR("Error initialising query objects: %d\n", ret);
-               nv30_screen_destroy(&screen->pipe);
+               nv30_screen_destroy(pscreen);
                return NULL;
        }
 
        ret = nvws->res_init(&screen->query_heap, 0, 32);
        if (ret) {
                NOUVEAU_ERR("Error initialising query object heap: %d\n", ret);
-               nv30_screen_destroy(&screen->pipe);
+               nv30_screen_destroy(pscreen);
                return NULL;
        }
 
        /* Vtxprog resources */
        if (nvws->res_init(&screen->vp_exec_heap, 0, 256) ||
            nvws->res_init(&screen->vp_data_heap, 0, 256)) {
-               nv30_screen_destroy(&screen->pipe);
+               nv30_screen_destroy(pscreen);
                return NULL;
        }
 
@@ -305,19 +303,5 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
        so_ref(NULL, &so);
        nouveau_pushbuf_flush(nvws->channel, 0);
 
-       screen->pipe.winsys = ws;
-       screen->pipe.destroy = nv30_screen_destroy;
-
-       screen->pipe.get_name = nv30_screen_get_name;
-       screen->pipe.get_vendor = nv30_screen_get_vendor;
-       screen->pipe.get_param = nv30_screen_get_param;
-       screen->pipe.get_paramf = nv30_screen_get_paramf;
-
-       screen->pipe.is_format_supported = nv30_screen_surface_format_supported;
-
-       nv30_screen_init_miptree_functions(&screen->pipe);
-       nv30_screen_init_transfer_functions(&screen->pipe);
-       u_simple_screen_init(&screen->pipe);
-
-       return &screen->pipe;
+       return pscreen;
 }
index 8e36883975926cd67cbc5427605d14706247d6a7..5fbd998b53943c35ebac43b449d7bd4106b4401e 100644 (file)
@@ -1,11 +1,12 @@
 #ifndef __NV30_SCREEN_H__
 #define __NV30_SCREEN_H__
 
-#include "pipe/p_screen.h"
+#include "nouveau/nouveau_screen.h"
+
 #include "nv04/nv04_surface_2d.h"
 
 struct nv30_screen {
-       struct pipe_screen pipe;
+       struct nouveau_screen base;
 
        struct nouveau_winsys *nvws;
 
index b7d8c2e008202fbd9ca80b4ae19bb2b08f43aa91..ff2bf6e71b55fff25593dd0c0ae2db1afec8f837 100644 (file)
@@ -70,7 +70,7 @@ static boolean
 nv30_vbo_set_idxbuf(struct nv30_context *nv30, struct pipe_buffer *ib,
                    unsigned ib_size)
 {
-       struct pipe_screen *pscreen = &nv30->screen->pipe;
+       struct pipe_screen *pscreen = &nv30->screen->base.base;
        unsigned type;
 
        if (!ib) {