From 69d350d259725d62de119ea307ec8aba809a4544 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 11 Oct 2016 14:06:11 -0400 Subject: [PATCH] Prefer eglGetPlatformDisplay() to eglGetDisplay() --- 0001-Use-eglGetPlatformDisplay.patch | 126 +++++++++++++++++++++++++++ mutter.spec | 9 +- 2 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 0001-Use-eglGetPlatformDisplay.patch diff --git a/0001-Use-eglGetPlatformDisplay.patch b/0001-Use-eglGetPlatformDisplay.patch new file mode 100644 index 0000000..48653af --- /dev/null +++ b/0001-Use-eglGetPlatformDisplay.patch @@ -0,0 +1,126 @@ +From c6835e469549189eed7cac13a9c6f0de574e436b Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 4 Oct 2016 13:20:27 -0400 +Subject: [PATCH] Use eglGetPlatformDisplay + +Different libEGL will do different things for eglGetDisplay since it has +to guess what kind of display it's been handed. Better to just use the +API that makes it explicit. + +Signed-off-by: Adam Jackson +--- + cogl/cogl/winsys/cogl-winsys-egl-x11.c | 36 ++++++++++++++++++++++++++++-- + src/backends/native/meta-renderer-native.c | 36 ++++++++++++++++++++++++++++-- + 2 files changed, 68 insertions(+), 4 deletions(-) + +diff --git a/cogl/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/cogl/winsys/cogl-winsys-egl-x11.c +index 454b41e..a7379a5 100644 +--- a/cogl/cogl/winsys/cogl-winsys-egl-x11.c ++++ b/cogl/cogl/winsys/cogl-winsys-egl-x11.c +@@ -261,6 +261,39 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer) + g_slice_free (CoglRendererEGL, egl_renderer); + } + ++static EGLDisplay ++_cogl_winsys_egl_get_display (void *native) ++{ ++ EGLDisplay dpy = NULL; ++ const char *client_exts = eglQueryString (NULL, EGL_EXTENSIONS); ++ ++ if (g_strstr_len (client_exts, -1, "EGL_KHR_platform_base")) ++ { ++ PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = ++ (void *) eglGetProcAddress ("eglGetPlatformDisplay"); ++ ++ if (get_platform_display) ++ dpy = get_platform_display (EGL_PLATFORM_X11_KHR, native, NULL); ++ ++ if (dpy) ++ return dpy; ++ } ++ ++ if (g_strstr_len (client_exts, -1, "EGL_EXT_platform_base")) ++ { ++ PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = ++ (void *) eglGetProcAddress ("eglGetPlatformDisplayEXT"); ++ ++ if (get_platform_display) ++ dpy = get_platform_display (EGL_PLATFORM_X11_KHR, native, NULL); ++ ++ if (dpy) ++ return dpy; ++ } ++ ++ return eglGetDisplay ((EGLNativeDisplayType) native); ++} ++ + static CoglBool + _cogl_winsys_renderer_connect (CoglRenderer *renderer, + CoglError **error) +@@ -277,8 +310,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer, + if (!_cogl_xlib_renderer_connect (renderer, error)) + goto error; + +- egl_renderer->edpy = +- eglGetDisplay ((EGLNativeDisplayType) xlib_renderer->xdpy); ++ egl_renderer->edpy = _cogl_winsys_egl_get_display (xlib_renderer->xdpy); + + if (!_cogl_winsys_egl_renderer_connect_common (renderer, error)) + goto error; +diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c +index 2093e09..b0d11c0 100644 +--- a/src/backends/native/meta-renderer-native.c ++++ b/src/backends/native/meta-renderer-native.c +@@ -222,6 +222,39 @@ meta_onscreen_native_queue_swap_notify (CoglOnscreen *onscreen) + onscreen_native->pending_swap_notify = TRUE; + } + ++static EGLDisplay ++meta_egl_get_display (void *native) ++{ ++ EGLDisplay dpy = NULL; ++ const char *client_exts = eglQueryString (NULL, EGL_EXTENSIONS); ++ ++ if (g_strstr_len (client_exts, -1, "EGL_KHR_platform_base")) ++ { ++ PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = ++ (void *) eglGetProcAddress ("eglGetPlatformDisplay"); ++ ++ if (get_platform_display) ++ dpy = get_platform_display (EGL_PLATFORM_GBM_MESA, native, NULL); ++ ++ if (dpy) ++ return dpy; ++ } ++ ++ if (g_strstr_len (client_exts, -1, "EGL_EXT_platform_base")) ++ { ++ PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = ++ (void *) eglGetProcAddress ("eglGetPlatformDisplayEXT"); ++ ++ if (get_platform_display) ++ dpy = get_platform_display (EGL_PLATFORM_GBM_MESA, native, NULL); ++ ++ if (dpy) ++ return dpy; ++ } ++ ++ return eglGetDisplay ((EGLNativeDisplayType) native); ++} ++ + static CoglBool + meta_renderer_native_connect (CoglRenderer *cogl_renderer, + CoglError **error) +@@ -246,8 +279,7 @@ meta_renderer_native_connect (CoglRenderer *cogl_renderer, + goto fail; + } + +- egl_renderer->edpy = +- eglGetDisplay ((EGLNativeDisplayType) renderer_native->gbm); ++ egl_renderer->edpy = meta_egl_get_display (renderer_native->gbm); + if (egl_renderer->edpy == EGL_NO_DISPLAY) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, +-- +2.9.3 + diff --git a/mutter.spec b/mutter.spec index c5ba55b..4b37315 100644 --- a/mutter.spec +++ b/mutter.spec @@ -5,7 +5,7 @@ Name: mutter Version: 3.22.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Window and compositing manager based on Clutter License: GPLv2+ @@ -13,6 +13,9 @@ License: GPLv2+ URL: http://www.gnome.org Source0: http://download.gnome.org/sources/%{name}/3.22/%{name}-%{version}.tar.xz +# https://bugzilla.gnome.org/show_bug.cgi?id=772422 +Patch0: 0001-Use-eglGetPlatformDisplay.patch + BuildRequires: chrpath BuildRequires: pango-devel BuildRequires: startup-notification-devel @@ -103,6 +106,7 @@ the functionality of the installed %{name} package. %prep %setup -q +%patch0 -p1 %build autoreconf -f -i @@ -177,6 +181,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || : %{_datadir}/mutter/tests %changelog +* Tue Oct 11 2016 Adam Jackson - 3.22.1-2 +- Prefer eglGetPlatformDisplay() to eglGetDisplay() + * Tue Oct 11 2016 Florian Müllner - 3.22.1-1 - Update to 3.22.1