nv20: remove u_simple_screen usage
authorBen Skeggs <bskeggs@redhat.com>
Thu, 4 Jun 2009 11:44:20 +0000 (21:44 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 5 Jun 2009 04:37:01 +0000 (14:37 +1000)
src/gallium/drivers/nv20/nv20_prim_vbuf.c
src/gallium/drivers/nv20/nv20_screen.c
src/gallium/drivers/nv20/nv20_screen.h

index 8aa342cd2db5a180663d3541f32fe2378a94c1c8..8f9f27ebdcdc91438334a8873da2901a1e226e90 100644 (file)
@@ -358,7 +358,7 @@ nv20_vbuf_render_release_vertices( struct vbuf_render *render )
 {
        struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render);
        struct nv20_context *nv20 = nv20_render->nv20;
-       struct pipe_screen *pscreen = &nv20->screen->pipe;
+       struct pipe_screen *pscreen = &nv20->screen->base.base;
 
        if (nv20_render->pbuffer) {
                pipe_buffer_reference(&nv20_render->pbuffer, NULL);
index 7760ae27c0ed566879d29b011f8343dafbf65bc9..6f3d73fe16e10dda684807efab698db13710a682 100644 (file)
@@ -4,23 +4,6 @@
 #include "nv20_context.h"
 #include "nv20_screen.h"
 
-static const char *
-nv20_screen_get_name(struct pipe_screen *screen)
-{
-       struct nv20_screen *nv20screen = nv20_screen(screen);
-       struct nouveau_device *dev = nv20screen->nvws->channel->device;
-       static char buffer[128];
-
-       snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset);
-       return buffer;
-}
-
-static const char *
-nv20_screen_get_vendor(struct pipe_screen *screen)
-{
-       return "nouveau";
-}
-
 static int
 nv20_screen_get_param(struct pipe_screen *screen, int param)
 {
@@ -140,26 +123,39 @@ struct pipe_screen *
 nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
 {
        struct nv20_screen *screen = CALLOC_STRUCT(nv20_screen);
+       struct nouveau_device *dev = nvws->channel->device;
+       struct pipe_screen *pscreen;
        unsigned kelvin_class = 0;
-       unsigned chipset = nvws->channel->device->chipset;
        int ret;
 
        if (!screen)
                return NULL;
+       pscreen = &screen->base.base;
+
        screen->nvws = nvws;
 
+       pscreen->winsys = ws;
+       pscreen->destroy = nv20_screen_destroy;
+       pscreen->get_param = nv20_screen_get_param;
+       pscreen->get_paramf = nv20_screen_get_paramf;
+       pscreen->is_format_supported = nv20_screen_is_format_supported;
+
+       nv20_screen_init_miptree_functions(pscreen);
+       nv20_screen_init_transfer_functions(pscreen);
+       nouveau_screen_init(&screen->base, dev);
+
        /* 2D engine setup */
        screen->eng2d = nv04_surface_2d_init(nvws);
        screen->eng2d->buf = nv20_surface_buffer;
 
        /* 3D object */
-       if (chipset >= 0x25)
+       if (dev->chipset >= 0x25)
                kelvin_class = NV25TCL;
-       else if (chipset >= 0x20)
+       else if (dev->chipset >= 0x20)
                kelvin_class = NV20TCL;
 
-       if (!kelvin_class || chipset >= 0x30) {
-               NOUVEAU_ERR("Unknown nv2x chipset: nv%02x\n", chipset);
+       if (!kelvin_class || dev->chipset >= 0x30) {
+               NOUVEAU_ERR("Unknown nv2x chipset: nv%02x\n", dev->chipset);
                return NULL;
        }
 
@@ -173,24 +169,10 @@ nv20_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);
-               nv20_screen_destroy(&screen->pipe);
+               nv20_screen_destroy(pscreen);
                return NULL;
        }
 
-       screen->pipe.winsys = ws;
-       screen->pipe.destroy = nv20_screen_destroy;
-
-       screen->pipe.get_name = nv20_screen_get_name;
-       screen->pipe.get_vendor = nv20_screen_get_vendor;
-       screen->pipe.get_param = nv20_screen_get_param;
-       screen->pipe.get_paramf = nv20_screen_get_paramf;
-
-       screen->pipe.is_format_supported = nv20_screen_is_format_supported;
-
-       nv20_screen_init_miptree_functions(&screen->pipe);
-       nv20_screen_init_transfer_functions(&screen->pipe);
-       u_simple_screen_init(&screen->pipe);
-
-       return &screen->pipe;
+       return pscreen;
 }
 
index d9fce2bced890b282c8c6d80dd65663cb7a70454..fc7bb0503345d39e46d5b98e9a22a56a00007266 100644 (file)
@@ -1,11 +1,11 @@
 #ifndef __NV20_SCREEN_H__
 #define __NV20_SCREEN_H__
 
-#include "pipe/p_screen.h"
+#include "nouveau/nouveau_screen.h"
 #include "nv04/nv04_surface_2d.h"
 
 struct nv20_screen {
-       struct pipe_screen pipe;
+       struct nouveau_screen base;
 
        struct nouveau_winsys *nvws;