summaryrefslogtreecommitdiffstats
path: root/core/jni/android/opengl
diff options
context:
space:
mode:
authorAshok Bhat <ashok.bhat@arm.com>2014-01-20 20:08:01 +0000
committerNarayan Kamath <narayan@google.com>2014-01-27 13:28:16 +0000
commit18b4cbeedef21c1fa666a110a157bab66edff976 (patch)
tree03ee1d020f152fe0206816e272bc11c032508554 /core/jni/android/opengl
parent4507ea9e3cabcf68f250da20c10cf0edcb6eb3f2 (diff)
downloadframeworks_base-18b4cbeedef21c1fa666a110a157bab66edff976.zip
frameworks_base-18b4cbeedef21c1fa666a110a157bab66edff976.tar.gz
frameworks_base-18b4cbeedef21c1fa666a110a157bab66edff976.tar.bz2
AArch64: Make graphics classes 64-bit compatible
This a merger of two commits submitted to AOSP by the following authors: ashok.bhat@arm.com, david.butcher@arm.coma craig.barber@arm.com, kevin.petit@arm.com and marcus.oakland@arm.com Due to the very large number of internal conflicts, I have chosen to cherry-pick this change instead of letting it merge through AOSP because the merge conflict resolution would be very hard to review. Commit messages below: ================================================ AArch64: Make graphics classes 64-bit compatible Changes in this patch include [x] Long is used to store native pointers as they can be 64-bit. [x] Some minor changes have been done to conform with standard JNI practice (e.g. use of jint instead of int in JNI function prototypes) [x] AssetAtlasManager is not completely 64-bit compatible yet. Specifically mAtlasMap member has to be converted to hold native pointer using long. Added a TODO to AssetAtlasManager.java to indicate the change required. Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Craig Barber <craig.barber@arm.com> Signed-off-by: Kévin PETIT <kevin.petit@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> ================================================================== AArch64: Use long for pointers in graphics/Camera For storing pointers, long is used in android/graphics/Camera class, as native pointers can be 64-bit. In addition, some minor changes have been done to conform with standard JNI practice (e.g. use of jint instead of int in JNI function prototypes) Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> =================================================================== Change-Id: Ib3eab85ed97ea3e3c227617c20f8d213f17d4ba0
Diffstat (limited to 'core/jni/android/opengl')
-rw-r--r--core/jni/android/opengl/util.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/jni/android/opengl/util.cpp b/core/jni/android/opengl/util.cpp
index 4bb091d..a17f328 100644
--- a/core/jni/android/opengl/util.cpp
+++ b/core/jni/android/opengl/util.cpp
@@ -389,7 +389,7 @@ static void computeFrustum(const float* m, float* f) {
}
static
-int util_frustumCullSpheres(JNIEnv *env, jclass clazz,
+jint util_frustumCullSpheres(JNIEnv *env, jclass clazz,
jfloatArray mvp_ref, jint mvpOffset,
jfloatArray spheres_ref, jint spheresOffset, jint spheresCount,
jintArray results_ref, jint resultsOffset, jint resultsCapacity) {
@@ -436,7 +436,7 @@ int util_frustumCullSpheres(JNIEnv *env, jclass clazz,
*/
static
-int util_visibilityTest(JNIEnv *env, jclass clazz,
+jint util_visibilityTest(JNIEnv *env, jclass clazz,
jfloatArray ws_ref, jint wsOffset,
jfloatArray positions_ref, jint positionsOffset,
jcharArray indices_ref, jint indicesOffset, jint indexCount) {
@@ -553,7 +553,7 @@ static jfieldID nativeBitmapID = 0;
void nativeUtilsClassInit(JNIEnv *env, jclass clazz)
{
jclass bitmapClass = env->FindClass("android/graphics/Bitmap");
- nativeBitmapID = env->GetFieldID(bitmapClass, "mNativeBitmap", "I");
+ nativeBitmapID = env->GetFieldID(bitmapClass, "mNativeBitmap", "J");
}
extern void setGLDebugLevel(int level);
@@ -630,7 +630,7 @@ static jint util_getInternalFormat(JNIEnv *env, jclass clazz,
jobject jbitmap)
{
SkBitmap const * nativeBitmap =
- (SkBitmap const *)env->GetIntField(jbitmap, nativeBitmapID);
+ (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
SkBitmap::Config config = bitmap.config();
return getInternalFormat(config);
@@ -640,7 +640,7 @@ static jint util_getType(JNIEnv *env, jclass clazz,
jobject jbitmap)
{
SkBitmap const * nativeBitmap =
- (SkBitmap const *)env->GetIntField(jbitmap, nativeBitmapID);
+ (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
SkBitmap::Config config = bitmap.config();
return getType(config);
@@ -651,7 +651,7 @@ static jint util_texImage2D(JNIEnv *env, jclass clazz,
jobject jbitmap, jint type, jint border)
{
SkBitmap const * nativeBitmap =
- (SkBitmap const *)env->GetIntField(jbitmap, nativeBitmapID);
+ (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
SkBitmap::Config config = bitmap.config();
if (internalformat < 0) {
@@ -700,7 +700,7 @@ static jint util_texSubImage2D(JNIEnv *env, jclass clazz,
jobject jbitmap, jint format, jint type)
{
SkBitmap const * nativeBitmap =
- (SkBitmap const *)env->GetIntField(jbitmap, nativeBitmapID);
+ (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
SkBitmap::Config config = bitmap.config();
if (format < 0) {
@@ -773,7 +773,7 @@ getPointer(JNIEnv *_env, jobject buffer, jint *remaining)
pointer = _env->CallStaticLongMethod(nioAccessClass,
getBasePointerID, buffer);
if (pointer != 0L) {
- return (void *) (jint) pointer;
+ return reinterpret_cast<void *>(pointer);
}
return NULL;
}
@@ -974,7 +974,7 @@ static jboolean etc1_isValid(JNIEnv *env, jclass clazz,
result = etc1_pkm_is_valid((etc1_byte*) headerB.getData());
}
}
- return result;
+ return result ? JNI_TRUE : JNI_FALSE;
}
/**
@@ -997,7 +997,7 @@ static jint etc1_getWidth(JNIEnv *env, jclass clazz,
/**
* Read the image height from a PKM header
*/
-static int etc1_getHeight(JNIEnv *env, jclass clazz,
+static jint etc1_getHeight(JNIEnv *env, jclass clazz,
jobject header) {
jint result = 0;
BufferHelper headerB(env, header);