Make RS compile on ARM64.

bug 13280327

Change-Id: I79080c448ca17d0cba8df075737c22b24ce9a085
diff --git a/driver/rsdGL.cpp b/driver/rsdGL.cpp
index c421ade..ff0c9a6 100644
--- a/driver/rsdGL.cpp
+++ b/driver/rsdGL.cpp
@@ -542,8 +542,9 @@
     const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4};
 
     RsdVertexArray::Attrib attribs[2];
-    attribs[0].set(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "ATTRIB_position");
-    attribs[1].set(GL_FLOAT, 2, 8, false, (uint32_t)tex, "ATTRIB_texture0");
+
+    attribs[0].set(GL_FLOAT, 3, 12, false, (size_t)vtx, "ATTRIB_position");
+    attribs[1].set(GL_FLOAT, 2, 8, false, (size_t)tex, "ATTRIB_texture0");
 
     RsdVertexArray va(attribs, 2);
     va.setup(rsc);
diff --git a/driver/rsdMeshObj.cpp b/driver/rsdMeshObj.cpp
index e8df21f..66c3b18 100644
--- a/driver/rsdMeshObj.cpp
+++ b/driver/rsdMeshObj.cpp
@@ -126,7 +126,7 @@
 }
 
 void RsdMeshObj::renderPrimitiveRange(const Context *rsc, uint32_t primIndex,
-                                      uint32_t start, uint32_t len) const {
+                                      size_t start, uint32_t len) const {
     if (len < 1 || primIndex >= mRSMesh->mHal.state.primitivesCount || mAttribCount == 0) {
         rsc->setError(RS_ERROR_FATAL_DRIVER, "Invalid mesh or parameters");
         return;
diff --git a/driver/rsdMeshObj.h b/driver/rsdMeshObj.h
index 1370f01..58eb1ae 100644
--- a/driver/rsdMeshObj.h
+++ b/driver/rsdMeshObj.h
@@ -38,7 +38,7 @@
     ~RsdMeshObj();
 
     void renderPrimitiveRange(const android::renderscript::Context *,
-                              uint32_t primIndex, uint32_t start, uint32_t len) const;
+                              uint32_t primIndex, size_t start, uint32_t len) const;
 
     bool init(const android::renderscript::Context *rsc);
 
diff --git a/driver/rsdPath.cpp b/driver/rsdPath.cpp
index 79ec487..ee5e3ad 100644
--- a/driver/rsdPath.cpp
+++ b/driver/rsdPath.cpp
@@ -150,8 +150,8 @@
     }
 
     RsdVertexArray::Attrib attribs[2];
-    attribs[0].set(GL_FLOAT, 2, 8, false, (uint32_t)vtx, "ATTRIB_position");
-    attribs[1].set(GL_FLOAT, 4, 16, false, (uint32_t)color, "ATTRIB_color");
+    attribs[0].set(GL_FLOAT, 2, 8, false, (size_t)vtx, "ATTRIB_position");
+    attribs[1].set(GL_FLOAT, 4, 16, false, (size_t)color, "ATTRIB_color");
     RsdVertexArray va(attribs, 2);
     va.setup(rsc);
 
