[Mesa-dev] [PATCH 3/3] egl: Log (debug) native platform type

Benjamin Franzke benjaminfranzke at googlemail.com
Tue Aug 9 07:54:01 PDT 2011


Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
---
 src/egl/main/egldisplay.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 5421f5f..27399c3 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -60,6 +60,17 @@
 #include <sys/stat.h>
 #endif
 
+/* 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.
@@ -67,17 +78,6 @@
 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;
@@ -176,15 +176,22 @@ _EGLPlatformType
 _eglGetNativePlatform(EGLNativeDisplayType nativeDisplay)
 {
    _EGLPlatformType native_platform;
+   char *detection_method;
 
    native_platform = _eglGetNativePlatformFromEnv();
+   detection_method = "environment overwrite";
    if (native_platform == _EGL_INVALID_PLATFORM) {
       native_platform = _eglNativePlatformDetectNativeDisplay(nativeDisplay);
+      detection_method = "autodetected";
       if (native_platform == _EGL_INVALID_PLATFORM) {
          native_platform = _EGL_NATIVE_PLATFORM;
+         detection_method = "build-time configuration";
       }
    }
 
+   _eglLog(_EGL_DEBUG, "Native platform type: %s (%s)",
+           egl_platforms[native_platform].name, detection_method);
+
    return native_platform;
 }
 
-- 
1.7.3.4



More information about the mesa-dev mailing list