glamor_egl: Reject OpenGL < 2.1 early on
The Etnaviv driver on GC2000 reports desktop OpenGL 1.3 but also OpenGL ES 2.0. However, with the modesetting driver, GLES2 never gets a chance: [ 11233.393] Require OpenGL version 2.1 or later. [ 11233.393] (EE) modeset(0): Failed to initialize glamor at ScreenInit() time. [ 11233.393] (EE) Fatal server error: [ 11233.395] (EE) AddScreen/ScreenInit failed for driver 0 Let's reject old desktop GL early on, just like XWayland seems to do. This is perhaps a slightly bit more complicated that one would expect, since we need to call eglMakeCurrent() before we query the GL version. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
This commit is contained in:
parent
98bfee6a1b
commit
26004df63c
|
@ -999,6 +999,22 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
|
||||||
config_attribs);
|
config_attribs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (glamor_egl->context != EGL_NO_CONTEXT) {
|
||||||
|
if (!eglMakeCurrent(glamor_egl->display,
|
||||||
|
EGL_NO_SURFACE, EGL_NO_SURFACE, glamor_egl->context)) {
|
||||||
|
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
||||||
|
"Failed to make GL context current\n");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (epoxy_gl_version() < 21) {
|
||||||
|
xf86DrvMsg(scrn->scrnIndex, X_INFO,
|
||||||
|
"glamor: Ignoring GL < 2.1, falling back to GLES.\n");
|
||||||
|
eglDestroyContext(glamor_egl->display, glamor_egl->context);
|
||||||
|
glamor_egl->context = EGL_NO_CONTEXT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (glamor_egl->context == EGL_NO_CONTEXT) {
|
if (glamor_egl->context == EGL_NO_CONTEXT) {
|
||||||
static const EGLint config_attribs[] = {
|
static const EGLint config_attribs[] = {
|
||||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||||
|
@ -1019,18 +1035,19 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
|
||||||
glamor_egl->context = eglCreateContext(glamor_egl->display,
|
glamor_egl->context = eglCreateContext(glamor_egl->display,
|
||||||
egl_config, EGL_NO_CONTEXT,
|
egl_config, EGL_NO_CONTEXT,
|
||||||
config_attribs);
|
config_attribs);
|
||||||
}
|
|
||||||
if (glamor_egl->context == EGL_NO_CONTEXT) {
|
|
||||||
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
|
||||||
"glamor: Failed to create GL or GLES2 contexts\n");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!eglMakeCurrent(glamor_egl->display,
|
if (glamor_egl->context == EGL_NO_CONTEXT) {
|
||||||
EGL_NO_SURFACE, EGL_NO_SURFACE, glamor_egl->context)) {
|
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
||||||
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
"glamor: Failed to create GL or GLES2 contexts\n");
|
||||||
"Failed to make EGL context current\n");
|
goto error;
|
||||||
goto error;
|
}
|
||||||
|
|
||||||
|
if (!eglMakeCurrent(glamor_egl->display,
|
||||||
|
EGL_NO_SURFACE, EGL_NO_SURFACE, glamor_egl->context)) {
|
||||||
|
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
||||||
|
"Failed to make GLES2 context current\n");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = glGetString(GL_RENDERER);
|
renderer = glGetString(GL_RENDERER);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user