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