summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWuZhen <wuzhen@jidemail.com>2016-01-20 15:52:29 +0800
committerMauro Rossi <issor.oruam@gmail.com>2016-11-01 20:41:59 +0100
commit8fc46649adfa99b1f316bd34555a0ac8dd99737d (patch)
tree47d3e054a4255296d93c17e49677fe53d9b6bddb
parent34763549cd7de147951744d9f389b4ed5c6d686e (diff)
downloadexternal_mesa3d-8fc46649adfa99b1f316bd34555a0ac8dd99737d.zip
external_mesa3d-8fc46649adfa99b1f316bd34555a0ac8dd99737d.tar.gz
external_mesa3d-8fc46649adfa99b1f316bd34555a0ac8dd99737d.tar.bz2
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 <cwhuang@linux.org.tw>
-rw-r--r--src/gallium/auxiliary/os/os_misc.c12
-rw-r--r--src/gallium/auxiliary/util/u_debug.c2
-rw-r--r--src/gallium/targets/dri/Android.mk1
-rw-r--r--src/mesa/main/errors.c8
4 files changed, 20 insertions, 3 deletions
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 <log/log.h>
+#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_SOLARIS)
# include <unistd.h>
#elif defined(PIPE_OS_APPLE) || defined(PIPE_OS_BSD)
# include <sys/sysctl.h>
@@ -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);
diff --git a/src/gallium/targets/dri/Android.mk b/src/gallium/targets/dri/Android.mk
index 9ff2d18..f1a5b0e 100644
--- a/src/gallium/targets/dri/Android.mk
+++ b/src/gallium/targets/dri/Android.mk
@@ -46,6 +46,7 @@ LOCAL_CFLAGS :=
LOCAL_SHARED_LIBRARIES := \
libdl \
+ liblog \
libglapi \
libexpat \
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 9932b4a..53a8436 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -42,6 +42,10 @@
#include "util/hash_table.h"
#include "util/simple_list.h"
+#if defined(ANDROID)
+# define LOG_TAG "mesa"
+# include <log/log.h>
+#endif
static FILE *LogFile = NULL;
@@ -95,6 +99,10 @@ output_if_debug(const char *prefixString, const char *outputString,
_mesa_snprintf(buf, sizeof(buf), "%s: %s%s", prefixString, outputString, newline ? "\n" : "");
OutputDebugStringA(buf);
}
+#elif defined(ANDROID)
+ {
+ ALOGD("%s: %s", prefixString, outputString);
+ }
#endif
}
}