From 10e3b9f4d029df5c6c01a5d76c9085c48d82ac43 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 23 Jun 2010 22:49:11 +0200 Subject: nouveau: Rename winsys file --- src/gallium/winsys/nouveau/drm/Makefile | 2 +- src/gallium/winsys/nouveau/drm/nouveau_drm_api.c | 85 ---------------------- src/gallium/winsys/nouveau/drm/nouveau_drm_api.h | 30 -------- .../winsys/nouveau/drm/nouveau_drm_winsys.c | 85 ++++++++++++++++++++++ .../winsys/nouveau/drm/nouveau_drm_winsys.h | 30 ++++++++ 5 files changed, 116 insertions(+), 116 deletions(-) delete mode 100644 src/gallium/winsys/nouveau/drm/nouveau_drm_api.c delete mode 100644 src/gallium/winsys/nouveau/drm/nouveau_drm_api.h create mode 100644 src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c create mode 100644 src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h (limited to 'src/gallium/winsys/nouveau') diff --git a/src/gallium/winsys/nouveau/drm/Makefile b/src/gallium/winsys/nouveau/drm/Makefile index 71029858f7..74a3c6a0d7 100644 --- a/src/gallium/winsys/nouveau/drm/Makefile +++ b/src/gallium/winsys/nouveau/drm/Makefile @@ -3,7 +3,7 @@ include $(TOP)/configs/current LIBNAME = nouveaudrm -C_SOURCES = nouveau_drm_api.c +C_SOURCES = nouveau_drm_winsys.c LIBRARY_INCLUDES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-I) LIBRARY_DEFINES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-other) diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_api.c deleted file mode 100644 index 2f24431462..0000000000 --- a/src/gallium/winsys/nouveau/drm/nouveau_drm_api.c +++ /dev/null @@ -1,85 +0,0 @@ -#include "pipe/p_context.h" -#include "pipe/p_state.h" -#include "util/u_format.h" -#include "util/u_memory.h" -#include "util/u_inlines.h" - -#include "nouveau_drm_api.h" - -#include "nouveau_drmif.h" -#include "nouveau_channel.h" -#include "nouveau_bo.h" - -#include "nouveau/nouveau_winsys.h" -#include "nouveau/nouveau_screen.h" - -static void -nouveau_drm_destroy_winsys(struct pipe_winsys *s) -{ - struct nouveau_winsys *nv_winsys = nouveau_winsys(s); - struct nouveau_screen *nv_screen= nouveau_screen(nv_winsys->pscreen); - nouveau_device_close(&nv_screen->device); - FREE(nv_winsys); -} - -static struct pipe_screen * -nouveau_drm_create_screen(struct drm_api *api, int fd) -{ - struct nouveau_winsys *nvws; - struct pipe_winsys *ws; - struct nouveau_device *dev = NULL; - struct pipe_screen *(*init)(struct pipe_winsys *, - struct nouveau_device *); - int ret; - - ret = nouveau_device_open_existing(&dev, 0, fd, 0); - if (ret) - return NULL; - - switch (dev->chipset & 0xf0) { - case 0x30: - case 0x40: - case 0x60: - init = nvfx_screen_create; - break; - case 0x50: - case 0x80: - case 0x90: - case 0xa0: - init = nv50_screen_create; - break; - default: - debug_printf("%s: unknown chipset nv%02x\n", __func__, - dev->chipset); - return NULL; - } - - nvws = CALLOC_STRUCT(nouveau_winsys); - if (!nvws) { - nouveau_device_close(&dev); - return NULL; - } - ws = &nvws->base; - ws->destroy = nouveau_drm_destroy_winsys; - - nvws->pscreen = init(ws, dev); - if (!nvws->pscreen) { - ws->destroy(ws); - return NULL; - } - - return nvws->pscreen; -} - -static struct drm_api nouveau_drm_api_hooks = { - .name = "nouveau", - .driver_name = "nouveau", - .create_screen = nouveau_drm_create_screen, - .destroy = NULL, -}; - -struct drm_api * -drm_api_create() { - return &nouveau_drm_api_hooks; -} - diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_api.h b/src/gallium/winsys/nouveau/drm/nouveau_drm_api.h deleted file mode 100644 index ba6305c17e..0000000000 --- a/src/gallium/winsys/nouveau/drm/nouveau_drm_api.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __NOUVEAU_DRM_API_H__ -#define __NOUVEAU_DRM_API_H__ - -#include "state_tracker/drm_api.h" - -#include "util/u_simple_screen.h" - -#include "nouveau_dri.h" - -struct nouveau_winsys { - struct pipe_winsys base; - - struct pipe_screen *pscreen; - - struct pipe_surface *front; -}; - -static INLINE struct nouveau_winsys * -nouveau_winsys(struct pipe_winsys *ws) -{ - return (struct nouveau_winsys *)ws; -} - -static INLINE struct nouveau_winsys * -nouveau_winsys_screen(struct pipe_screen *pscreen) -{ - return nouveau_winsys(pscreen->winsys); -} - -#endif diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c new file mode 100644 index 0000000000..418f1d708a --- /dev/null +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c @@ -0,0 +1,85 @@ +#include "pipe/p_context.h" +#include "pipe/p_state.h" +#include "util/u_format.h" +#include "util/u_memory.h" +#include "util/u_inlines.h" + +#include "nouveau_drm_winsys.h" + +#include "nouveau_drmif.h" +#include "nouveau_channel.h" +#include "nouveau_bo.h" + +#include "nouveau/nouveau_winsys.h" +#include "nouveau/nouveau_screen.h" + +static void +nouveau_drm_destroy_winsys(struct pipe_winsys *s) +{ + struct nouveau_winsys *nv_winsys = nouveau_winsys(s); + struct nouveau_screen *nv_screen= nouveau_screen(nv_winsys->pscreen); + nouveau_device_close(&nv_screen->device); + FREE(nv_winsys); +} + +static struct pipe_screen * +nouveau_drm_create_screen(struct drm_api *api, int fd) +{ + struct nouveau_winsys *nvws; + struct pipe_winsys *ws; + struct nouveau_device *dev = NULL; + struct pipe_screen *(*init)(struct pipe_winsys *, + struct nouveau_device *); + int ret; + + ret = nouveau_device_open_existing(&dev, 0, fd, 0); + if (ret) + return NULL; + + switch (dev->chipset & 0xf0) { + case 0x30: + case 0x40: + case 0x60: + init = nvfx_screen_create; + break; + case 0x50: + case 0x80: + case 0x90: + case 0xa0: + init = nv50_screen_create; + break; + default: + debug_printf("%s: unknown chipset nv%02x\n", __func__, + dev->chipset); + return NULL; + } + + nvws = CALLOC_STRUCT(nouveau_winsys); + if (!nvws) { + nouveau_device_close(&dev); + return NULL; + } + ws = &nvws->base; + ws->destroy = nouveau_drm_destroy_winsys; + + nvws->pscreen = init(ws, dev); + if (!nvws->pscreen) { + ws->destroy(ws); + return NULL; + } + + return nvws->pscreen; +} + +static struct drm_api nouveau_drm_api_hooks = { + .name = "nouveau", + .driver_name = "nouveau", + .create_screen = nouveau_drm_create_screen, + .destroy = NULL, +}; + +struct drm_api * +drm_api_create() { + return &nouveau_drm_api_hooks; +} + diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h new file mode 100644 index 0000000000..ae3ab17d74 --- /dev/null +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h @@ -0,0 +1,30 @@ +#ifndef __NOUVEAU_DRM_WINSYS_H__ +#define __NOUVEAU_DRM_WINSYS_H__ + +#include "state_tracker/drm_api.h" + +#include "util/u_simple_screen.h" + +#include "nouveau_dri.h" + +struct nouveau_winsys { + struct pipe_winsys base; + + struct pipe_screen *pscreen; + + struct pipe_surface *front; +}; + +static INLINE struct nouveau_winsys * +nouveau_winsys(struct pipe_winsys *ws) +{ + return (struct nouveau_winsys *)ws; +} + +static INLINE struct nouveau_winsys * +nouveau_winsys_screen(struct pipe_screen *pscreen) +{ + return nouveau_winsys(pscreen->winsys); +} + +#endif -- cgit v1.2.3