summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-11-10 16:54:30 +0100
committersfan5 <sfan5@live.de>2021-11-11 17:41:42 +0100
commit3a10210c568f9c7d969ca6c4da2377c55fbf30f3 (patch)
tree35e710bbed600f3079a774e29a8950db27b1bef7
parent2b9d8ae8b146f459da8647360d148c54cc72bc7e (diff)
downloadmpv-3a10210c568f9c7d969ca6c4da2377c55fbf30f3.tar.bz2
mpv-3a10210c568f9c7d969ca6c4da2377c55fbf30f3.tar.xz
context_drm_egl: use eglCreatePlatformWindowSurfaceEXT if available
This is identical to eglCreateWindowSurface but should be preferred as part of EGL's platform extension.
-rw-r--r--video/out/opengl/context_drm_egl.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c
index 77283c9ddd..2bd17dc871 100644
--- a/video/out/opengl/context_drm_egl.c
+++ b/video/out/opengl/context_drm_egl.c
@@ -48,6 +48,8 @@
#ifndef EGL_EXT_platform_base
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)
(EGLenum platform, void *native_display, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)
+ (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
#endif
struct framebuffer
@@ -236,9 +238,17 @@ static bool init_egl(struct ra_ctx *ctx)
&p->egl.context,
&config))
return false;
+
MP_VERBOSE(ctx, "Initializing EGL surface\n");
- p->egl.surface
- = eglCreateWindowSurface(p->egl.display, config, p->gbm.surface, NULL);
+ PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_window_surface = NULL;
+ create_window_surface = (void *) eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
+ if (create_window_surface) {
+ p->egl.surface = create_window_surface(
+ p->egl.display, config, p->gbm.surface, NULL);
+ } else {
+ p->egl.surface = eglCreateWindowSurface(
+ p->egl.display, config, p->gbm.surface, NULL);
+ }
if (p->egl.surface == EGL_NO_SURFACE) {
MP_ERR(ctx, "Failed to create EGL surface.\n");
return false;