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
This commit is contained in:
Jonas Ådahl 2016-09-01 11:04:22 +08:00
parent 4ce7d3a772
commit da21f02eb9
3 changed files with 14 additions and 23 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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);