2 * Mesa 3-D graphics library
5 * Copyright (C) 2011 LunarG Inc.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
26 * Chia-I Wu <olv@lunarg.com>
28 #include "target-helpers/inline_debug_helper.h"
29 #include "target-helpers/inline_sw_helper.h"
33 #include "i915/drm/i915_drm_public.h"
34 #include "i915/i915_public.h"
35 #include "target-helpers/inline_wrapper_sw_helper.h"
37 #include "nouveau/drm/nouveau_drm_public.h"
39 #include "radeon/drm/radeon_drm_public.h"
40 #include "r300/r300_public.h"
42 #include "r600/r600_public.h"
44 #include "radeonsi/radeonsi_public.h"
46 #include "svga/drm/svga_drm_public.h"
47 #include "svga/svga_public.h"
49 #include "freedreno/drm/freedreno_drm_public.h"
51 static struct pipe_screen
*
52 pipe_i915_create_screen(int fd
)
55 struct i915_winsys
*iws
;
56 struct pipe_screen
*screen
;
58 iws
= i915_drm_winsys_create(fd
);
62 screen
= i915_screen_create(iws
);
66 screen
= debug_screen_wrap(screen
);
74 static struct pipe_screen
*
75 pipe_nouveau_create_screen(int fd
)
78 struct pipe_screen
*screen
;
80 screen
= nouveau_drm_screen_create(fd
);
84 screen
= debug_screen_wrap(screen
);
92 static struct pipe_screen
*
93 pipe_r300_create_screen(int fd
)
96 struct radeon_winsys
*sws
;
97 struct pipe_screen
*screen
;
99 sws
= radeon_drm_winsys_create(fd
);
103 screen
= r300_screen_create(sws
);
107 screen
= debug_screen_wrap(screen
);
115 static struct pipe_screen
*
116 pipe_r600_create_screen(int fd
)
119 struct radeon_winsys
*rw
;
120 struct pipe_screen
*screen
;
122 rw
= radeon_drm_winsys_create(fd
);
126 screen
= r600_screen_create(rw
);
130 screen
= debug_screen_wrap(screen
);
138 static struct pipe_screen
*
139 pipe_radeonsi_create_screen(int fd
)
141 #if _EGL_PIPE_RADEONSI
142 struct radeon_winsys
*rw
;
143 struct pipe_screen
*screen
;
145 rw
= radeon_drm_winsys_create(fd
);
149 screen
= radeonsi_screen_create(rw
);
153 screen
= debug_screen_wrap(screen
);
161 static struct pipe_screen
*
162 pipe_vmwgfx_create_screen(int fd
)
165 struct svga_winsys_screen
*sws
;
166 struct pipe_screen
*screen
;
168 sws
= svga_drm_winsys_screen_create(fd
);
172 screen
= svga_screen_create(sws
);
176 screen
= debug_screen_wrap(screen
);
184 static struct pipe_screen
*
185 pipe_freedreno_create_screen(int fd
)
187 #if _EGL_PIPE_FREEDRENO
188 struct pipe_screen
*screen
;
190 screen
= fd_drm_screen_create(fd
);
194 screen
= debug_screen_wrap(screen
);
203 egl_pipe_create_drm_screen(const char *name
, int fd
)
205 if (strcmp(name
, "i915") == 0)
206 return pipe_i915_create_screen(fd
);
207 else if (strcmp(name
, "nouveau") == 0)
208 return pipe_nouveau_create_screen(fd
);
209 else if (strcmp(name
, "r300") == 0)
210 return pipe_r300_create_screen(fd
);
211 else if (strcmp(name
, "r600") == 0)
212 return pipe_r600_create_screen(fd
);
213 else if (strcmp(name
, "radeonsi") == 0)
214 return pipe_radeonsi_create_screen(fd
);
215 else if (strcmp(name
, "vmwgfx") == 0)
216 return pipe_vmwgfx_create_screen(fd
);
217 else if (strcmp(name
, "kgsl") == 0)
218 return pipe_freedreno_create_screen(fd
);
224 egl_pipe_create_swrast_screen(struct sw_winsys
*ws
)
226 struct pipe_screen
*screen
;
228 screen
= sw_screen_create(ws
);
230 screen
= debug_screen_wrap(screen
);