xwayland: fix GL version check for GLES only devices
We currently bail out early for GLES only devices, and call
epoxy_gl_version() too early for GLES only that will make GLES only
devices return NULL for glGetString(GL_RENDERER).
Let's also add a check to see if we need to recreate the context to
avoid pointless warnings for GLES only devices as suggested by
Olivier Fourdan <ofourdan@redhat.com>.
Fixes: a506b4ec
- xwayland: make context current to check GL version
Signed-off-by: Tony Lindgren <tony@atomide.com>
This commit is contained in:
parent
5d73a8b59e
commit
65673b02ef
|
@ -973,30 +973,32 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
|
|||
xwl_screen->egl_display, NULL, EGL_NO_CONTEXT, NULL);
|
||||
}
|
||||
|
||||
if (xwl_screen->egl_context == EGL_NO_CONTEXT) {
|
||||
ErrorF("Failed to create EGL context with GL\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!eglMakeCurrent(xwl_screen->egl_display,
|
||||
if (xwl_screen->egl_context != EGL_NO_CONTEXT &&
|
||||
!eglMakeCurrent(xwl_screen->egl_display,
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
xwl_screen->egl_context)) {
|
||||
ErrorF("Failed to make EGL context current with GL\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* glamor needs either big-GL 2.1 or GLES2 */
|
||||
if (epoxy_gl_version() < 21) {
|
||||
/* glamor needs either big-GL 2.1 or GLES2. Note that we can't rely only
|
||||
* on calling epoxy_gl_version() here if eglBindAPI(EGL_OPENGL_API) above
|
||||
* failed. Calling epoxy_gl_version() here makes GLES only devices fail
|
||||
* below
|
||||
*/
|
||||
if (xwl_screen->egl_context == EGL_NO_CONTEXT || epoxy_gl_version() < 21) {
|
||||
const EGLint gles_attribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION,
|
||||
2,
|
||||
EGL_NONE,
|
||||
};
|
||||
|
||||
/* Recreate the context with GLES2 instead */
|
||||
eglMakeCurrent(xwl_screen->egl_display,EGL_NO_SURFACE,
|
||||
EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(xwl_screen->egl_display, xwl_screen->egl_context);
|
||||
if (xwl_screen->egl_context != EGL_NO_CONTEXT) {
|
||||
/* Recreate the context with GLES2 instead */
|
||||
eglMakeCurrent(xwl_screen->egl_display,EGL_NO_SURFACE,
|
||||
EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(xwl_screen->egl_display, xwl_screen->egl_context);
|
||||
}
|
||||
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
xwl_screen->egl_context = eglCreateContext(xwl_screen->egl_display,
|
||||
|
|
Loading…
Reference in New Issue