xwayland: Fall back to GLES2 if we don't get at least GL 2.1 in glamor

Some particularly unfortunate hardware (Intel gen3, mostly) will give
you GLES2 but not GL 2.1. Fall back to GLES2 for such cases so you still
get accelerated GLX.
This commit is contained in:
Adam Jackson 2019-10-30 11:20:40 -04:00 committed by Adam Jackson
parent 741bd73429
commit dabc7d8bf2
1 changed files with 15 additions and 0 deletions

View File

@ -948,6 +948,21 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
xwl_screen->egl_display, NULL, EGL_NO_CONTEXT, NULL);
}
/* glamor needs either big-GL 2.1 or GLES2 */
if (xwl_screen->egl_context && epoxy_gl_version() < 21) {
const EGLint gles_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION,
2,
EGL_NONE,
};
eglDestroyContext(xwl_screen->egl_display, xwl_screen->egl_context);
eglBindAPI(EGL_OPENGL_ES_API);
xwl_screen->egl_context = eglCreateContext(xwl_screen->egl_display,
NULL, EGL_NO_CONTEXT,
gles_attribs);
}
if (xwl_screen->egl_context == EGL_NO_CONTEXT) {
ErrorF("Failed to create EGL context\n");
goto error;