video/wayland: use EGL_EXT_present_opaque when available

This commit is contained in:
Eric Engestrom 2021-08-02 23:01:12 +01:00 committed by Ethan Lee
parent 130b6bebae
commit 5113fedfa0
1 changed files with 14 additions and 2 deletions

View File

@ -43,6 +43,11 @@
#endif #endif
#endif /* EGL_KHR_create_context */ #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 #if SDL_VIDEO_DRIVER_RPI
/* Raspbian places the OpenGL ES/EGL binaries in a non standard path */ /* Raspbian places the OpenGL ES/EGL binaries in a non standard path */
#define DEFAULT_EGL ( vc4 ? "libEGL.so.1" : "libbrcmEGL.so" ) #define DEFAULT_EGL ( vc4 ? "libEGL.so.1" : "libbrcmEGL.so" )
@ -1182,8 +1187,8 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
EGLint format_wanted; EGLint format_wanted;
EGLint format_got; EGLint format_got;
#endif #endif
/* max 2 values plus terminator. */ /* max 2 key+value pairs, plus terminator. */
EGLint attribs[3]; EGLint attribs[5];
int attr = 0; int attr = 0;
EGLSurface * surface; 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; attribs[attr++] = EGL_NONE;
surface = _this->egl_data->eglCreateWindowSurface( surface = _this->egl_data->eglCreateWindowSurface(