aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/egl-helpers.c34
-rw-r--r--ui/gtk-egl.c2
2 files changed, 27 insertions, 9 deletions
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index a3d7c3d7f5..ec2e325e21 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -93,7 +93,7 @@ int egl_rendernode_init(const char *rendernode)
goto err;
}
- qemu_egl_init_dpy((EGLNativeDisplayType)qemu_egl_rn_gbm_dev);
+ qemu_egl_init_dpy_mesa((EGLNativeDisplayType)qemu_egl_rn_gbm_dev);
if (!epoxy_has_egl_extension(qemu_egl_display,
"EGL_KHR_surfaceless_context")) {
@@ -206,20 +206,19 @@ EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win)
* platform extensions (EGL_KHR_platform_gbm and friends) yet it doesn't seem
* like mesa will be able to advertise these (even though it can do EGL 1.5).
*/
-static EGLDisplay qemu_egl_get_display(void *native)
+static EGLDisplay qemu_egl_get_display(EGLNativeDisplayType native,
+ EGLenum platform)
{
EGLDisplay dpy = EGL_NO_DISPLAY;
-#ifdef EGL_MESA_platform_gbm
/* In practise any EGL 1.5 implementation would support the EXT extension */
if (epoxy_has_egl_extension(NULL, "EGL_EXT_platform_base")) {
PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplayEXT =
(void *) eglGetProcAddress("eglGetPlatformDisplayEXT");
- if (getPlatformDisplayEXT) {
- dpy = getPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, native, NULL);
+ if (getPlatformDisplayEXT && platform != 0) {
+ dpy = getPlatformDisplayEXT(platform, native, NULL);
}
}
-#endif
if (dpy == EGL_NO_DISPLAY) {
/* fallback */
@@ -228,7 +227,8 @@ static EGLDisplay qemu_egl_get_display(void *native)
return dpy;
}
-int qemu_egl_init_dpy(EGLNativeDisplayType dpy)
+static int qemu_egl_init_dpy(EGLNativeDisplayType dpy,
+ EGLenum platform)
{
static const EGLint conf_att_gl[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
@@ -243,7 +243,7 @@ int qemu_egl_init_dpy(EGLNativeDisplayType dpy)
EGLBoolean b;
EGLint n;
- qemu_egl_display = qemu_egl_get_display(dpy);
+ qemu_egl_display = qemu_egl_get_display(dpy, platform);
if (qemu_egl_display == EGL_NO_DISPLAY) {
error_report("egl: eglGetDisplay failed");
return -1;
@@ -270,6 +270,24 @@ int qemu_egl_init_dpy(EGLNativeDisplayType dpy)
return 0;
}
+int qemu_egl_init_dpy_x11(EGLNativeDisplayType dpy)
+{
+#ifdef EGL_KHR_platform_x11
+ return qemu_egl_init_dpy(dpy, EGL_PLATFORM_X11_KHR);
+#else
+ return qemu_egl_init_dpy(dpy, 0);
+#endif
+}
+
+int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy)
+{
+#ifdef EGL_MESA_platform_gbm
+ return qemu_egl_init_dpy(dpy, EGL_PLATFORM_GBM_MESA);
+#else
+ return qemu_egl_init_dpy(dpy, 0);
+#endif
+}
+
EGLContext qemu_egl_init_ctx(void)
{
static const EGLint ctx_att_gl[] = {
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 89492c0e02..cf48cca259 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -246,7 +246,7 @@ void gtk_egl_init(void)
GdkDisplay *gdk_display = gdk_display_get_default();
Display *x11_display = gdk_x11_display_get_xdisplay(gdk_display);
- if (qemu_egl_init_dpy(x11_display) < 0) {
+ if (qemu_egl_init_dpy_x11(x11_display) < 0) {
return;
}