Add x86 server support.

Change-Id: I674acaf15b67afa48bc736f72942a11e2e38e940
diff --git a/cpp/Allocation.cpp b/cpp/Allocation.cpp
index d2d81c9..4368225 100644
--- a/cpp/Allocation.cpp
+++ b/cpp/Allocation.cpp
@@ -145,17 +145,21 @@
 }
 
 void Allocation::ioSendOutput() {
+#ifndef RS_COMPATIBILITY_LIB
     if ((mUsage & RS_ALLOCATION_USAGE_IO_OUTPUT) == 0) {
         ALOGE("Can only send buffer if IO_OUTPUT usage specified.");
     }
     rsAllocationIoSend(mRS->getContext(), getID());
+#endif
 }
 
 void Allocation::ioGetInput() {
+#ifndef RS_COMPATIBILITY_LIB
     if ((mUsage & RS_ALLOCATION_USAGE_IO_INPUT) == 0) {
         ALOGE("Can only send buffer if IO_OUTPUT usage specified.");
     }
     rsAllocationIoReceive(mRS->getContext(), getID());
+#endif
 }
 
 void Allocation::generateMipmaps() {
diff --git a/cpp/BaseObj.cpp b/cpp/BaseObj.cpp
index d0102d0..828bd87 100644
--- a/cpp/BaseObj.cpp
+++ b/cpp/BaseObj.cpp
@@ -14,8 +14,6 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "libRS_cpp"
-
 #include "RenderScript.h"
 #include <rs.h>
 
diff --git a/cpp/Element.cpp b/cpp/Element.cpp
index f3e83d0..51a96cd 100644
--- a/cpp/Element.cpp
+++ b/cpp/Element.cpp
@@ -40,7 +40,7 @@
     if (index >= mVisibleElementMap.size()) {
         mRS->throwError("Illegal sub-element index");
     }
-    return mElementNames[mVisibleElementMap[index]];
+    return mElementNames[mVisibleElementMap[index]].string();
 }
 
 size_t Element::getSubElementArraySize(uint32_t index) {
@@ -338,7 +338,7 @@
     // Skip padding fields after a vector 3 type.
     if (mSkipPadding) {
         const char *s1 = "#padding_";
-        const char *s2 = name;
+        const char *s2 = name.string();
         size_t len = strlen(s1);
         if (strlen(s2) >= len) {
             if (!memcmp(s1, s2, len)) {
diff --git a/cpp/RenderScript.cpp b/cpp/RenderScript.cpp
index 886e1d4..503798b 100644
--- a/cpp/RenderScript.cpp
+++ b/cpp/RenderScript.cpp
@@ -14,15 +14,13 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "libRS_cpp"
-
-#include <utils/Log.h>
 #include <malloc.h>
 #include <string.h>
 #include <pthread.h>
 
 #include "RenderScript.h"
 #include "rs.h"
+#include "rsUtils.h"
 
 using namespace android;
 using namespace RSC;
diff --git a/cpp/RenderScript.h b/cpp/RenderScript.h
index 9e74922..9a7a565 100644
--- a/cpp/RenderScript.h
+++ b/cpp/RenderScript.h
@@ -20,4 +20,8 @@
 #include "rsDefines.h"
 #include "rsCppStructs.h"
 
+#ifdef RS_SERVER
+#define RS_VERSION 18
+#endif
+
 #endif
diff --git a/cpp/Script.cpp b/cpp/Script.cpp
index ee03aaf..54a571a 100644
--- a/cpp/Script.cpp
+++ b/cpp/Script.cpp
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include <utils/Log.h>
 #include <malloc.h>
 
 #include "RenderScript.h"
diff --git a/cpp/ScriptC.cpp b/cpp/ScriptC.cpp
index 95bd9a4..f66e0ec 100644
--- a/cpp/ScriptC.cpp
+++ b/cpp/ScriptC.cpp
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include <utils/Log.h>
 #include <malloc.h>
 
 #include "RenderScript.h"
diff --git a/cpp/ScriptIntrinsics.cpp b/cpp/ScriptIntrinsics.cpp
index 4a39d0e..44e8760 100644
--- a/cpp/ScriptIntrinsics.cpp
+++ b/cpp/ScriptIntrinsics.cpp
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include <utils/Log.h>
 #include <malloc.h>
 
 #include "RenderScript.h"
diff --git a/cpp/Type.cpp b/cpp/Type.cpp
index 675f66e..8fa505c 100644
--- a/cpp/Type.cpp
+++ b/cpp/Type.cpp
@@ -14,14 +14,12 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "libRS_cpp"
-
-#include <utils/Log.h>
 #include <malloc.h>
 #include <string.h>
 
 #include <rs.h>
 #include "RenderScript.h"
+#include "rsUtils.h"
 
 using namespace android;
 using namespace RSC;
diff --git a/cpp/rsCppStructs.h b/cpp/rsCppStructs.h
index 67df202..97420fb 100644
--- a/cpp/rsCppStructs.h
+++ b/cpp/rsCppStructs.h
@@ -17,9 +17,12 @@
 #ifndef ANDROID_RSCPPSTRUCTS_H
 #define ANDROID_RSCPPSTRUCTS_H
 
-#include <utils/String8.h>
-#include <utils/Vector.h>
+#include "rsUtils.h"
+#ifndef RS_SERVER
 #include "utils/RefBase.h"
+#else
+#include "RefBase.h"
+#endif
 
 // Every row in an RS allocation is guaranteed to be aligned by this amount
 // Every row in a user-backed allocation must be aligned by this amount