Signed-off-by: Kai Guo <[email protected]>
Signed-off-by: Jammy Zhou <[email protected]>
---
glamor/glamor_egl.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 113450c..b230e39 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -800,8 +800,32 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
NULL, EGL_NO_CONTEXT,
config_attribs);
if (glamor_egl->context == EGL_NO_CONTEXT) {
- xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create EGL context\n");
- return FALSE;
+ /* fallback to select a EGLConfig explicitly */
+ EGLint attr[] = {
+ EGL_RENDERABLE_TYPE,
+#ifdef GLAMOR_GLES2
+ EGL_OPENGL_ES2_BIT,
+#else
+ EGL_OPENGL_BIT,
+#endif
+ EGL_NONE
+ };
+
+ EGLConfig config;
+ EGLint n;
+ if (!eglChooseConfig(glamor_egl->display, attr, &config, 1, &n)
+ || (n != 1)) {
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to choose EGL
config\n");
+ return FALSE;
+ }
+
+ glamor_egl->context = eglCreateContext(glamor_egl->display,
+ config, EGL_NO_CONTEXT,
+ config_attribs);
+ if (glamor_egl->context == EGL_NO_CONTEXT) {
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create EGL
context\n");
+ return FALSE;
+ }
}
if (!eglMakeCurrent(glamor_egl->display,
--
1.9.1
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel