6010631e9a601661ebad1a1c17679299b1d6969a
[mesa.git] / src / gallium / auxiliary / target-helpers / drm_helper.h
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 #include "frontend/drm_driver.h"
8 #include "util/xmlpool.h"
9
10 #ifdef GALLIUM_I915
11 #include "i915/drm/i915_drm_public.h"
12 #include "i915/i915_public.h"
13
14 struct pipe_screen *
15 pipe_i915_create_screen(int fd, const struct pipe_screen_config *config)
16 {
17 struct i915_winsys *iws;
18 struct pipe_screen *screen;
19
20 iws = i915_drm_winsys_create(fd);
21 if (!iws)
22 return NULL;
23
24 screen = i915_screen_create(iws);
25 return screen ? debug_screen_wrap(screen) : NULL;
26 }
27
28 #else
29
30 struct pipe_screen *
31 pipe_i915_create_screen(int fd, const struct pipe_screen_config *config)
32 {
33 fprintf(stderr, "i915g: driver missing\n");
34 return NULL;
35 }
36
37 #endif
38
39 #ifdef GALLIUM_IRIS
40 #include "iris/drm/iris_drm_public.h"
41
42 struct pipe_screen *
43 pipe_iris_create_screen(int fd, const struct pipe_screen_config *config)
44 {
45 struct pipe_screen *screen;
46
47 screen = iris_drm_screen_create(fd, config);
48 return screen ? debug_screen_wrap(screen) : NULL;
49 }
50
51 const char *iris_driconf_xml =
52 #include "iris/iris_driinfo.h"
53 ;
54
55 #else
56
57 struct pipe_screen *
58 pipe_iris_create_screen(int fd, const struct pipe_screen_config *config)
59 {
60 fprintf(stderr, "iris: driver missing\n");
61 return NULL;
62 }
63
64 const char *iris_driconf_xml = NULL;
65
66 #endif
67
68 #ifdef GALLIUM_NOUVEAU
69 #include "nouveau/drm/nouveau_drm_public.h"
70
71 struct pipe_screen *
72 pipe_nouveau_create_screen(int fd, const struct pipe_screen_config *config)
73 {
74 struct pipe_screen *screen;
75
76 screen = nouveau_drm_screen_create(fd);
77 return screen ? debug_screen_wrap(screen) : NULL;
78 }
79
80 #else
81
82 struct pipe_screen *
83 pipe_nouveau_create_screen(int fd, const struct pipe_screen_config *config)
84 {
85 fprintf(stderr, "nouveau: driver missing\n");
86 return NULL;
87 }
88
89 #endif
90
91 #ifdef GALLIUM_KMSRO
92 #include "kmsro/drm/kmsro_drm_public.h"
93
94 struct pipe_screen *
95 pipe_kmsro_create_screen(int fd, const struct pipe_screen_config *config)
96 {
97 struct pipe_screen *screen;
98
99 screen = kmsro_drm_screen_create(fd, config);
100 return screen ? debug_screen_wrap(screen) : NULL;
101 }
102
103 #else
104
105 struct pipe_screen *
106 pipe_kmsro_create_screen(int fd, const struct pipe_screen_config *config)
107 {
108 return NULL;
109 }
110
111 #endif
112
113 #ifdef GALLIUM_R300
114 #include "radeon/radeon_winsys.h"
115 #include "radeon/drm/radeon_drm_public.h"
116 #include "r300/r300_public.h"
117
118 struct pipe_screen *
119 pipe_r300_create_screen(int fd, const struct pipe_screen_config *config)
120 {
121 struct radeon_winsys *rw;
122
123 rw = radeon_drm_winsys_create(fd, config, r300_screen_create);
124 return rw ? debug_screen_wrap(rw->screen) : NULL;
125 }
126
127 #else
128
129 struct pipe_screen *
130 pipe_r300_create_screen(int fd, const struct pipe_screen_config *config)
131 {
132 fprintf(stderr, "r300: driver missing\n");
133 return NULL;
134 }
135
136 #endif
137
138 #ifdef GALLIUM_R600
139 #include "radeon/radeon_winsys.h"
140 #include "radeon/drm/radeon_drm_public.h"
141 #include "r600/r600_public.h"
142
143 struct pipe_screen *
144 pipe_r600_create_screen(int fd, const struct pipe_screen_config *config)
145 {
146 struct radeon_winsys *rw;
147
148 rw = radeon_drm_winsys_create(fd, config, r600_screen_create);
149 return rw ? debug_screen_wrap(rw->screen) : NULL;
150 }
151
152 #else
153
154 struct pipe_screen *
155 pipe_r600_create_screen(int fd, const struct pipe_screen_config *config)
156 {
157 fprintf(stderr, "r600: driver missing\n");
158 return NULL;
159 }
160
161 #endif
162
163 #ifdef GALLIUM_RADEONSI
164 #include "radeonsi/si_public.h"
165
166 struct pipe_screen *
167 pipe_radeonsi_create_screen(int fd, const struct pipe_screen_config *config)
168 {
169 struct pipe_screen *screen = radeonsi_screen_create(fd, config);
170
171 return screen ? debug_screen_wrap(screen) : NULL;
172 }
173
174 const char *radeonsi_driconf_xml =
175 #include "radeonsi/si_driinfo.h"
176 ;
177
178 #else
179
180 struct pipe_screen *
181 pipe_radeonsi_create_screen(int fd, const struct pipe_screen_config *config)
182 {
183 fprintf(stderr, "radeonsi: driver missing\n");
184 return NULL;
185 }
186
187 const char *radeonsi_driconf_xml = NULL;
188
189 #endif
190
191 #ifdef GALLIUM_VMWGFX
192 #include "svga/drm/svga_drm_public.h"
193 #include "svga/svga_public.h"
194
195 struct pipe_screen *
196 pipe_vmwgfx_create_screen(int fd, const struct pipe_screen_config *config)
197 {
198 struct svga_winsys_screen *sws;
199 struct pipe_screen *screen;
200
201 sws = svga_drm_winsys_screen_create(fd);
202 if (!sws)
203 return NULL;
204
205 screen = svga_screen_create(sws);
206 return screen ? debug_screen_wrap(screen) : NULL;
207 }
208
209 #else
210
211 struct pipe_screen *
212 pipe_vmwgfx_create_screen(int fd, const struct pipe_screen_config *config)
213 {
214 fprintf(stderr, "svga: driver missing\n");
215 return NULL;
216 }
217
218 #endif
219
220 #ifdef GALLIUM_FREEDRENO
221 #include "freedreno/drm/freedreno_drm_public.h"
222
223 struct pipe_screen *
224 pipe_freedreno_create_screen(int fd, const struct pipe_screen_config *config)
225 {
226 struct pipe_screen *screen;
227
228 screen = fd_drm_screen_create(fd, NULL);
229 return screen ? debug_screen_wrap(screen) : NULL;
230 }
231
232 #else
233
234 struct pipe_screen *
235 pipe_freedreno_create_screen(int fd, const struct pipe_screen_config *config)
236 {
237 fprintf(stderr, "freedreno: driver missing\n");
238 return NULL;
239 }
240
241 #endif
242
243 #ifdef GALLIUM_VIRGL
244 #include "virgl/drm/virgl_drm_public.h"
245 #include "virgl/virgl_public.h"
246
247 struct pipe_screen *
248 pipe_virgl_create_screen(int fd, const struct pipe_screen_config *config)
249 {
250 struct pipe_screen *screen;
251
252 screen = virgl_drm_screen_create(fd, config);
253 return screen ? debug_screen_wrap(screen) : NULL;
254 }
255
256 const char *virgl_driconf_xml =
257 #include "virgl/virgl_driinfo.h"
258 ;
259
260 #else
261
262 struct pipe_screen *
263 pipe_virgl_create_screen(int fd, const struct pipe_screen_config *config)
264 {
265 fprintf(stderr, "virgl: driver missing\n");
266 return NULL;
267 }
268
269 const char *virgl_driconf_xml = NULL;
270
271 #endif
272
273 #ifdef GALLIUM_VC4
274 #include "vc4/drm/vc4_drm_public.h"
275
276 struct pipe_screen *
277 pipe_vc4_create_screen(int fd, const struct pipe_screen_config *config)
278 {
279 struct pipe_screen *screen;
280
281 screen = vc4_drm_screen_create(fd, config);
282 return screen ? debug_screen_wrap(screen) : NULL;
283 }
284 #else
285
286 struct pipe_screen *
287 pipe_vc4_create_screen(int fd, const struct pipe_screen_config *config)
288 {
289 fprintf(stderr, "vc4: driver missing\n");
290 return NULL;
291 }
292
293 #endif
294
295 #ifdef GALLIUM_V3D
296 #include "v3d/drm/v3d_drm_public.h"
297
298 struct pipe_screen *
299 pipe_v3d_create_screen(int fd, const struct pipe_screen_config *config)
300 {
301 struct pipe_screen *screen;
302
303 screen = v3d_drm_screen_create(fd, config);
304 return screen ? debug_screen_wrap(screen) : NULL;
305 }
306
307 const char *v3d_driconf_xml =
308 #include "v3d/v3d_driinfo.h"
309 ;
310
311 #else
312
313 struct pipe_screen *
314 pipe_v3d_create_screen(int fd, const struct pipe_screen_config *config)
315 {
316 fprintf(stderr, "v3d: driver missing\n");
317 return NULL;
318 }
319
320 const char *v3d_driconf_xml = NULL;
321
322 #endif
323
324 #ifdef GALLIUM_PANFROST
325 #include "panfrost/drm/panfrost_drm_public.h"
326
327 struct pipe_screen *
328 pipe_panfrost_create_screen(int fd, const struct pipe_screen_config *config)
329 {
330 struct pipe_screen *screen;
331
332 screen = panfrost_drm_screen_create(fd);
333 return screen ? debug_screen_wrap(screen) : NULL;
334 }
335
336 #else
337
338 struct pipe_screen *
339 pipe_panfrost_create_screen(int fd, const struct pipe_screen_config *config)
340 {
341 fprintf(stderr, "panfrost: driver missing\n");
342 return NULL;
343 }
344
345 #endif
346
347 #ifdef GALLIUM_ETNAVIV
348 #include "etnaviv/drm/etnaviv_drm_public.h"
349
350 struct pipe_screen *
351 pipe_etna_create_screen(int fd, const struct pipe_screen_config *config)
352 {
353 struct pipe_screen *screen;
354
355 screen = etna_drm_screen_create(fd);
356 return screen ? debug_screen_wrap(screen) : NULL;
357 }
358
359 #else
360
361 struct pipe_screen *
362 pipe_etna_create_screen(int fd, const struct pipe_screen_config *config)
363 {
364 fprintf(stderr, "etnaviv: driver missing\n");
365 return NULL;
366 }
367
368 #endif
369
370 #ifdef GALLIUM_TEGRA
371 #include "tegra/drm/tegra_drm_public.h"
372
373 struct pipe_screen *
374 pipe_tegra_create_screen(int fd, const struct pipe_screen_config *config)
375 {
376 struct pipe_screen *screen;
377
378 screen = tegra_drm_screen_create(fd);
379
380 return screen ? debug_screen_wrap(screen) : NULL;
381 }
382
383 #else
384
385 struct pipe_screen *
386 pipe_tegra_create_screen(int fd, const struct pipe_screen_config *config)
387 {
388 fprintf(stderr, "tegra: driver missing\n");
389 return NULL;
390 }
391
392 #endif
393
394 #ifdef GALLIUM_LIMA
395 #include "lima/drm/lima_drm_public.h"
396
397 struct pipe_screen *
398 pipe_lima_create_screen(int fd, const struct pipe_screen_config *config)
399 {
400 struct pipe_screen *screen;
401
402 screen = lima_drm_screen_create(fd);
403 return screen ? debug_screen_wrap(screen) : NULL;
404 }
405
406 #else
407
408 struct pipe_screen *
409 pipe_lima_create_screen(int fd, const struct pipe_screen_config *config)
410 {
411 fprintf(stderr, "lima: driver missing\n");
412 return NULL;
413 }
414
415 #endif
416
417 #ifdef GALLIUM_ZINK
418 #include "zink/zink_public.h"
419
420 struct pipe_screen *
421 pipe_zink_create_screen(int fd, const struct pipe_screen_config *config)
422 {
423 struct pipe_screen *screen;
424 screen = zink_drm_create_screen(fd);
425 return screen ? debug_screen_wrap(screen) : NULL;
426 }
427
428 #else
429
430 struct pipe_screen *
431 pipe_zink_create_screen(int fd, const struct pipe_screen_config *config)
432 {
433 fprintf(stderr, "zink: driver missing\n");
434 return NULL;
435 }
436
437 #endif
438
439 #endif /* DRM_HELPER_H */