Bug 69071

Summary: _eglGetNativePlatform should not fall back to build-time configuration
Product: Mesa Reporter: Guillaume Melquiond <guillaume.melquiond>
Component: EGLAssignee: mesa-dev
Status: RESOLVED MOVED QA Contact:
Severity: minor    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Guillaume Melquiond 2013-09-07 14:57:58 UTC
In src/egl/main/egldisplay.c, function _eglGetNativePlatform looks at the content of nativeDisplay. If this content does not match any of the supported platforms, it returns one of the platforms selected at configure time (the first one?).

As a consequence, if Mesa is configured without X11 support for EGL and you try to run an EGL application under X, nativeDisplay contains the value returned by XOpenDisplay; then _eglNativePlatformDetectNativeDisplay returns _EGL_INVALID_PLATFORM; finally _eglGetNativePlatform falls back to _EGL_PLATFORM_WAYLAND (for instance). Mesa ends up crashing in src/egl/drivers/dri2/platform_wayland.c because dri2_dpy->wl_dpy does not point to a wl_display structure.

Note that _eglNativePlatformDetectNativeDisplay correctly infers that the platform cannot be Wayland (since nativeDisplay does not point to a Wayland structure), still _eglGetNativePlatform falls back to it. Platform types ruled out by _eglNativePlatformDetectNativeDisplay should never be returned by _eglGetNativePlatform.
Comment 1 GitLab Migration User 2019-09-18 18:07:10 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/151.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.