Files
fml13v01-buildroot/package/mesa3d/0007-egl-Be-stricter-when-making-a-context-current-withou.patch
T
2022-08-16 17:38:05 +08:00

52 lines
2.1 KiB
Diff

From fa57726f60bc6fc6e7094f16300cdc41b44ff4f3 Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Wed, 18 Jun 2014 17:10:28 +0100
Subject: [PATCH 07/67] egl: Be stricter when making a context current without
any surfaces
The EGL_KHR_surfaceless_context extension spec states for eglMakeCurrent:
"If <ctx> does not support being bound without read and draw
surfaces, and both <draw> and <read> are EGL_NO_SURFACE, an
EGL_BAD_MATCH error is generated."
Only OpenGLES contexts support this, via the GL_OES_surfaceless_context,
so if EGL_KHR_surfaceless_context is supported and the context isn't an
OpenGLES context then set the EGL error to EGL_BAD_MATCH.
NOTE: This patch can't be upstreamed as is because we set the error to
EGL_BAD_MATCH if we have an OpenGLES 1.x context but the
GL_OES_surfaceless_context extension spec says:
"This extension is written against the OpenGL ES 2.0 Specification
but can apply to OpenGL ES 1.1 with the GL_OES_framebuffer_object
extension."
All Mesa OpenGLES drivers support GL_OES_framebuffer_object, but we
don't, so there would never be a reason to check whether or not this
extension is supported.
In order to upstream this patch the check would need to be changed
to set the error to EGL_BAD_MATCH if EGL_KHR_surfaceless_context is
supported and the context API isn't OpenGLES or the OpenGLES version
is 1.0.
---
src/egl/main/eglapi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 6ffcff8b2cc..3cd69b96a0f 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -888,6 +888,9 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
if (draw_surf || read_surf)
RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE);
+ if (disp->Extensions.KHR_surfaceless_context && context &&
+ (context->ClientAPI != EGL_OPENGL_ES_API || context->ClientMajorVersion == 1))
+ RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE);
}
/* If a native window underlying either draw or read is no longer valid,
--
2.25.1