• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef DRM_HELPER_H
2 #define DRM_HELPER_H
3 
4 #include <stdio.h>
5 #include "target-helpers/inline_debug_helper.h"
6 #include "target-helpers/drm_helper_public.h"
7 
8 #ifdef GALLIUM_I915
9 #include "i915/drm/i915_drm_public.h"
10 #include "i915/i915_public.h"
11 
12 struct pipe_screen *
pipe_i915_create_screen(int fd)13 pipe_i915_create_screen(int fd)
14 {
15    struct i915_winsys *iws;
16    struct pipe_screen *screen;
17 
18    iws = i915_drm_winsys_create(fd);
19    if (!iws)
20       return NULL;
21 
22    screen = i915_screen_create(iws);
23    return screen ? debug_screen_wrap(screen) : NULL;
24 }
25 
26 #else
27 
28 struct pipe_screen *
pipe_i915_create_screen(int fd)29 pipe_i915_create_screen(int fd)
30 {
31    fprintf(stderr, "i915g: driver missing\n");
32    return NULL;
33 }
34 
35 #endif
36 
37 #ifdef GALLIUM_ILO
38 #include "intel/drm/intel_drm_public.h"
39 #include "ilo/ilo_public.h"
40 
41 struct pipe_screen *
pipe_ilo_create_screen(int fd)42 pipe_ilo_create_screen(int fd)
43 {
44    struct intel_winsys *iws;
45    struct pipe_screen *screen;
46 
47    iws = intel_winsys_create_for_fd(fd);
48    if (!iws)
49       return NULL;
50 
51    screen = ilo_screen_create(iws);
52    return screen ? debug_screen_wrap(screen) : NULL;
53 }
54 
55 #else
56 
57 struct pipe_screen *
pipe_ilo_create_screen(int fd)58 pipe_ilo_create_screen(int fd)
59 {
60    fprintf(stderr, "ilo: driver missing\n");
61    return NULL;
62 }
63 
64 #endif
65 
66 #ifdef GALLIUM_NOUVEAU
67 #include "nouveau/drm/nouveau_drm_public.h"
68 
69 struct pipe_screen *
pipe_nouveau_create_screen(int fd)70 pipe_nouveau_create_screen(int fd)
71 {
72    struct pipe_screen *screen;
73 
74    screen = nouveau_drm_screen_create(fd);
75    return screen ? debug_screen_wrap(screen) : NULL;
76 }
77 
78 #else
79 
80 struct pipe_screen *
pipe_nouveau_create_screen(int fd)81 pipe_nouveau_create_screen(int fd)
82 {
83    fprintf(stderr, "nouveau: driver missing\n");
84    return NULL;
85 }
86 
87 #endif
88 
89 #ifdef GALLIUM_R300
90 #include "radeon/radeon_winsys.h"
91 #include "radeon/drm/radeon_drm_public.h"
92 #include "r300/r300_public.h"
93 
94 struct pipe_screen *
pipe_r300_create_screen(int fd)95 pipe_r300_create_screen(int fd)
96 {
97    struct radeon_winsys *rw;
98 
99    rw = radeon_drm_winsys_create(fd, r300_screen_create);
100    return rw ? debug_screen_wrap(rw->screen) : NULL;
101 }
102 
103 #else
104 
105 struct pipe_screen *
pipe_r300_create_screen(int fd)106 pipe_r300_create_screen(int fd)
107 {
108    fprintf(stderr, "r300: driver missing\n");
109    return NULL;
110 }
111 
112 #endif
113 
114 #ifdef GALLIUM_R600
115 #include "radeon/radeon_winsys.h"
116 #include "radeon/drm/radeon_drm_public.h"
117 #include "r600/r600_public.h"
118 
119 struct pipe_screen *
pipe_r600_create_screen(int fd)120 pipe_r600_create_screen(int fd)
121 {
122    struct radeon_winsys *rw;
123 
124    rw = radeon_drm_winsys_create(fd, r600_screen_create);
125    return rw ? debug_screen_wrap(rw->screen) : NULL;
126 }
127 
128 #else
129 
130 struct pipe_screen *
pipe_r600_create_screen(int fd)131 pipe_r600_create_screen(int fd)
132 {
133    fprintf(stderr, "r600: driver missing\n");
134    return NULL;
135 }
136 
137 #endif
138 
139 #ifdef GALLIUM_RADEONSI
140 #include "radeon/radeon_winsys.h"
141 #include "radeon/drm/radeon_drm_public.h"
142 #include "amdgpu/drm/amdgpu_public.h"
143 #include "radeonsi/si_public.h"
144 
145 struct pipe_screen *
pipe_radeonsi_create_screen(int fd)146 pipe_radeonsi_create_screen(int fd)
147 {
148    struct radeon_winsys *rw;
149 
150    /* First, try amdgpu. */
151    rw = amdgpu_winsys_create(fd, radeonsi_screen_create);
152 
153    if (!rw)
154       rw = radeon_drm_winsys_create(fd, radeonsi_screen_create);
155 
156    return rw ? debug_screen_wrap(rw->screen) : NULL;
157 }
158 
159 #else
160 
161 struct pipe_screen *
pipe_radeonsi_create_screen(int fd)162 pipe_radeonsi_create_screen(int fd)
163 {
164    fprintf(stderr, "radeonsi: driver missing\n");
165    return NULL;
166 }
167 
168 #endif
169 
170 #ifdef GALLIUM_VMWGFX
171 #include "svga/drm/svga_drm_public.h"
172 #include "svga/svga_public.h"
173 
174 struct pipe_screen *
pipe_vmwgfx_create_screen(int fd)175 pipe_vmwgfx_create_screen(int fd)
176 {
177    struct svga_winsys_screen *sws;
178    struct pipe_screen *screen;
179 
180    sws = svga_drm_winsys_screen_create(fd);
181    if (!sws)
182       return NULL;
183 
184    screen = svga_screen_create(sws);
185    return screen ? debug_screen_wrap(screen) : NULL;
186 }
187 
188 #else
189 
190 struct pipe_screen *
pipe_vmwgfx_create_screen(int fd)191 pipe_vmwgfx_create_screen(int fd)
192 {
193    fprintf(stderr, "svga: driver missing\n");
194    return NULL;
195 }
196 
197 #endif
198 
199 #ifdef GALLIUM_FREEDRENO
200 #include "freedreno/drm/freedreno_drm_public.h"
201 
202 struct pipe_screen *
pipe_freedreno_create_screen(int fd)203 pipe_freedreno_create_screen(int fd)
204 {
205    struct pipe_screen *screen;
206 
207    screen = fd_drm_screen_create(fd);
208    return screen ? debug_screen_wrap(screen) : NULL;
209 }
210 
211 #else
212 
213 struct pipe_screen *
pipe_freedreno_create_screen(int fd)214 pipe_freedreno_create_screen(int fd)
215 {
216    fprintf(stderr, "freedreno: driver missing\n");
217    return NULL;
218 }
219 
220 #endif
221 
222 #ifdef GALLIUM_VIRGL
223 #include "virgl/drm/virgl_drm_public.h"
224 #include "virgl/virgl_public.h"
225 
226 struct pipe_screen *
pipe_virgl_create_screen(int fd)227 pipe_virgl_create_screen(int fd)
228 {
229    struct pipe_screen *screen;
230 
231    screen = virgl_drm_screen_create(fd);
232    return screen ? debug_screen_wrap(screen) : NULL;
233 }
234 
235 #else
236 
237 struct pipe_screen *
pipe_virgl_create_screen(int fd)238 pipe_virgl_create_screen(int fd)
239 {
240    fprintf(stderr, "virgl: driver missing\n");
241    return NULL;
242 }
243 
244 #endif
245 
246 #ifdef GALLIUM_VC4
247 #include "vc4/drm/vc4_drm_public.h"
248 
249 struct pipe_screen *
pipe_vc4_create_screen(int fd)250 pipe_vc4_create_screen(int fd)
251 {
252    struct pipe_screen *screen;
253 
254    screen = vc4_drm_screen_create(fd);
255    return screen ? debug_screen_wrap(screen) : NULL;
256 }
257 
258 #else
259 
260 struct pipe_screen *
pipe_vc4_create_screen(int fd)261 pipe_vc4_create_screen(int fd)
262 {
263    fprintf(stderr, "vc4: driver missing\n");
264    return NULL;
265 }
266 
267 #endif
268 
269 #ifdef GALLIUM_ETNAVIV
270 #include "etnaviv/drm/etnaviv_drm_public.h"
271 
272 struct pipe_screen *
pipe_etna_create_screen(int fd)273 pipe_etna_create_screen(int fd)
274 {
275    struct pipe_screen *screen;
276 
277    screen = etna_drm_screen_create(fd);
278    return screen ? debug_screen_wrap(screen) : NULL;
279 }
280 
281 #else
282 
283 struct pipe_screen *
pipe_etna_create_screen(int fd)284 pipe_etna_create_screen(int fd)
285 {
286    fprintf(stderr, "etnaviv: driver missing\n");
287    return NULL;
288 }
289 
290 #endif
291 
292 #ifdef GALLIUM_IMX
293 #include "imx/drm/imx_drm_public.h"
294 
295 struct pipe_screen *
pipe_imx_drm_create_screen(int fd)296 pipe_imx_drm_create_screen(int fd)
297 {
298    struct pipe_screen *screen;
299 
300    screen = imx_drm_screen_create(fd);
301    return screen ? debug_screen_wrap(screen) : NULL;
302 }
303 
304 #else
305 
306 struct pipe_screen *
pipe_imx_drm_create_screen(int fd)307 pipe_imx_drm_create_screen(int fd)
308 {
309    fprintf(stderr, "imx-drm: driver missing\n");
310    return NULL;
311 }
312 
313 #endif
314 
315 
316 #endif /* DRM_HELPER_H */
317