diff options
-rw-r--r-- | src/gallium/drivers/nv10/nv10_prim_vbuf.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/nv10/nv10_screen.c | 67 | ||||
-rw-r--r-- | src/gallium/drivers/nv10/nv10_screen.h | 4 |
3 files changed, 27 insertions, 46 deletions
diff --git a/src/gallium/drivers/nv10/nv10_prim_vbuf.c b/src/gallium/drivers/nv10/nv10_prim_vbuf.c index 089c236302a..f16e343fa64 100644 --- a/src/gallium/drivers/nv10/nv10_prim_vbuf.c +++ b/src/gallium/drivers/nv10/nv10_prim_vbuf.c @@ -203,7 +203,7 @@ nv10_vbuf_render_release_vertices( struct vbuf_render *render ) { struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render); struct nv10_context *nv10 = nv10_render->nv10; - struct pipe_screen *pscreen = &nv10->screen->pipe; + struct pipe_screen *pscreen = &nv10->screen->base.base; assert(nv10_render->buffer); pipe_buffer_reference(&nv10_render->buffer, NULL); diff --git a/src/gallium/drivers/nv10/nv10_screen.c b/src/gallium/drivers/nv10/nv10_screen.c index 6532a93c7ba..5c36bee6e2b 100644 --- a/src/gallium/drivers/nv10/nv10_screen.c +++ b/src/gallium/drivers/nv10/nv10_screen.c @@ -1,26 +1,8 @@ #include "pipe/p_screen.h" -#include "util/u_simple_screen.h" #include "nv10_context.h" #include "nv10_screen.h" -static const char * -nv10_screen_get_name(struct pipe_screen *screen) -{ - struct nv10_screen *nv10screen = nv10_screen(screen); - struct nouveau_device *dev = nv10screen->nvws->channel->device; - static char buffer[128]; - - snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset); - return buffer; -} - -static const char * -nv10_screen_get_vendor(struct pipe_screen *screen) -{ - return "nouveau"; -} - static int nv10_screen_get_param(struct pipe_screen *screen, int param) { @@ -140,30 +122,43 @@ struct pipe_screen * nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv10_screen *screen = CALLOC_STRUCT(nv10_screen); + struct nouveau_device *dev = nvws->channel->device; + struct pipe_screen *pscreen; unsigned celsius_class; - unsigned chipset = nvws->channel->device->chipset; int ret; if (!screen) return NULL; + pscreen = &screen->base.base; + screen->nvws = nvws; + pscreen->winsys = ws; + pscreen->destroy = nv10_screen_destroy; + pscreen->get_param = nv10_screen_get_param; + pscreen->get_paramf = nv10_screen_get_paramf; + pscreen->is_format_supported = nv10_screen_is_format_supported; + + nv10_screen_init_miptree_functions(pscreen); + nv10_screen_init_transfer_functions(pscreen); + nouveau_screen_init(&screen->base, dev); + /* 2D engine setup */ screen->eng2d = nv04_surface_2d_init(nvws); screen->eng2d->buf = nv10_surface_buffer; /* 3D object */ - if (chipset>=0x20) - celsius_class=NV11TCL; - else if (chipset>=0x17) - celsius_class=NV17TCL; - else if (chipset>=0x11) - celsius_class=NV11TCL; + if (dev->chipset >= 0x20) + celsius_class = NV11TCL; + else if (dev->chipset >= 0x17) + celsius_class = NV17TCL; + else if (dev->chipset >= 0x11) + celsius_class = NV11TCL; else - celsius_class=NV10TCL; + celsius_class = NV10TCL; if (!celsius_class) { - NOUVEAU_ERR("Unknown nv1x chipset: nv%02x\n", chipset); + NOUVEAU_ERR("Unknown nv1x chipset: nv%02x\n", dev->chipset); return NULL; } @@ -177,24 +172,10 @@ nv10_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); - nv10_screen_destroy(&screen->pipe); + nv10_screen_destroy(pscreen); return NULL; } - screen->pipe.winsys = ws; - screen->pipe.destroy = nv10_screen_destroy; - - screen->pipe.get_name = nv10_screen_get_name; - screen->pipe.get_vendor = nv10_screen_get_vendor; - screen->pipe.get_param = nv10_screen_get_param; - screen->pipe.get_paramf = nv10_screen_get_paramf; - - screen->pipe.is_format_supported = nv10_screen_is_format_supported; - - nv10_screen_init_miptree_functions(&screen->pipe); - nv10_screen_init_transfer_functions(&screen->pipe); - u_simple_screen_init(&screen->pipe); - - return &screen->pipe; + return pscreen; } diff --git a/src/gallium/drivers/nv10/nv10_screen.h b/src/gallium/drivers/nv10/nv10_screen.h index ad829ee3fd4..86b6d8def54 100644 --- a/src/gallium/drivers/nv10/nv10_screen.h +++ b/src/gallium/drivers/nv10/nv10_screen.h @@ -1,11 +1,11 @@ #ifndef __NV10_SCREEN_H__ #define __NV10_SCREEN_H__ -#include "pipe/p_screen.h" +#include "nouveau/nouveau_screen.h" #include "nv04/nv04_surface_2d.h" struct nv10_screen { - struct pipe_screen pipe; + struct nouveau_screen base; struct nouveau_winsys *nvws; |