1 #include "pipe/p_context.h"
2 #include "pipe/p_state.h"
3 #include "util/u_format.h"
4 #include "util/u_memory.h"
5 #include "util/u_inlines.h"
7 #include "nouveau_drm_winsys.h"
8 #include "nouveau_drm_public.h"
10 #include "nouveau_drmif.h"
11 #include "nouveau_channel.h"
12 #include "nouveau_bo.h"
14 #include "nouveau/nouveau_winsys.h"
15 #include "nouveau/nouveau_screen.h"
18 nouveau_drm_destroy_winsys(struct pipe_winsys *s)
20 struct nouveau_winsys *nv_winsys = nouveau_winsys(s);
21 struct nouveau_screen *nv_screen= nouveau_screen(nv_winsys->pscreen);
23 nouveau_device_close(&nv_screen->device);
28 nouveau_drm_screen_create(int fd)
30 struct nouveau_winsys *nvws;
31 struct pipe_winsys *ws;
32 struct nouveau_device *dev = NULL;
33 struct pipe_screen *(*init)(struct pipe_winsys *,
34 struct nouveau_device *);
37 ret = nouveau_device_open_existing(&dev, 0, fd, 0);
41 switch (dev->chipset & 0xf0) {
45 init = nvfx_screen_create;
51 init = nv50_screen_create;
54 init = nvc0_screen_create;
57 debug_printf("%s: unknown chipset nv%02x\n", __func__,
62 nvws = CALLOC_STRUCT(nouveau_winsys);
64 nouveau_device_close(&dev);
68 ws->destroy = nouveau_drm_destroy_winsys;
70 nvws->pscreen = init(ws, dev);