From 74c45add474862e9c4e5063d2c5173546366bfe6 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 4 Jun 2009 21:44:20 +1000 Subject: [PATCH] nv20: remove u_simple_screen usage --- src/gallium/drivers/nv20/nv20_prim_vbuf.c | 2 +- src/gallium/drivers/nv20/nv20_screen.c | 58 ++++++++--------------- src/gallium/drivers/nv20/nv20_screen.h | 4 +- 3 files changed, 23 insertions(+), 41 deletions(-) diff --git a/src/gallium/drivers/nv20/nv20_prim_vbuf.c b/src/gallium/drivers/nv20/nv20_prim_vbuf.c index 8aa342cd2db..8f9f27ebdcd 100644 --- a/src/gallium/drivers/nv20/nv20_prim_vbuf.c +++ b/src/gallium/drivers/nv20/nv20_prim_vbuf.c @@ -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); diff --git a/src/gallium/drivers/nv20/nv20_screen.c b/src/gallium/drivers/nv20/nv20_screen.c index 7760ae27c0e..6f3d73fe16e 100644 --- a/src/gallium/drivers/nv20/nv20_screen.c +++ b/src/gallium/drivers/nv20/nv20_screen.c @@ -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; } diff --git a/src/gallium/drivers/nv20/nv20_screen.h b/src/gallium/drivers/nv20/nv20_screen.h index d9fce2bced8..fc7bb050334 100644 --- a/src/gallium/drivers/nv20/nv20_screen.h +++ b/src/gallium/drivers/nv20/nv20_screen.h @@ -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; -- 2.30.2