From da21f02eb91f13484542829d9e4855715108521a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 1 Sep 2016 11:04:22 +0800 Subject: [PATCH] MetaRendererNative: Always use eglGetPlatformDisplay Drivers may be bad at guessing what is passed to eglGetDisplay, ending up return non-functioning EGLDisplay's. Using eglGetPlatformDisplay avoids this issue. https://bugzilla.gnome.org/show_bug.cgi?id=773629 --- src/backends/meta-egl.c | 18 +----------------- src/backends/meta-egl.h | 4 ---- src/backends/native/meta-renderer-native.c | 15 +++++++++++++-- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/backends/meta-egl.c b/src/backends/meta-egl.c index d605a7956..579c2b23f 100644 --- a/src/backends/meta-egl.c +++ b/src/backends/meta-egl.c @@ -24,6 +24,7 @@ #include "config.h" +#include "backends/meta-backend-private.h" #include "backends/meta-egl.h" #include "meta/util.h" @@ -183,23 +184,6 @@ meta_egl_has_extensions (MetaEgl *egl, return has_extensions; } -EGLDisplay -meta_egl_get_display (MetaEgl *egl, - EGLNativeDisplayType display_id, - GError **error) -{ - EGLDisplay display; - - display = eglGetDisplay (display_id); - if (display == EGL_NO_DISPLAY) - { - set_egl_error (error); - return EGL_NO_DISPLAY; - } - - return display; -} - gboolean meta_egl_choose_config (MetaEgl *egl, EGLDisplay display, diff --git a/src/backends/meta-egl.h b/src/backends/meta-egl.h index ac176d573..d35456980 100644 --- a/src/backends/meta-egl.h +++ b/src/backends/meta-egl.h @@ -38,10 +38,6 @@ gboolean meta_egl_has_extensions (MetaEgl *egl, char *first_extension, ...); -EGLDisplay meta_egl_get_display (MetaEgl *egl, - EGLNativeDisplayType display_id, - GError **error); - gboolean meta_egl_choose_config (MetaEgl *egl, EGLDisplay display, const EGLint *attrib_list, diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index 2f0818f39..e2924319e 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -1258,6 +1258,16 @@ init_gbm (MetaRendererNative *renderer_native, struct gbm_device *gbm_device; EGLDisplay egl_display; + if (!meta_egl_has_extensions (egl, EGL_NO_DISPLAY, NULL, + "EGL_MESA_platform_gbm", + NULL)) + { + g_set_error (error, G_IO_ERROR, + G_IO_ERROR_FAILED, + "Missing extension for GBM renderer: EGL_KHR_platform_gbm"); + return FALSE; + } + gbm_device = gbm_create_device (renderer_native->kms_fd); if (!gbm_device) { @@ -1267,8 +1277,9 @@ init_gbm (MetaRendererNative *renderer_native, return FALSE; } - egl_display = meta_egl_get_display (egl, (EGLNativeDisplayType) gbm_device, - error); + egl_display = meta_egl_get_platform_display (egl, + EGL_PLATFORM_GBM_KHR, + gbm_device, NULL, error); if (egl_display == EGL_NO_DISPLAY) { gbm_device_destroy (gbm_device);