egl: remove no longer needed logger infra
As of last commit nobody requires anything else but the _eglDefaultLogger(). As such use it directly and simplify the implementation. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Chad Versace <chadversary@chromium.org>
This commit is contained in:

committed by
Emil Velikov

parent
0372097eec
commit
1dd038e988
@@ -70,14 +70,10 @@ static struct {
|
|||||||
|
|
||||||
EGLBoolean initialized;
|
EGLBoolean initialized;
|
||||||
EGLint level;
|
EGLint level;
|
||||||
_EGLLogProc logger;
|
|
||||||
EGLint num_messages;
|
|
||||||
} logging = {
|
} logging = {
|
||||||
_MTX_INITIALIZER_NP,
|
_MTX_INITIALIZER_NP,
|
||||||
EGL_FALSE,
|
EGL_FALSE,
|
||||||
FALLBACK_LOG_LEVEL,
|
FALLBACK_LOG_LEVEL,
|
||||||
NULL,
|
|
||||||
0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *level_strings[] = {
|
static const char *level_strings[] = {
|
||||||
@@ -90,34 +86,6 @@ static const char *level_strings[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the function to be called when there is a message to log.
|
|
||||||
* Note that the function will be called with an internal lock held.
|
|
||||||
* Recursive logging is not allowed.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_eglSetLogProc(_EGLLogProc logger)
|
|
||||||
{
|
|
||||||
EGLint num_messages = 0;
|
|
||||||
|
|
||||||
mtx_lock(&logging.mutex);
|
|
||||||
|
|
||||||
if (logging.logger != logger) {
|
|
||||||
logging.logger = logger;
|
|
||||||
|
|
||||||
num_messages = logging.num_messages;
|
|
||||||
logging.num_messages = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
mtx_unlock(&logging.mutex);
|
|
||||||
|
|
||||||
if (num_messages)
|
|
||||||
_eglLog(_EGL_DEBUG,
|
|
||||||
"New logger installed. "
|
|
||||||
"Messages before the new logger might not be available.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default logger. It prints the message to stderr.
|
* The default logger. It prints the message to stderr.
|
||||||
*/
|
*/
|
||||||
@@ -172,7 +140,6 @@ _eglInitLogger(void)
|
|||||||
level = FALLBACK_LOG_LEVEL;
|
level = FALLBACK_LOG_LEVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.logger = _eglDefaultLogger;
|
|
||||||
logging.level = (level >= 0) ? level : FALLBACK_LOG_LEVEL;
|
logging.level = (level >= 0) ? level : FALLBACK_LOG_LEVEL;
|
||||||
logging.initialized = EGL_TRUE;
|
logging.initialized = EGL_TRUE;
|
||||||
|
|
||||||
@@ -206,16 +173,13 @@ _eglLog(EGLint level, const char *fmtStr, ...)
|
|||||||
|
|
||||||
mtx_lock(&logging.mutex);
|
mtx_lock(&logging.mutex);
|
||||||
|
|
||||||
if (logging.logger) {
|
va_start(args, fmtStr);
|
||||||
va_start(args, fmtStr);
|
ret = vsnprintf(msg, MAXSTRING, fmtStr, args);
|
||||||
ret = vsnprintf(msg, MAXSTRING, fmtStr, args);
|
if (ret < 0 || ret >= MAXSTRING)
|
||||||
if (ret < 0 || ret >= MAXSTRING)
|
strcpy(msg, "<message truncated>");
|
||||||
strcpy(msg, "<message truncated>");
|
va_end(args);
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
logging.logger(level, msg);
|
_eglDefaultLogger(level, msg);
|
||||||
logging.num_messages++;
|
|
||||||
}
|
|
||||||
|
|
||||||
mtx_unlock(&logging.mutex);
|
mtx_unlock(&logging.mutex);
|
||||||
|
|
||||||
|
@@ -44,13 +44,6 @@ extern "C" {
|
|||||||
#define _EGL_DEBUG 3 /* useful info for debugging */
|
#define _EGL_DEBUG 3 /* useful info for debugging */
|
||||||
|
|
||||||
|
|
||||||
typedef void (*_EGLLogProc)(EGLint level, const char *msg);
|
|
||||||
|
|
||||||
|
|
||||||
extern void
|
|
||||||
_eglSetLogProc(_EGLLogProc logger);
|
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_eglLog(EGLint level, const char *fmtStr, ...);
|
_eglLog(EGLint level, const char *fmtStr, ...);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user