mirror of
https://github.com/brl/mutter.git
synced 2024-12-01 04:10:43 -05:00
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 <ajax@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=772422
This commit is contained in:
parent
050e4acdae
commit
998aa532d0
@ -261,6 +261,39 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
|
|||||||
g_slice_free (CoglRendererEGL, egl_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
|
static CoglBool
|
||||||
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
||||||
CoglError **error)
|
CoglError **error)
|
||||||
@ -277,8 +310,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|||||||
if (!_cogl_xlib_renderer_connect (renderer, error))
|
if (!_cogl_xlib_renderer_connect (renderer, error))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
egl_renderer->edpy =
|
egl_renderer->edpy = _cogl_winsys_egl_get_display (xlib_renderer->xdpy);
|
||||||
eglGetDisplay ((EGLNativeDisplayType) xlib_renderer->xdpy);
|
|
||||||
|
|
||||||
if (!_cogl_winsys_egl_renderer_connect_common (renderer, error))
|
if (!_cogl_winsys_egl_renderer_connect_common (renderer, error))
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -231,6 +231,39 @@ meta_onscreen_native_queue_swap_notify (CoglOnscreen *onscreen)
|
|||||||
onscreen_native->pending_swap_notify = TRUE;
|
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
|
static CoglBool
|
||||||
meta_renderer_native_connect (CoglRenderer *cogl_renderer,
|
meta_renderer_native_connect (CoglRenderer *cogl_renderer,
|
||||||
CoglError **error)
|
CoglError **error)
|
||||||
@ -255,8 +288,7 @@ meta_renderer_native_connect (CoglRenderer *cogl_renderer,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
egl_renderer->edpy =
|
egl_renderer->edpy = meta_egl_get_display (renderer_native->gbm);
|
||||||
eglGetDisplay ((EGLNativeDisplayType) renderer_native->gbm);
|
|
||||||
if (egl_renderer->edpy == EGL_NO_DISPLAY)
|
if (egl_renderer->edpy == EGL_NO_DISPLAY)
|
||||||
{
|
{
|
||||||
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
|
Loading…
Reference in New Issue
Block a user