Merge branch 'ebassi/egl-display-get' into 'master'
Add backend-specific getter for the EGLDisplay See merge request GNOME/gtk!3542
This commit is contained in:
@@ -333,8 +333,31 @@ gdk_wayland_gl_context_init (GdkWaylandGLContext *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_wayland_display_get_egl_display:
|
||||
* @display: (type GdkWaylandDisplay): a Wayland display
|
||||
*
|
||||
* Retrieves the EGL display connection object for the given GDK display.
|
||||
*
|
||||
* Returns: (nullable): the EGL display
|
||||
*/
|
||||
gpointer
|
||||
gdk_wayland_display_get_egl_display (GdkDisplay *display)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), NULL);
|
||||
|
||||
if (!gdk_wayland_display_init_gl (display))
|
||||
return NULL;
|
||||
|
||||
display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
|
||||
return display_wayland->egl_display;
|
||||
}
|
||||
|
||||
static EGLDisplay
|
||||
gdk_wayland_get_display (GdkWaylandDisplay *display_wayland)
|
||||
get_egl_display (GdkWaylandDisplay *display_wayland)
|
||||
{
|
||||
EGLDisplay dpy = NULL;
|
||||
|
||||
@@ -343,12 +366,12 @@ gdk_wayland_get_display (GdkWaylandDisplay *display_wayland)
|
||||
PFNEGLGETPLATFORMDISPLAYPROC getPlatformDisplay =
|
||||
(void *) eglGetProcAddress ("eglGetPlatformDisplay");
|
||||
|
||||
if (getPlatformDisplay)
|
||||
if (getPlatformDisplay != NULL)
|
||||
dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT,
|
||||
display_wayland->wl_display,
|
||||
NULL);
|
||||
if (dpy)
|
||||
return dpy;
|
||||
if (dpy != NULL)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
|
||||
@@ -356,15 +379,18 @@ gdk_wayland_get_display (GdkWaylandDisplay *display_wayland)
|
||||
PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay =
|
||||
(void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
|
||||
|
||||
if (getPlatformDisplay)
|
||||
if (getPlatformDisplay != NULL)
|
||||
dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT,
|
||||
display_wayland->wl_display,
|
||||
NULL);
|
||||
if (dpy)
|
||||
return dpy;
|
||||
if (dpy != NULL)
|
||||
goto out;
|
||||
}
|
||||
|
||||
return eglGetDisplay ((EGLNativeDisplayType) display_wayland->wl_display);
|
||||
dpy = eglGetDisplay ((EGLNativeDisplayType) display_wayland->wl_display);
|
||||
|
||||
out:
|
||||
return dpy;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -377,7 +403,7 @@ gdk_wayland_display_init_gl (GdkDisplay *display)
|
||||
if (display_wayland->have_egl)
|
||||
return TRUE;
|
||||
|
||||
dpy = gdk_wayland_get_display (display_wayland);
|
||||
dpy = get_egl_display (display_wayland);
|
||||
|
||||
if (dpy == NULL)
|
||||
return FALSE;
|
||||
|
||||
@@ -63,6 +63,9 @@ GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_wayland_display_query_registry (GdkDisplay *display,
|
||||
const char *global);
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
gpointer gdk_wayland_display_get_egl_display (GdkDisplay *display);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_WAYLAND_DISPLAY_H__ */
|
||||
|
||||
@@ -84,12 +84,29 @@ drawable_info_free (gpointer data)
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
static EGLDisplay
|
||||
/**
|
||||
* gdk_x11_display_get_egl_display:
|
||||
* @display: (type GdkX11Display): an X11 display
|
||||
*
|
||||
* Retrieves the EGL display connection object for the given GDK display.
|
||||
*
|
||||
* This function returns `NULL` if GDK is using GLX.
|
||||
*
|
||||
* Returns: (nullable): the EGL display object
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
gpointer
|
||||
gdk_x11_display_get_egl_display (GdkDisplay *display)
|
||||
{
|
||||
EGLDisplay edpy = NULL;
|
||||
Display *dpy;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_X11_DISPLAY (display), NULL);
|
||||
|
||||
if (GDK_X11_DISPLAY (display)->have_glx)
|
||||
return NULL;
|
||||
|
||||
edpy = g_object_get_data (G_OBJECT (display), "-gdk-x11-egl-display");
|
||||
if (edpy != NULL)
|
||||
return edpy;
|
||||
|
||||
@@ -48,6 +48,9 @@ gboolean gdk_x11_display_get_egl_version (GdkDisplay *display,
|
||||
int *major,
|
||||
int *minor);
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
gpointer gdk_x11_display_get_egl_display (GdkDisplay *display);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_X11_GL_CONTEXT_H__ */
|
||||
|
||||
@@ -223,7 +223,6 @@ endforeach
|
||||
if add_languages('cpp', required: false, native: false)
|
||||
test_exe = executable('autotestkeywords',
|
||||
sources: 'autotestkeywords.cc',
|
||||
cpp_args: test_cargs,
|
||||
dependencies: libgtk_dep,
|
||||
install: get_option('install-tests'),
|
||||
install_dir: testexecdir,
|
||||
|
||||
Reference in New Issue
Block a user