Skip to content

egl/x11, egl/xcb: match EGL config to X visual

Jeffrey Knockel requested to merge jeffk/vlc:egl-match-visual into master

Select an EGL config by matching it to the visual of our window.

Previously we unconditionally chose the first EGL config returned by eglChooseConfig(). Due to the way that configs are sorted (by color depth), the first EGL config typically matched the same visual of our window (which is the same depth as the root window) and so usually worked. However, some X servers offer visuals with higher color depth than the root window. On such servers, the first EGL config won't match our window's visual and the resulting picture will be misrendered.

Note that this change is consistent with what we are already doing in our GLX video output.

In terms of organization, I wasn't sure if I should have the #ifdef's inline, or if I should try to separate out this code to separate functions like is done with other platform-specific code, e.g., a ChooseConfig() function depending on your platform. For now I've chosen the former approach but can update with the latter.

Note that these changes only affect behavior on the X11 and XCB EGL implementations.

Merge request reports