[client] egl: fallback when EGL_RENDER_BUFFER fails

This allows the client to work when the OpenGL implementation fails if
EGL_RENDER_BUFFER is passed, printing a warning. This should fix issues
with Nvidia proprietary drivers on Wayland.
This commit is contained in:
Quantum 2021-10-18 22:32:58 -04:00 committed by Geoffrey McRae
parent 9ddd260b22
commit 2858ad3f7e

View File

@ -712,10 +712,19 @@ static bool egl_renderStartup(LG_Renderer * renderer, bool useDMA)
this->surface = eglCreateWindowSurface(this->display, this->configs, this->nativeWind, surfattr); this->surface = eglCreateWindowSurface(this->display, this->configs, this->nativeWind, surfattr);
if (this->surface == EGL_NO_SURFACE) if (this->surface == EGL_NO_SURFACE)
{
// On Nvidia proprietary drivers on Wayland, specifying EGL_RENDER_BUFFER can cause
// window creation to fail, so we try again without it.
this->surface = eglCreateWindowSurface(this->display, this->configs, this->nativeWind, NULL);
if (this->surface == EGL_NO_SURFACE)
{ {
DEBUG_ERROR("Failed to create EGL surface (eglError: 0x%x)", eglGetError()); DEBUG_ERROR("Failed to create EGL surface (eglError: 0x%x)", eglGetError());
return false; return false;
} }
else
DEBUG_WARN("EGL surface creation with EGL_RENDER_BUFFER failed, "
"egl:doubleBuffer setting may not be respected");
}
const char * client_exts = eglQueryString(this->display, EGL_EXTENSIONS); const char * client_exts = eglQueryString(this->display, EGL_EXTENSIONS);
bool debugContext = option_get_bool("egl", "debug"); bool debugContext = option_get_bool("egl", "debug");