summaryrefslogtreecommitdiff
path: root/rs
diff options
context:
space:
mode:
authorMiao Wang <miaowang@google.com>2017-01-24 18:58:17 -0800
committerMiao Wang <miaowang@google.com>2017-02-23 19:39:43 -0800
commitcbb0206cb478c862cb871a65e85115281ef12e02 (patch)
treecc2a52e43cc00671cae0606d370511c50ee02364 /rs
parent6d198966fe79f6642cfe488fc2da0e221848e317 (diff)
Update RenderScript JNI code for Treble
- Include rsApiStubs.h instead of rs.h, and remove unused dependencies for rs.h in Android.mk. - Remove libRSDriver.so from LOCAL_REQUIRED_MODULE, since it is not required nor directly used by librs_jni.so. - Fix the discrepancy in ElementGetNativeData and ElementGetSubElements, respective to NDK APIs exposed in libRS.so. rsApiStubs.h contains all public RenderScript APIs exposed in libRS.so. It fixes the mismatch of the declarations and definitions of the two functions mentioned above. And it does not rely on the auto generated header (rsgApiFuncDecl.h) anymore. Bug: 34396220 Test: mm Merged-In: Iedb1b976cfa9033dccefe78cbe80c8022f990e53 Change-Id: Iedb1b976cfa9033dccefe78cbe80c8022f990e53
Diffstat (limited to 'rs')
-rw-r--r--rs/jni/Android.mk9
-rw-r--r--rs/jni/android_renderscript_RenderScript.cpp6
2 files changed, 5 insertions, 10 deletions
diff --git a/rs/jni/Android.mk b/rs/jni/Android.mk
index bf3681bd303f..447a47d3c56e 100644
--- a/rs/jni/Android.mk
+++ b/rs/jni/Android.mk
@@ -19,22 +19,17 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_STATIC_LIBRARIES :=
-rs_generated_include_dir := $(call intermediates-dir-for,SHARED_LIBRARIES,libRS,,)
-
LOCAL_C_INCLUDES += \
$(JNI_H_INCLUDE) \
frameworks/rs \
frameworks/base/core/jni \
- frameworks/base/libs/hwui \
- $(rs_generated_include_dir)
+ frameworks/base/libs/hwui
LOCAL_CFLAGS += -Wno-unused-parameter
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
-LOCAL_ADDITIONAL_DEPENDENCIES := $(addprefix $(rs_generated_include_dir)/,rsgApiFuncDecl.h)
LOCAL_MODULE:= librs_jni
-LOCAL_ADDITIONAL_DEPENDENCIES += $(rs_generated_source)
LOCAL_MODULE_TAGS := optional
-LOCAL_REQUIRED_MODULES := libRS libRSDriver
+LOCAL_REQUIRED_MODULES := libRS
include $(BUILD_SHARED_LIBRARY)
diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp
index af370ff2f630..2300da32d355 100644
--- a/rs/jni/android_renderscript_RenderScript.cpp
+++ b/rs/jni/android_renderscript_RenderScript.cpp
@@ -35,8 +35,8 @@
#include "android_runtime/android_util_AssetManager.h"
#include "android/graphics/GraphicsJNI.h"
-#include <rs.h>
#include <rsEnv.h>
+#include <rsApiStubs.h>
#include <gui/Surface.h>
#include <gui/GLConsumer.h>
#include <android_runtime/android_graphics_SurfaceTexture.h>
@@ -1134,7 +1134,7 @@ nElementGetNativeData(JNIEnv *_env, jobject _this, jlong con, jlong id, jintArra
// we will pack mType; mKind; mNormalized; mVectorSize; NumSubElements
assert(dataSize == 5);
- uintptr_t elementData[5];
+ uint32_t elementData[5];
rsaElementGetNativeData((RsContext)con, (RsElement)id, elementData, dataSize);
for(jint i = 0; i < dataSize; i ++) {
@@ -1157,7 +1157,7 @@ nElementGetSubElements(JNIEnv *_env, jobject _this, jlong con, jlong id,
uintptr_t *ids = (uintptr_t*)malloc(dataSize * sizeof(uintptr_t));
const char **names = (const char **)malloc(dataSize * sizeof(const char *));
- uint32_t *arraySizes = (uint32_t *)malloc(dataSize * sizeof(uint32_t));
+ size_t *arraySizes = (size_t *)malloc(dataSize * sizeof(size_t));
rsaElementGetSubElements((RsContext)con, (RsElement)id, ids, names, arraySizes,
(uint32_t)dataSize);