[Mesa-dev] [PATCH 2/3] egl: Dont cache native platform type as static local var

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


With new autodetection the type may change, and a local
static variable isnt sufficient as cache anymore.

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

diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index bd4fe19..5421f5f 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -175,14 +175,13 @@ _eglNativePlatformDetectNativeDisplay(EGLNativeDisplayType nativeDisplay)
 _EGLPlatformType
 _eglGetNativePlatform(EGLNativeDisplayType nativeDisplay)
 {
-   static _EGLPlatformType native_platform = _EGL_INVALID_PLATFORM;
+   _EGLPlatformType native_platform;
 
+   native_platform = _eglGetNativePlatformFromEnv();
    if (native_platform == _EGL_INVALID_PLATFORM) {
-      native_platform = _eglGetNativePlatformFromEnv();
+      native_platform = _eglNativePlatformDetectNativeDisplay(nativeDisplay);
       if (native_platform == _EGL_INVALID_PLATFORM) {
-         native_platform = _eglNativePlatformDetectNativeDisplay(nativeDisplay);
-         if (native_platform == _EGL_INVALID_PLATFORM)
-            native_platform = _EGL_NATIVE_PLATFORM;
+         native_platform = _EGL_NATIVE_PLATFORM;
       }
    }
 
-- 
1.7.3.4



More information about the mesa-dev mailing list