[PATCH xserver] glamor: Use eglGetPlatformDisplayEXT not eglGetDisplay
Hans de Goede
hdegoede at redhat.com
Wed Oct 5 08:52:13 UTC 2016
Hi,
On 04-10-16 19:34, Adam Jackson wrote:
> eglGetDisplay forces the implementation to guess which kind of display
> it's been handed. glvnd does something different from Mesa, and in
> general it's impossible for the library to get this right. Instead use
> the API where you specify what kind of display it is.
>
> The explicit call to eglGetProcAddress is to work around a bug in
> libepoxy 1.3, which does not understand EGL client extensions and so its
> resolver code will crash.
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
Patch looks good to me and is:
Reviewed-by: Hans de Goede <hdegoede at redhat.com>
Regards,
Hans
> ---
> glamor/glamor_egl.c | 9 ++++++++-
> hw/xwayland/xwayland-glamor.c | 8 +++++++-
> 2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
> index 2b9e0e1..51d8147 100644
> --- a/glamor/glamor_egl.c
> +++ b/glamor/glamor_egl.c
> @@ -736,6 +736,7 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
> {
> struct glamor_egl_screen_private *glamor_egl;
> const char *version;
> + PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay;
>
> EGLint config_attribs[] = {
> #ifdef GLAMOR_GLES2
> @@ -768,7 +769,13 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
> ErrorF("couldn't get display device\n");
> goto error;
> }
> - glamor_egl->display = eglGetDisplay(glamor_egl->gbm);
> +
> + getPlatformDisplay = (PFNEGLGETPLATFORMDISPLAYEXTPROC)
> + eglGetProcAddress("eglGetPlatformDisplayEXT");
> +
> + if (getPlatformDisplay)
> + glamor_egl->display = getPlatformDisplay (EGL_PLATFORM_GBM_MESA,
> + glamor_egl->gbm, NULL);
> #else
> glamor_egl->display = eglGetDisplay((EGLNativeDisplayType) (intptr_t) fd);
> #endif
> diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
> index 068c224..23402f9 100644
> --- a/hw/xwayland/xwayland-glamor.c
> +++ b/hw/xwayland/xwayland-glamor.c
> @@ -280,6 +280,7 @@ xwl_drm_init_egl(struct xwl_screen *xwl_screen)
> GLAMOR_GL_CORE_VER_MINOR,
> EGL_NONE
> };
> + PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay;
>
> if (xwl_screen->egl_display)
> return;
> @@ -292,7 +293,12 @@ xwl_drm_init_egl(struct xwl_screen *xwl_screen)
> return;
> }
>
> - xwl_screen->egl_display = eglGetDisplay(xwl_screen->gbm);
> + getPlatformDisplay = (PFNEGLGETPLATFORMDISPLAYEXTPROC)
> + eglGetProcAddress("eglGetPlatformDisplayEXT");
> +
> + if (getPlatformDisplay)
> + xwl_screen->egl_display = getPlatformDisplay(EGL_PLATFORM_GBM_MESA,
> + xwl_screen->gbm, NULL);
> if (xwl_screen->egl_display == EGL_NO_DISPLAY) {
> ErrorF("eglGetDisplay() failed\n");
> return;
>
More information about the xorg-devel
mailing list