diff options
author | Zhaowei Yuan <zhaowei.yuan@samsung.com> | 2019-05-06 13:52:32 +0800 |
---|---|---|
committer | Xuelian <xuelian.bai@samsung.com> | 2020-03-25 23:26:58 +0800 |
commit | 1319cf865c1d3b83f6c2c44ae8ee08464539b6ce (patch) | |
tree | 1be51ba4000ea846403860a8ed3a3f1a0c3cfbe2 /src | |
parent | 344c834060abdb1b0b62c36e38d3e7921f12926b (diff) | |
download | mesa-1319cf865c1d3b83f6c2c44ae8ee08464539b6ce.tar.gz mesa-1319cf865c1d3b83f6c2c44ae8ee08464539b6ce.tar.bz2 mesa-1319cf865c1d3b83f6c2c44ae8ee08464539b6ce.zip |
Re-implement _eglLog based on dlog
egllog: add unlock call preventing the deadlock
Implement dlog for mesa main
_eglLog is a basic log function for mesa, re-implement
it based on dlog here for debug purpose.
Log level can be changed by setting environment variable
EGL_LOG_LEVEL.
Log API for mesa main module are all implemented in file
src/mesa/main/error.c, re-implement them based on dlog
for debug convenience
Merged commit:
commit 2b33296f882d9537937523ad0d1faa29429ba295
Author: SooChan Lim <sc1.lim@samsung.com>
commit 712b42a69d898c96dfd399f6358002e2c7f892d8
Author: Zhaowei Yuan <zhaowei.yuan@samsung.com>
commit 8854eef9eb4718b0145d639b1bf37c610a910632
Author: Zhaowei Yuan <zhaowei.yuan@samsung.com>
commit f31f67e148718bb32635e085278f44430f2c38aa
Author: Zhaowei Yuan <zhaowei.yuan@samsung.com>
Change-Id: I25300cb2ed626d1cd10e661673c48d37531da690
Signed-off-by: Zhaowei Yuan <zhaowei.yuan@samsung.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/egl/main/egllog.c | 38 | ||||
-rw-r--r-- | src/mesa/main/errors.c | 25 |
2 files changed, 62 insertions, 1 deletions
diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c index 6a91952577f..dc603cb7489 100644 --- a/src/egl/main/egllog.c +++ b/src/egl/main/egllog.c @@ -45,6 +45,10 @@ #include "util/u_string.h" #include "egllog.h" +#ifdef HAVE_TIZEN_PLATFORM +#define LOG_TAG "MESA" +#include <dlog.h> +#endif #ifdef HAVE_ANDROID_PLATFORM #define LOG_TAG "EGL-MAIN" @@ -57,7 +61,7 @@ #endif /* HAVE_ANDROID_PLATFORM */ #define MAXSTRING 1000 -#define FALLBACK_LOG_LEVEL _EGL_WARNING +#define FALLBACK_LOG_LEVEL _EGL_FATAL static struct { @@ -79,6 +83,7 @@ static const char *level_strings[] = { }; +#ifndef HAVE_TIZEN_PLATFORM /** * The default logger. It prints the message to stderr. */ @@ -97,6 +102,7 @@ _eglDefaultLogger(EGLint level, const char *msg) fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg); #endif /* HAVE_ANDROID_PLATFORM */ } +#endif /** @@ -143,8 +149,10 @@ void _eglLog(EGLint level, const char *fmtStr, ...) { va_list args; +#ifndef HAVE_TIZEN_PLATFORM char msg[MAXSTRING]; int ret; +#endif /* one-time initialization; a little race here is fine */ if (!logging.initialized) @@ -154,13 +162,41 @@ _eglLog(EGLint level, const char *fmtStr, ...) mtx_lock(&logging.mutex); +#ifdef HAVE_TIZEN_PLATFORM + log_priority dlog_prio; + + switch (level) { + case _EGL_FATAL: + dlog_prio = DLOG_ERROR; + break; + case _EGL_WARNING: + dlog_prio = DLOG_WARN; + break; + case _EGL_INFO: + dlog_prio = DLOG_INFO; + break; + case _EGL_DEBUG: + dlog_prio = DLOG_DEBUG; + break; + default: + mtx_unlock(&logging.mutex); + return; + } +#endif + va_start(args, fmtStr); +#ifdef HAVE_TIZEN_PLATFORM + __dlog_vprint(LOG_ID_SYSTEM, dlog_prio, LOG_TAG, fmtStr, args); +#else ret = vsnprintf(msg, MAXSTRING, fmtStr, args); if (ret < 0 || ret >= MAXSTRING) strcpy(msg, "<message truncated>"); +#endif va_end(args); +#ifndef HAVE_TIZEN_PLATFORM _eglDefaultLogger(level, msg); +#endif mtx_unlock(&logging.mutex); diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index 071b75c4727..56726faac8f 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -36,6 +36,10 @@ #include "context.h" #include "debug_output.h" +#ifdef HAVE_TIZEN_PLATFORM +#define LOG_TAG "MESA" +#include <dlog/dlog.h> +#endif static FILE *LogFile = NULL; @@ -146,7 +150,11 @@ _mesa_warning( struct gl_context *ctx, const char *fmtString, ... ) if (ctx) flush_delayed_errors( ctx ); +#ifdef HAVE_TIZEN_PLATFORM + dlog_vprint(DLOG_WARN, LOG_TAG, fmtString, args); +#else output_if_debug("Mesa warning", str, GL_TRUE); +#endif } @@ -172,9 +180,13 @@ _mesa_problem( const struct gl_context *ctx, const char *fmtString, ... ) va_start( args, fmtString ); _mesa_vsnprintf( str, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args ); va_end( args ); +#ifdef HAVE_TIZEN_PLATFORM + dlog_vprint(DLOG_WARN, LOG_TAG, fmtString, args); +#else fprintf(stderr, "Mesa " PACKAGE_VERSION " implementation error: %s\n", str); fprintf(stderr, "Please report at " PACKAGE_BUGREPORT "\n"); +#endif } } @@ -346,7 +358,11 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) /* Print the error to stderr if needed. */ if (do_output) { +#ifdef HAVE_TIZEN_PLATFORM + dlog_vprint(DLOG_ERROR, LOG_TAG, fmtString, args); +#else output_if_debug("Mesa: User error", s2, GL_TRUE); +#endif } /* Log the error via ARB_debug_output if needed.*/ @@ -384,7 +400,12 @@ _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) va_start(args, fmtString); _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args); va_end(args); + +#ifdef HAVE_TIZEN_PLATFORM + dlog_vprint(DLOG_DEBUG, LOG_TAG, fmtString, args); +#else output_if_debug("Mesa", s, GL_FALSE); +#endif #endif /* DEBUG */ (void) ctx; (void) fmtString; @@ -399,7 +420,11 @@ _mesa_log(const char *fmtString, ...) va_start(args, fmtString); _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args); va_end(args); +#ifdef HAVE_TIZEN_PLATFORM + dlog_vprint(DLOG_INFO, LOG_TAG, fmtString, args); +#else output_if_debug("", s, GL_FALSE); +#endif } |