egl: simplify _eglDebugReport* API
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@nvidia.com> Cc: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (IRC)
This commit is contained in:

committed by
Emil Velikov

parent
5af2673479
commit
b94344f1c7
@@ -274,8 +274,7 @@ _eglSetFuncName(const char *funcName, _EGLDisplay *disp, EGLenum objectType, _EG
|
|||||||
return EGL_TRUE;
|
return EGL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_eglDebugReportFull(EGL_BAD_ALLOC, funcName, funcName,
|
_eglDebugReport(EGL_BAD_ALLOC, funcName, EGL_DEBUG_MSG_CRITICAL_KHR, NULL);
|
||||||
EGL_DEBUG_MSG_CRITICAL_KHR, NULL, NULL);
|
|
||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -294,37 +294,36 @@ _eglError(EGLint errCode, const char *msg)
|
|||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void
|
||||||
* Returns the label set for the current thread.
|
_eglDebugReport(EGLenum error, const char *funcName,
|
||||||
*/
|
EGLint type, const char *message, ...)
|
||||||
EGLLabelKHR
|
|
||||||
_eglGetThreadLabel(void)
|
|
||||||
{
|
|
||||||
_EGLThreadInfo *t = _eglGetCurrentThread();
|
|
||||||
return t->Label;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_eglDebugReportFullv(EGLenum error, const char *command, const char *funcName,
|
|
||||||
EGLint type, EGLLabelKHR objectLabel, const char *message, va_list args)
|
|
||||||
{
|
{
|
||||||
|
_EGLThreadInfo *thr = _eglGetCurrentThread();
|
||||||
EGLDEBUGPROCKHR callback = NULL;
|
EGLDEBUGPROCKHR callback = NULL;
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
if (funcName == NULL)
|
||||||
|
funcName = thr->CurrentFuncName;
|
||||||
|
|
||||||
mtx_lock(_eglGlobal.Mutex);
|
mtx_lock(_eglGlobal.Mutex);
|
||||||
if (_eglGlobal.debugTypesEnabled & DebugBitFromType(type)) {
|
if (_eglGlobal.debugTypesEnabled & DebugBitFromType(type)) {
|
||||||
callback = _eglGlobal.debugCallback;
|
callback = _eglGlobal.debugCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
mtx_unlock(_eglGlobal.Mutex);
|
mtx_unlock(_eglGlobal.Mutex);
|
||||||
|
|
||||||
if (callback != NULL) {
|
if (callback != NULL) {
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
|
|
||||||
if (message != NULL) {
|
if (message != NULL) {
|
||||||
|
va_start(args, message);
|
||||||
if (vasprintf(&buf, message, args) < 0) {
|
if (vasprintf(&buf, message, args) < 0) {
|
||||||
buf = NULL;
|
buf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
va_end(args);
|
||||||
}
|
}
|
||||||
callback(error, command, type, _eglGetThreadLabel(), objectLabel, buf);
|
callback(error, funcName, type, thr->Label, thr->CurrentObjectLabel, buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,29 +331,3 @@ _eglDebugReportFullv(EGLenum error, const char *command, const char *funcName,
|
|||||||
_eglInternalError(error, funcName);
|
_eglInternalError(error, funcName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_eglDebugReportFull(EGLenum error, const char *command, const char *funcName,
|
|
||||||
EGLint type, EGLLabelKHR objectLabel, const char *message, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
_eglDebugReportFullv(error, command, funcName, type, objectLabel, message, args);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_eglDebugReport(EGLenum error, const char *funcName,
|
|
||||||
EGLint type, const char *message, ...)
|
|
||||||
{
|
|
||||||
_EGLThreadInfo *thr = _eglGetCurrentThread();
|
|
||||||
va_list args;
|
|
||||||
|
|
||||||
if (funcName == NULL) {
|
|
||||||
funcName = thr->CurrentFuncName;
|
|
||||||
}
|
|
||||||
|
|
||||||
va_start(args, message);
|
|
||||||
_eglDebugReportFullv(error, thr->CurrentFuncName, funcName, type, thr->CurrentObjectLabel, message, args);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
|
@@ -99,13 +99,6 @@ _eglGetCurrentContext(void);
|
|||||||
extern EGLBoolean
|
extern EGLBoolean
|
||||||
_eglError(EGLint errCode, const char *msg);
|
_eglError(EGLint errCode, const char *msg);
|
||||||
|
|
||||||
extern EGLLabelKHR
|
|
||||||
_eglGetThreadLabel(void);
|
|
||||||
|
|
||||||
extern void
|
|
||||||
_eglDebugReportFull(EGLenum error, const char *command, const char *funcName,
|
|
||||||
EGLint type, EGLLabelKHR objectLabel, const char *message, ...);
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_eglDebugReport(EGLenum error, const char *funcName,
|
_eglDebugReport(EGLenum error, const char *funcName,
|
||||||
EGLint type, const char *message, ...);
|
EGLint type, const char *message, ...);
|
||||||
|
Reference in New Issue
Block a user