video/wayland: use EGL_EXT_present_opaque when available
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index 87d693e..41966db 100644
--- a/src/video/SDL_egl.c
+++ b/src/video/SDL_egl.c
@@ -43,6 +43,11 @@
#endif
#endif /* EGL_KHR_create_context */
+#ifndef EGL_EXT_present_opaque
+#define EGL_EXT_present_opaque 1
+#define EGL_PRESENT_OPAQUE_EXT 0x31DF
+#endif /* EGL_EXT_present_opaque */
+
#if SDL_VIDEO_DRIVER_RPI
/* Raspbian places the OpenGL ES/EGL binaries in a non standard path */
#define DEFAULT_EGL ( vc4 ? "libEGL.so.1" : "libbrcmEGL.so" )
@@ -1182,8 +1187,8 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
EGLint format_wanted;
EGLint format_got;
#endif
- /* max 2 values plus terminator. */
- EGLint attribs[3];
+ /* max 2 key+value pairs, plus terminator. */
+ EGLint attribs[5];
int attr = 0;
EGLSurface * surface;
@@ -1216,6 +1221,13 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
}
}
+#ifdef EGL_EXT_present_opaque
+ if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_EXT_present_opaque")) {
+ attribs[attr++] = EGL_PRESENT_OPAQUE_EXT;
+ attribs[attr++] = EGL_TRUE;
+ }
+#endif
+
attribs[attr++] = EGL_NONE;
surface = _this->egl_data->eglCreateWindowSurface(