egl/display: only detect the platform once
My refactor missed the fact that `native_platform` is static.
Add the proper guard around the detection code, as it might not be
necessary, and only print the debug message when a detection was
actually performed.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101252
Fixes: 7adb9b0948
("egl/display: remove unnecessary code and
make it easier to read")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
parent
9d81ab7376
commit
4ca9ae587c
|
@ -180,8 +180,10 @@ _eglNativePlatformDetectNativeDisplay(void *nativeDisplay)
|
||||||
_EGLPlatformType
|
_EGLPlatformType
|
||||||
_eglGetNativePlatform(void *nativeDisplay)
|
_eglGetNativePlatform(void *nativeDisplay)
|
||||||
{
|
{
|
||||||
static _EGLPlatformType native_platform;
|
static _EGLPlatformType native_platform = _EGL_INVALID_PLATFORM;
|
||||||
char *detection_method;
|
|
||||||
|
if (native_platform == _EGL_INVALID_PLATFORM) {
|
||||||
|
const char *detection_method;
|
||||||
|
|
||||||
native_platform = _eglGetNativePlatformFromEnv();
|
native_platform = _eglGetNativePlatformFromEnv();
|
||||||
detection_method = "environment overwrite";
|
detection_method = "environment overwrite";
|
||||||
|
@ -198,6 +200,7 @@ _eglGetNativePlatform(void *nativeDisplay)
|
||||||
|
|
||||||
_eglLog(_EGL_DEBUG, "Native platform type: %s (%s)",
|
_eglLog(_EGL_DEBUG, "Native platform type: %s (%s)",
|
||||||
egl_platforms[native_platform].name, detection_method);
|
egl_platforms[native_platform].name, detection_method);
|
||||||
|
}
|
||||||
|
|
||||||
return native_platform;
|
return native_platform;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue