diff options
Diffstat (limited to 'src/gallium/state_trackers/egl/common')
-rw-r--r-- | src/gallium/state_trackers/egl/common/egl_g3d.c | 48 | ||||
-rw-r--r-- | src/gallium/state_trackers/egl/common/egl_g3d.h | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/egl/common/native.h | 11 |
3 files changed, 53 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 6b54ee365c..36354dd42e 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -66,14 +66,50 @@ egl_g3d_init_st(_EGLDriver *drv) * Get the native platform. */ static const struct native_platform * -egl_g3d_get_platform(_EGLDriver *drv) +egl_g3d_get_platform(_EGLDriver *drv, _EGLPlatformType plat) { struct egl_g3d_driver *gdrv = egl_g3d_driver(drv); - if (!gdrv->platform) - gdrv->platform = native_get_platform(); + if (!gdrv->platforms[plat]) { + const char *plat_name = NULL; + const struct native_platform *nplat = NULL; - return gdrv->platform; + switch (plat) { + case _EGL_PLATFORM_WINDOWS: + plat_name = "Windows"; +#ifdef HAVE_GDI_BACKEND + nplat = native_get_gdi_platform(); +#endif + break; + case _EGL_PLATFORM_X11: + plat_name = "X11"; +#ifdef HAVE_X11_BACKEND + nplat = native_get_x11_platform(); +#endif + break; + case _EGL_PLATFORM_DRM: + plat_name = "DRM"; +#ifdef HAVE_KMS_BACKEND + nplat = native_get_kms_platform(); +#endif + break; + case _EGL_PLATFORM_FBDEV: + plat_name = "FBDEV"; +#ifdef HAVE_FBDEV_BACKEND + nplat = native_get_fbdev_platform(); +#endif + break; + default: + break; + } + + if (!nplat) + _eglLog(_EGL_WARNING, "unsupported platform %s", plat_name); + + gdrv->platforms[plat] = nplat; + } + + return gdrv->platforms[plat]; } /** @@ -88,7 +124,7 @@ egl_g3d_get_probe_result(_EGLDriver *drv, _EGLDisplay *dpy) struct native_probe *nprobe; const struct native_platform *nplat; - nplat = egl_g3d_get_platform(drv); + nplat = egl_g3d_get_platform(drv, dpy->Platform); if (!nplat || !nplat->create_probe) return NATIVE_PROBE_UNKNOWN; @@ -484,7 +520,7 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy, /* the probe object is unlikely to be needed again */ egl_g3d_destroy_probe(drv, dpy); - nplat = egl_g3d_get_platform(drv); + nplat = egl_g3d_get_platform(drv, dpy->Platform); if (!nplat) return EGL_FALSE; diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.h b/src/gallium/state_trackers/egl/common/egl_g3d.h index 26043169ff..a498dcf6f6 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.h +++ b/src/gallium/state_trackers/egl/common/egl_g3d.h @@ -47,7 +47,7 @@ struct egl_g3d_driver { struct st_api *stapis[ST_API_COUNT]; EGLint api_mask; - const struct native_platform *platform; + const struct native_platform *platforms[_EGL_NUM_PLATFORMS]; EGLint probe_key; }; diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h index 941adfc03f..c4d23bf541 100644 --- a/src/gallium/state_trackers/egl/common/native.h +++ b/src/gallium/state_trackers/egl/common/native.h @@ -229,6 +229,15 @@ struct native_platform { }; const struct native_platform * -native_get_platform(void); +native_get_gdi_platform(void); + +const struct native_platform * +native_get_x11_platform(void); + +const struct native_platform * +native_get_kms_platform(void); + +const struct native_platform * +native_get_fbdev_platform(void); #endif /* _NATIVE_H_ */ |