[Mesa-dev] [PATCH 1/4] egl: simplify _eglDebugReport* API

Kyle Brenneman kbrenneman at nvidia.com
Thu Sep 7 17:36:39 UTC 2017


On 09/07/2017 10:03 AM, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
>
> Instead of having three, almost identical but not quite,
> _eglDebugReport* functions, simply fold them into one.
>
> While doing so drop the unnecessary arguments 'command' and
> 'objectLabel'. Former is identical to funcName, while the latter is
> already stored (yet unused) in _EGLThreadInfo::CurrentObjectLabel.
>
> Cc: Kyle Brenneman <kbrenneman at nvidia.com>
> Cc: Adam Jackson <ajax at redhat.com>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
>   src/egl/main/eglapi.c     |  3 +--
>   src/egl/main/eglcurrent.c | 53 ++++++++++++-----------------------------------
>   src/egl/main/eglcurrent.h |  7 -------
>   3 files changed, 14 insertions(+), 49 deletions(-)
>

The command and funcName parameters aren't always identical. funcName is 
whatever string got passed to _eglError, which is often the name of some 
internal function. For instance, eglCreateWindowSurface can call 
_eglError with the string "_eglCreateWindowSurfaceCommon". A lot of the 
calls in the src/egl/drivers/ directory also use internal function names.

I had both the command and fullName parameters in order to preserve the 
existing error reporting behavior (in _eglInternalError) in addition to 
the debug callback.

Also, the reason I kept the command parameter at all instead of always 
using thr->CurrentFuncName is so that _eglSetFuncName could correctly 
report an EGL_BAD_ALLOC error if it couldn't allocate the _EGLThreadInfo 
struct in the first place. In that case, (thr->CurrentFuncName) would be 
NULL.

You could change _eglError to pass NULL for the command name, in which 
case the debug callback would get the correct name in all cases, but 
then you'd lose the internal function name that would otherwise get 
passed to _eglLog.


More information about the mesa-dev mailing list