From 8fc46649adfa99b1f316bd34555a0ac8dd99737d Mon Sep 17 00:00:00 2001 From: WuZhen Date: Wed, 20 Jan 2016 15:52:29 +0800 Subject: android: print debug info to logcat Redirect logs printed to stderr to logcat. NO_REF_TASK Tested: local run Change-Id: I58e3966a608af361b86c54b4c95a92561b711968 Signed-off-by: Chih-Wei Huang --- src/gallium/auxiliary/os/os_misc.c | 12 ++++++++++-- src/gallium/auxiliary/util/u_debug.c | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/gallium/auxiliary') diff --git a/src/gallium/auxiliary/os/os_misc.c b/src/gallium/auxiliary/os/os_misc.c index 09d4400..a4d9628 100644 --- a/src/gallium/auxiliary/os/os_misc.c +++ b/src/gallium/auxiliary/os/os_misc.c @@ -46,8 +46,10 @@ #endif - -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_SOLARIS) +#if defined(PIPE_OS_ANDROID) +# define LOG_TAG "gallium" +# include +#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_SOLARIS) # include #elif defined(PIPE_OS_APPLE) || defined(PIPE_OS_BSD) # include @@ -100,6 +102,12 @@ os_log_message(const char *message) fflush(fout); } #else /* !PIPE_SUBSYSTEM_WINDOWS */ +#if defined(PIPE_OS_ANDROID) + if (fout == stderr) { + ALOGD("%s", message); + return; + } +#endif fflush(stdout); fputs(message, fout); fflush(fout); diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index dd3e167..6ccc4f6 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -55,7 +55,7 @@ void _debug_vprintf(const char *format, va_list ap) { static char buf[4096] = {'\0'}; -#if defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_EMBEDDED) +#if defined(PIPE_OS_WINDOWS) || defined(PIPE_OS_ANDROID) || defined(PIPE_SUBSYSTEM_EMBEDDED) /* We buffer until we find a newline. */ size_t len = strlen(buf); int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap); -- cgit v1.1