[Mesa-dev] [PATCH 4/6] EGL: Call the EGL_KHR_debug callback on errors.

Adam Jackson ajax at redhat.com
Tue Sep 6 19:53:16 UTC 2016


On Wed, 2016-07-06 at 10:33 -0600, Kyle Brenneman wrote:

> @@ -292,6 +292,24 @@ _eglError(EGLint errCode, const char *msg)
>     return EGL_FALSE;
>  }
>  
> +EGLBoolean
> +_eglError(EGLint errCode, const char *msg)
> +{
> +   if (errCode != EGL_SUCCESS) {
> +      EGLint type;
> +      if (errCode == EGL_BAD_ALLOC) {
> +         type = EGL_DEBUG_MSG_CRITICAL_KHR;
> +      } else {
> +         type = EGL_DEBUG_MSG_ERROR_KHR;
> +      }
> +
> +      _eglDebugReport(errCode, NULL, msg, type, NULL, NULL);
> +   } else {
> +      _eglInternalError(errCode, msg);
> +   }
> +   return EGL_FALSE;
> +}

I don't think this can be right? _eglDebugReport ends with:

   if (type == EGL_DEBUG_MSG_CRITICAL_KHR || type == EGL_DEBUG_MSG_ERROR_KHR) {
      _eglError(error, command);
   }

So this looks like it could mutually recurse until you run out of stack
space and crash. I'll try to write a test to prove the point but maybe
I'm missing something about how this is meant to work.

- ajax


More information about the mesa-dev mailing list