We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4349

Summary: [patch] SDL_CreateWindow fails with KMS/DRM after upgrading Mesa to 18.2.3
Product: SDL Reporter: Rainer Sabelka <saba>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86_64   
OS: Linux   
Attachments: fix eglChooseConfig(), ignore all configuartions without an matching EGL_NATIVE_VISUAL_ID"

Description Rainer Sabelka 2018-10-31 19:41:47 UTC
Created attachment 3429 [details]
fix eglChooseConfig(), ignore all configuartions without an matching EGL_NATIVE_VISUAL_ID"

After I did an upgrade of my arch Linux installation (resulting in an update of Mesa to version 18.2.3), all my SDL2 applications which use the KMS/DRM driver stopped working.
Reason: Creating a Window with SDL_CreateWindow failed because the call to EGL
eglCreateWindowSurface() returns an error "EGL_BAD_MATCH".
After investigating with the debugger I figured, that the configuration, which has been selected from the output of eglChooseConfig(), has an "EGL_NATIVE_VISUAL_ID" which does not match the "format" of the underlying gbm surface.

The attached patch fixes the problem. It does so, by mimicking Weston's behavior.
All configurations returned from eglChooseConfig() which have an visual_id different from the gbm format are discarded, and only from the remaining ones the "best" match is selected.
Comment 1 Sam Lantinga 2018-10-31 22:17:09 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/cfc65d4d49ae