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);
|
xwl_screen->egl_display, NULL, EGL_NO_CONTEXT, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xwl_screen->egl_context == EGL_NO_CONTEXT) {
|
if (xwl_screen->egl_context != EGL_NO_CONTEXT &&
|
||||||
ErrorF("Failed to create EGL context with GL\n");
|
!eglMakeCurrent(xwl_screen->egl_display,
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!eglMakeCurrent(xwl_screen->egl_display,
|
|
||||||
EGL_NO_SURFACE, EGL_NO_SURFACE,
|
EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||||
xwl_screen->egl_context)) {
|
xwl_screen->egl_context)) {
|
||||||
ErrorF("Failed to make EGL context current with GL\n");
|
ErrorF("Failed to make EGL context current with GL\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* glamor needs either big-GL 2.1 or GLES2 */
|
/* glamor needs either big-GL 2.1 or GLES2. Note that we can't rely only
|
||||||
if (epoxy_gl_version() < 21) {
|
* 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[] = {
|
const EGLint gles_attribs[] = {
|
||||||
EGL_CONTEXT_CLIENT_VERSION,
|
EGL_CONTEXT_CLIENT_VERSION,
|
||||||
2,
|
2,
|
||||||
EGL_NONE,
|
EGL_NONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Recreate the context with GLES2 instead */
|
if (xwl_screen->egl_context != EGL_NO_CONTEXT) {
|
||||||
eglMakeCurrent(xwl_screen->egl_display,EGL_NO_SURFACE,
|
/* Recreate the context with GLES2 instead */
|
||||||
EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
eglMakeCurrent(xwl_screen->egl_display,EGL_NO_SURFACE,
|
||||||
eglDestroyContext(xwl_screen->egl_display, xwl_screen->egl_context);
|
EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
eglDestroyContext(xwl_screen->egl_display, xwl_screen->egl_context);
|
||||||
|
}
|
||||||
|
|
||||||
eglBindAPI(EGL_OPENGL_ES_API);
|
eglBindAPI(EGL_OPENGL_ES_API);
|
||||||
xwl_screen->egl_context = eglCreateContext(xwl_screen->egl_display,
|
xwl_screen->egl_context = eglCreateContext(xwl_screen->egl_display,
|
||||||
|
|
Loading…
Reference in New Issue