summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2011-08-05 12:50:12 +0900
committerChia-I Wu <olvaffe@gmail.com>2011-08-05 15:29:57 +0900
commit5004a35a4a58cf0810fff9478ae83a3f3bf9a843 (patch)
tree1a9764e41e727f75d4e113e1b14620a4da370a15
parent82769b79c54674e60b0ce5d1c28fc40ae3face53 (diff)
gallium: add PIPE_OS_ANDROID support
Android uses Linux kernel and its own C runtime. It resembles PIPE_OS_LINUX a lot with some minor exceptions.
-rw-r--r--src/gallium/auxiliary/os/os_thread.h2
-rw-r--r--src/gallium/auxiliary/util/u_math.h12
-rw-r--r--src/gallium/include/pipe/p_compiler.h2
-rw-r--r--src/gallium/include/pipe/p_config.h8
4 files changed, 22 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h
index 8f1245bff5..d8301298b7 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -314,7 +314,7 @@ typedef int64_t pipe_condvar;
* pipe_barrier
*/
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
+#if (defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)) && !defined(PIPE_OS_ANDROID)
typedef pthread_barrier_t pipe_barrier;
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 0b5284428e..837238b86b 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -199,6 +199,16 @@ roundf(float x)
#endif /* _MSC_VER */
+#ifdef PIPE_OS_ANDROID
+
+static INLINE
+double log2(double d)
+{
+ return log(d) / M_LN2;
+}
+
+#endif
+
@@ -409,7 +419,7 @@ unsigned ffs( unsigned u )
return i;
}
-#elif defined(__MINGW32__)
+#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID)
#define ffs __builtin_ffs
#endif
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index 8c788f4bb0..05de9ff7cd 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -67,7 +67,9 @@ extern "C" {
#if !defined(__HAIKU__) && !defined(__USE_MISC)
+#if !defined(PIPE_OS_ANDROID)
typedef unsigned int uint;
+#endif
typedef unsigned short ushort;
#endif
typedef unsigned char ubyte;
diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h
index 8a5d892c88..b3a7b337bc 100644
--- a/src/gallium/include/pipe/p_config.h
+++ b/src/gallium/include/pipe/p_config.h
@@ -154,6 +154,14 @@
#define PIPE_OS_UNIX
#endif
+/*
+ * Android defines __linux__ so PIPE_OS_LINUX and PIPE_OS_UNIX will also be
+ * defined.
+ */
+#if defined(ANDROID)
+#define PIPE_OS_ANDROID
+#endif
+
#if defined(__FreeBSD__)
#define PIPE_OS_FREEBSD
#define PIPE_OS_BSD