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/nouveau_winsys.h" 10 #include "nouveau/nouveau_screen.h" 11 12 struct pipe_screen * nouveau_drm_screen_create(int fd)13nouveau_drm_screen_create(int fd) 14 { 15 struct nouveau_device *dev = NULL; 16 struct pipe_screen *(*init)(struct nouveau_device *); 17 int ret; 18 19 ret = nouveau_device_wrap(fd, 0, &dev); 20 if (ret) 21 return NULL; 22 23 switch (dev->chipset & 0xf0) { 24 case 0x30: 25 case 0x40: 26 case 0x60: 27 init = nv30_screen_create; 28 break; 29 case 0x50: 30 case 0x80: 31 case 0x90: 32 case 0xa0: 33 init = nv50_screen_create; 34 break; 35 case 0xc0: 36 case 0xd0: 37 case 0xe0: 38 init = nvc0_screen_create; 39 break; 40 default: 41 debug_printf("%s: unknown chipset nv%02x\n", __func__, 42 dev->chipset); 43 return NULL; 44 } 45 46 return init(dev); 47 } 48