diff --git a/driver/rsdProgram.cpp b/driver/rsdProgram.cpp
index a96a5f9..132f7be 100644
--- a/driver/rsdProgram.cpp
+++ b/driver/rsdProgram.cpp
@@ -71,7 +71,7 @@
     if(pv->mHal.drv) {
         drv = (RsdShader*)pv->mHal.drv;
         if (rsc->props.mLogShaders) {
-            ALOGV("Destroying vertex shader with ID %u", (uint32_t)pv);
+            ALOGV("Destroying vertex shader with ID %p", (void*)pv);
         }
         if (drv->getStateBasedIDCount()) {
             dc->gl.shaderCache->cleanupVertex(drv);
@@ -105,7 +105,7 @@
     if(pf->mHal.drv) {
         drv = (RsdShader*)pf->mHal.drv;
         if (rsc->props.mLogShaders) {
-            ALOGV("Destroying fragment shader with ID %u", (uint32_t)pf);
+            ALOGV("Destroying fragment shader with ID %p", (void*)pf);
         }
         if (drv->getStateBasedIDCount()) {
             dc->gl.shaderCache->cleanupFragment(drv);
diff --git a/driver/rsdRuntimeStubs.cpp b/driver/rsdRuntimeStubs.cpp
index cb5d008..d1f29f0 100644
--- a/driver/rsdRuntimeStubs.cpp
+++ b/driver/rsdRuntimeStubs.cpp
@@ -284,8 +284,8 @@
     const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4};
 
     RsdVertexArray::Attrib attribs[2];
-    attribs[0].set(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "ATTRIB_position");
-    attribs[1].set(GL_FLOAT, 2, 8, false, (uint32_t)tex, "ATTRIB_texture0");
+    attribs[0].set(GL_FLOAT, 3, 12, false, (size_t)vtx, "ATTRIB_position");
+    attribs[1].set(GL_FLOAT, 2, 8, false, (size_t)tex, "ATTRIB_texture0");
 
     RsdVertexArray va(attribs, 2);
     va.setup(rsc);
diff --git a/driver/rsdShader.cpp b/driver/rsdShader.cpp
index 816b17c..0b182ff 100644
--- a/driver/rsdShader.cpp
+++ b/driver/rsdShader.cpp
@@ -468,8 +468,8 @@
     uint32_t numTexturesToBind = mRSProgram->mHal.state.texturesCount;
     uint32_t numTexturesAvailable = dc->gl.gl.maxFragmentTextureImageUnits;
     if (numTexturesToBind >= numTexturesAvailable) {
-        ALOGE("Attempting to bind %u textures on shader id %u, but only %u are available",
-             mRSProgram->mHal.state.texturesCount, (uint32_t)this, numTexturesAvailable);
+        ALOGE("Attempting to bind %u textures on shader id %p, but only %u are available",
+             mRSProgram->mHal.state.texturesCount, this, numTexturesAvailable);
         rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind more textuers than available");
         numTexturesToBind = numTexturesAvailable;
     }
@@ -489,8 +489,8 @@
         if (mCurrentState->mTextureTargets[ct] != GL_TEXTURE_2D &&
             mCurrentState->mTextureTargets[ct] != GL_TEXTURE_CUBE_MAP &&
             mCurrentState->mTextureTargets[ct] != GL_TEXTURE_EXTERNAL_OES) {
-            ALOGE("Attempting to bind unknown texture to shader id %u, texture unit %u",
-                  (uint)this, ct);
+            ALOGE("Attempting to bind unknown texture to shader id %p, texture unit %u",
+                  this, ct);
             rsc->setError(RS_ERROR_BAD_SHADER, "Non-texture allocation bound to a shader");
         }
         RSD_CALL_GL(glBindTexture, mCurrentState->mTextureTargets[ct], drvTex->textureID);
@@ -523,8 +523,8 @@
         Allocation *alloc = mRSProgram->mHal.state.constants[ct];
 
         if (!alloc) {
-            ALOGE("Attempting to set constants on shader id %u, but alloc at slot %u is not set",
-                 (uint32_t)this, ct);
+            ALOGE("Attempting to set constants on shader id %p, but alloc at slot %u is not set",
+                  this, ct);
             rsc->setError(RS_ERROR_BAD_SHADER, "No constant allocation bound");
             continue;
         }
diff --git a/driver/rsdShader.h b/driver/rsdShader.h
index 2680b3e..fba1790 100644
--- a/driver/rsdShader.h
+++ b/driver/rsdShader.h
@@ -39,7 +39,7 @@
 public:
 
     RsdShader(const android::renderscript::Program *p, uint32_t type,
-              const char * shaderText, uint32_t shaderLength,
+              const char * shaderText, size_t shaderLength,
               const char** textureNames, size_t textureNamesCount,
               const size_t *textureNamesLength);
     virtual ~RsdShader();
diff --git a/driver/rsdVertexArray.cpp b/driver/rsdVertexArray.cpp
index 1836e67..4e293f6 100644
--- a/driver/rsdVertexArray.cpp
+++ b/driver/rsdVertexArray.cpp
@@ -52,7 +52,7 @@
 }
 
 void RsdVertexArray::Attrib::set(uint32_t type, uint32_t size, uint32_t stride,
-                              bool normalized, uint32_t offset,
+                              bool normalized, size_t offset,
                               const char *name) {
     clear();
     this->type = type;
@@ -67,16 +67,16 @@
     if (idx == 0) {
         ALOGV("Starting vertex attribute binding");
     }
-    ALOGV("va %i: slot=%i name=%s buf=%i ptr=%p size=%i  type=0x%x  stride=0x%x  norm=%i  offset=0x%x",
-         idx, slot,
-         mAttribs[idx].name.string(),
-         mAttribs[idx].buffer,
-         mAttribs[idx].ptr,
-         mAttribs[idx].size,
-         mAttribs[idx].type,
-         mAttribs[idx].stride,
-         mAttribs[idx].normalized,
-         mAttribs[idx].offset);
+    ALOGV("va %i: slot=%i name=%s buf=%i ptr=%p size=%i  type=0x%x  stride=0x%x  norm=%i  offset=0x%p",
+          idx, slot,
+          mAttribs[idx].name.string(),
+          mAttribs[idx].buffer,
+          mAttribs[idx].ptr,
+          mAttribs[idx].size,
+          mAttribs[idx].type,
+          mAttribs[idx].stride,
+          mAttribs[idx].normalized,
+          (void*)mAttribs[idx].offset);
 }
 
 void RsdVertexArray::setup(const Context *rsc) const {
diff --git a/driver/rsdVertexArray.h b/driver/rsdVertexArray.h
index 9c655df..975121b 100644
--- a/driver/rsdVertexArray.h
+++ b/driver/rsdVertexArray.h
@@ -34,7 +34,7 @@
     public:
         uint32_t buffer;
         const uint8_t * ptr;
-        uint32_t offset;
+        size_t offset;
         uint32_t type;
         uint32_t size;
         uint32_t stride;
@@ -43,7 +43,7 @@
 
         Attrib();
         void clear();
-        void set(uint32_t type, uint32_t size, uint32_t stride, bool normalized, uint32_t offset, const char *name);
+        void set(uint32_t type, uint32_t size, uint32_t stride, bool normalized, size_t offset, const char *name);
     };
 
     RsdVertexArray(const Attrib *attribs, uint32_t numAttribs);
diff --git a/driver/runtime/Android.mk b/driver/runtime/Android.mk
index 2f8dd5d..501e989 100755
--- a/driver/runtime/Android.mk
+++ b/driver/runtime/Android.mk
@@ -64,6 +64,10 @@
 
 # Build the base version of the library
 include $(CLEAR_VARS)
+
+# FIXME for 64-bit
+LOCAL_32_BIT_ONLY := true
+
 LOCAL_MODULE := libclcore.bc
 LOCAL_SRC_FILES := $(clcore_files)
 
@@ -71,6 +75,10 @@
 
 # Build a debug version of the library
 include $(CLEAR_VARS)
+
+# FIXME for 64-bit
+LOCAL_32_BIT_ONLY := true
+
 LOCAL_MODULE := libclcore_debug.bc
 rs_debug_runtime := 1
 LOCAL_SRC_FILES := $(clcore_files)
@@ -80,6 +88,10 @@
 # Build an optimized version of the library for x86 platforms (all have SSE2/3).
 ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
 include $(CLEAR_VARS)
+
+# FIXME for 64-bit
+LOCAL_32_BIT_ONLY := true
+
 LOCAL_MODULE := libclcore_x86.bc
 LOCAL_SRC_FILES := $(clcore_x86_files)
 
@@ -89,6 +101,10 @@
 # Build a NEON-enabled version of the library (if possible)
 ifeq ($(ARCH_ARM_HAVE_NEON),true)
   include $(CLEAR_VARS)
+
+  # FIXME for 64-bit
+  LOCAL_32_BIT_ONLY := true
+
   LOCAL_MODULE := libclcore_neon.bc
   LOCAL_SRC_FILES := $(clcore_neon_files)
   LOCAL_CFLAGS += -DARCH_ARM_HAVE_NEON
@@ -101,6 +117,10 @@
 
 # Build the ARM version of the library
 include $(CLEAR_VARS)
+
+# FIXME for 64-bit
+LOCAL_32_BIT_ONLY := true
+
 BCC_RS_TRIPLE := armv7-none-linux-gnueabi
 LOCAL_MODULE := librsrt_arm.bc
 LOCAL_IS_HOST_MODULE := true
@@ -109,6 +129,10 @@
 
 # Build the MIPS version of the library
 include $(CLEAR_VARS)
+
+# FIXME for 64-bit
+LOCAL_32_BIT_ONLY := true
+
 BCC_RS_TRIPLE := mipsel-unknown-linux
 LOCAL_MODULE := librsrt_mips.bc
 LOCAL_IS_HOST_MODULE := true
@@ -117,8 +141,13 @@
 
 # Build the x86 version of the library
 include $(CLEAR_VARS)
+
+# FIXME for 64-bit
+LOCAL_32_BIT_ONLY := true
+
 BCC_RS_TRIPLE := i686-unknown-linux
 LOCAL_MODULE := librsrt_x86.bc
 LOCAL_IS_HOST_MODULE := true
 LOCAL_SRC_FILES := $(clcore_x86_files)
 include $(LOCAL_PATH)/build_bc_lib.mk
+