Mesa (master): egl/glvnd: correctly report errors when vendor cannot be found

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 5 20:54:48 UTC 2018


Module: Mesa
Branch: master
Commit: b3ade6538798ad9bf397d8b386eab3dd8af57f3d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3ade6538798ad9bf397d8b386eab3dd8af57f3d

Author: Emil Velikov <emil.velikov at collabora.com>
Date:   Fri Nov  2 18:34:19 2018 +0000

egl/glvnd: correctly report errors when vendor cannot be found

If the user provides an invalid display or device the ToVendor lookup
will fail.

In this case, the local [Mesa vendor] error code will be set. Thus on
sequential eglGetError(), the error will be EGL_SUCCESS.

To be more specific, GLVND remembers the last vendor and calls back
into it's eglGetError, although there's no guarantee to ever have had
one.

v2:
 - Add _eglError call, so the debug callback is executed (Kyle)
 - Drop XXX comment.

Piglit: tests/egl/spec/egl_ext_device_query
Fixes: ce562f9e3fa ("EGL: Implement the libglvnd interface for EGL (v3)")
Cc: Eric Engestrom <eric at engestrom.ch>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
Reviewed-by: Kyle Brenneman <kbrenneman at nvidia.com>

---

 src/egl/main/egldispatchstubs.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/egl/main/egldispatchstubs.c b/src/egl/main/egldispatchstubs.c
index bfc3195c77..96708aeb0d 100644
--- a/src/egl/main/egldispatchstubs.c
+++ b/src/egl/main/egldispatchstubs.c
@@ -59,6 +59,11 @@ static __eglMustCastToProperFunctionPointerType FetchVendorFunc(__EGLvendorInfo
     }
     if (func == NULL) {
         if (errorCode != EGL_SUCCESS) {
+            // Since we have no vendor, the follow-up eglGetError() call will
+            // end up using the GLVND error code. Set it here.
+            if (vendor == NULL) {
+                exports->setEGLError(errorCode);
+            }
             _eglError(errorCode, __EGL_DISPATCH_FUNC_NAMES[index]);
         }
         return NULL;




More information about the mesa-commit mailing list