summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Franzke <[email protected]>2011-08-09 16:16:33 +0200
committerBenjamin Franzke <[email protected]>2011-08-15 09:42:16 +0200
commit2e71c7d4ffa439dace639bd9c66174544dcd02d7 (patch)
tree2c3abb7a0c1e32db29b6df1164868bfe13f81008
parent85fe9484945cb57ffd49df248b0e5057eba6af04 (diff)
egl: Log (debug) native platform type
Reviewed-by: Kristian Høgsberg <[email protected]>
-rw-r--r--src/egl/main/egldisplay.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 2849dd96c64..512ad503f35 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -62,22 +62,26 @@
/**
+ * Map --with-egl-platforms names to platform types.
+ */
+static const struct {
+ _EGLPlatformType platform;
+ const char *name;
+} egl_platforms[_EGL_NUM_PLATFORMS] = {
+ { _EGL_PLATFORM_WINDOWS, "gdi" },
+ { _EGL_PLATFORM_X11, "x11" },
+ { _EGL_PLATFORM_WAYLAND, "wayland" },
+ { _EGL_PLATFORM_DRM, "drm" },
+ { _EGL_PLATFORM_FBDEV, "fbdev" }
+};
+
+
+/**
* Return the native platform by parsing EGL_PLATFORM.
*/
static _EGLPlatformType
_eglGetNativePlatformFromEnv(void)
{
- /* map --with-egl-platforms names to platform types */
- static const struct {
- _EGLPlatformType platform;
- const char *name;
- } egl_platforms[_EGL_NUM_PLATFORMS] = {
- { _EGL_PLATFORM_WINDOWS, "gdi" },
- { _EGL_PLATFORM_X11, "x11" },
- { _EGL_PLATFORM_WAYLAND, "wayland" },
- { _EGL_PLATFORM_DRM, "drm" },
- { _EGL_PLATFORM_FBDEV, "fbdev" }
- };
_EGLPlatformType plat = _EGL_INVALID_PLATFORM;
const char *plat_name;
EGLint i;
@@ -181,16 +185,25 @@ _EGLPlatformType
_eglGetNativePlatform(EGLNativeDisplayType nativeDisplay)
{
static _EGLPlatformType native_platform = _EGL_INVALID_PLATFORM;
+ char *detection_method = NULL;
if (native_platform == _EGL_INVALID_PLATFORM) {
native_platform = _eglGetNativePlatformFromEnv();
+ detection_method = "environment overwrite";
if (native_platform == _EGL_INVALID_PLATFORM) {
native_platform = _eglNativePlatformDetectNativeDisplay(nativeDisplay);
- if (native_platform == _EGL_INVALID_PLATFORM)
+ detection_method = "autodetected";
+ if (native_platform == _EGL_INVALID_PLATFORM) {
native_platform = _EGL_NATIVE_PLATFORM;
+ detection_method = "build-time configuration";
+ }
}
}
+ if (detection_method != NULL)
+ _eglLog(_EGL_DEBUG, "Native platform type: %s (%s)",
+ egl_platforms[native_platform].name, detection_method);
+
return native_platform;
}