[PATCH 8/8] xwayland: add support for use core profile for glamor.

Dave Airlie airlied at gmail.com
Mon Jan 18 16:56:56 PST 2016


From: Dave Airlie <airlied at redhat.com>

This adds support to Xwayland to try and use OpenGL core
profile for glamor first.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 hw/xwayland/xwayland-glamor.c | 22 +++++++++++++++++++++-
 hw/xwayland/xwayland.h        |  1 +
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index c357217..9655079 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -270,6 +270,15 @@ xwl_drm_init_egl(struct xwl_screen *xwl_screen)
 {
     EGLint major, minor;
     const char *version;
+    static const EGLint config_attribs_core[] = {
+        EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR,
+        EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
+        EGL_CONTEXT_MAJOR_VERSION_KHR,
+        3,
+        EGL_CONTEXT_MINOR_VERSION_KHR,
+        3,
+        EGL_NONE
+    };
 
     if (xwl_screen->egl_display)
         return;
@@ -297,8 +306,15 @@ xwl_drm_init_egl(struct xwl_screen *xwl_screen)
     version = eglQueryString(xwl_screen->egl_display, EGL_VERSION);
     ErrorF("glamor: EGL version %s:\n", version);
 
+    xwl_screen->glamor_uses_core_profile = FALSE;
     xwl_screen->egl_context = eglCreateContext(xwl_screen->egl_display,
-                                               NULL, EGL_NO_CONTEXT, NULL);
+                                               NULL, EGL_NO_CONTEXT, config_attribs_core);
+    if (!xwl_screen->egl_context)
+        xwl_screen->egl_context = eglCreateContext(xwl_screen->egl_display,
+                                                   NULL, EGL_NO_CONTEXT, NULL);
+    else
+        xwl_screen->glamor_uses_core_profile = TRUE;
+
     if (xwl_screen->egl_context == EGL_NO_CONTEXT) {
         ErrorF("Failed to create EGL context\n");
         return;
@@ -534,12 +550,16 @@ Bool
 xwl_glamor_init(struct xwl_screen *xwl_screen)
 {
     ScreenPtr screen = xwl_screen->screen;
+    int flags = GLAMOR_USE_EGL_SCREEN;
 
     if (xwl_screen->egl_context == EGL_NO_CONTEXT) {
         ErrorF("Disabling glamor and dri3, EGL setup failed\n");
         return FALSE;
     }
 
+    if (xwl_screen->glamor_uses_core_profile)
+        flags |= GLAMOR_USE_CORE_PROFILE;
+
     if (!glamor_init(xwl_screen->screen, GLAMOR_USE_EGL_SCREEN)) {
         ErrorF("Failed to initialize glamor\n");
         return FALSE;
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index a7d7119..52228a9 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -92,6 +92,7 @@ struct xwl_screen {
     void *egl_display, *egl_context;
     struct gbm_device *gbm;
     struct glamor_context *glamor_ctx;
+    Bool glamor_uses_core_profile;
 };
 
 struct xwl_window {
-- 
2.4.3



More information about the xorg-devel mailing list