2684ede307fbfd15517115f125efde866d0e3044
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"
30 #include "state_tracker/drm_driver.h"
34 #include "i915/drm/i915_drm_public.h"
35 #include "i915/i915_public.h"
37 #include "target-helpers/inline_wrapper_sw_helper.h"
38 #include "i965/drm/i965_drm_public.h"
39 #include "i965/brw_public.h"
41 #include "nouveau/drm/nouveau_drm_public.h"
43 #include "radeon/drm/radeon_drm_public.h"
44 #include "r300/r300_public.h"
46 #include "r600/drm/r600_drm_public.h"
47 #include "r600/r600_public.h"
49 #include "svga/drm/svga_drm_public.h"
50 #include "svga/svga_public.h"
52 static struct pipe_screen
*
53 pipe_i915_create_screen(int fd
)
56 struct i915_winsys
*iws
;
57 struct pipe_screen
*screen
;
59 iws
= i915_drm_winsys_create(fd
);
63 screen
= i915_screen_create(iws
);
67 screen
= debug_screen_wrap(screen
);
75 static struct pipe_screen
*
76 pipe_i965_create_screen(int fd
)
79 struct brw_winsys_screen
*bws
;
80 struct pipe_screen
*screen
;
82 bws
= i965_drm_winsys_screen_create(fd
);
86 screen
= brw_screen_create(bws
);
90 screen
= sw_screen_wrap(screen
);
92 screen
= debug_screen_wrap(screen
);
100 static struct pipe_screen
*
101 pipe_nouveau_create_screen(int fd
)
103 #if _EGL_PIPE_NOUVEAU
104 struct pipe_screen
*screen
;
106 screen
= nouveau_drm_screen_create(fd
);
110 screen
= debug_screen_wrap(screen
);
118 static struct pipe_screen
*
119 pipe_r300_create_screen(int fd
)
122 struct r300_winsys_screen
*sws
;
123 struct pipe_screen
*screen
;
125 sws
= r300_drm_winsys_screen_create(fd
);
129 screen
= r300_screen_create(sws
);
133 screen
= debug_screen_wrap(screen
);
141 static struct pipe_screen
*
142 pipe_r600_create_screen(int fd
)
146 struct pipe_screen
*screen
;
148 rw
= r600_drm_winsys_create(fd
);
152 screen
= r600_screen_create(rw
);
156 screen
= debug_screen_wrap(screen
);
164 static struct pipe_screen
*
165 pipe_vmwgfx_create_screen(int fd
)
168 struct svga_winsys_screen
*sws
;
169 struct pipe_screen
*screen
;
171 sws
= svga_drm_winsys_screen_create(fd
);
175 screen
= svga_screen_create(sws
);
179 screen
= debug_screen_wrap(screen
);
188 egl_pipe_create_drm_screen(const char *name
, int fd
)
190 if (strcmp(name
, "i915") == 0)
191 return pipe_i915_create_screen(fd
);
192 else if (strcmp(name
, "i965") == 0)
193 return pipe_i965_create_screen(fd
);
194 else if (strcmp(name
, "nouveau") == 0)
195 return pipe_nouveau_create_screen(fd
);
196 else if (strcmp(name
, "r300") == 0)
197 return pipe_r300_create_screen(fd
);
198 else if (strcmp(name
, "r600") == 0)
199 return pipe_r600_create_screen(fd
);
200 else if (strcmp(name
, "vmwgfx") == 0)
201 return pipe_vmwgfx_create_screen(fd
);
207 egl_pipe_create_swrast_screen(struct sw_winsys
*ws
)
209 struct pipe_screen
*screen
;
211 screen
= sw_screen_create(ws
);
213 screen
= debug_screen_wrap(screen
);