nouveau: get rid of winsys object
[mesa.git] / src / gallium / winsys / nouveau / drm / nouveau_drm_winsys.c
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"
6
7 #include "nouveau_drm_public.h"
8
9 #include "nouveau_drmif.h"
10 #include "nouveau_channel.h"
11 #include "nouveau_bo.h"
12
13 #include "nouveau/nouveau_winsys.h"
14 #include "nouveau/nouveau_screen.h"
15
16 struct pipe_screen *
17 nouveau_drm_screen_create(int fd)
18 {
19 struct nouveau_device *dev = NULL;
20 struct pipe_screen *(*init)(struct nouveau_device *);
21 int ret;
22
23 ret = nouveau_device_open_existing(&dev, 0, fd, 0);
24 if (ret)
25 return NULL;
26
27 switch (dev->chipset & 0xf0) {
28 case 0x30:
29 case 0x40:
30 case 0x60:
31 init = nvfx_screen_create;
32 break;
33 case 0x50:
34 case 0x80:
35 case 0x90:
36 case 0xa0:
37 init = nv50_screen_create;
38 break;
39 case 0xc0:
40 case 0xd0:
41 init = nvc0_screen_create;
42 break;
43 default:
44 debug_printf("%s: unknown chipset nv%02x\n", __func__,
45 dev->chipset);
46 return NULL;
47 }
48
49 return init(dev);
50 }