summaryrefslogtreecommitdiffstats
path: root/opengl/tools/glgen/stubs
diff options
context:
space:
mode:
authorAshok Bhat <ashok.bhat@arm.com>2014-02-13 09:47:18 +0000
committerAshok Bhat <ashok.bhat@arm.com>2014-02-24 14:27:44 +0000
commitab6fc2a86f34be455c144a2d691e94909998c959 (patch)
treea27833a7dd7fdd3daaf7614c7564120a7bde8979 /opengl/tools/glgen/stubs
parentd1c87d37025c49f6a47fe43328572da495ff04c1 (diff)
downloadframeworks_native-ab6fc2a86f34be455c144a2d691e94909998c959.zip
frameworks_native-ab6fc2a86f34be455c144a2d691e94909998c959.tar.gz
frameworks_native-ab6fc2a86f34be455c144a2d691e94909998c959.tar.bz2
Use long for pointers in opengl/EGL classes
EGL classes in frameworks/base have to be updated to support 64-bit platforms. Key changes in the EGL classes include [x] EGLObjectHandle class - EGLObjectHandle class has two public methods (constructor and getHandle) that assume handles are 32-bit. They have not been changed. Instead, two new hidden methods (EGLObjectHandle(long) and getNativeHandle) have been added. [x] EG14 class - Two public methods eglGetDisplay and eglCreatePbufferFromClientBuffer assume that handles are 32-bit. They have been changed to throw unsupported operation exception on non 32-bit machines. Two new methods eglGetDisplay(long) and eglCreatePbufferFromClientBuffer(...long buffer..) have been added to support 64-bit handles. To allow the above changes in frameworks/base EGL classes, corresponding code generation mechanism in frameworks/native has been updated. Change-Id: I5d0a62e10c20ccf05f610d6608b8dfb6414b5116 Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Diffstat (limited to 'opengl/tools/glgen/stubs')
-rw-r--r--opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp27
-rw-r--r--opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp26
-rwxr-xr-xopengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp74
-rwxr-xr-xopengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.java23
-rwxr-xr-xopengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.nativeReg2
-rwxr-xr-xopengl/tools/glgen/stubs/egl/eglGetDisplay.cpp23
-rwxr-xr-xopengl/tools/glgen/stubs/egl/eglGetDisplay.java14
-rwxr-xr-xopengl/tools/glgen/stubs/egl/eglGetDisplay.nativeReg2
8 files changed, 165 insertions, 26 deletions
diff --git a/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp b/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
index 54de1e7..a372362 100644
--- a/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
+++ b/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
@@ -69,22 +69,22 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass)
jclass eglconfigClassLocal = _env->FindClass("android/opengl/EGLConfig");
eglconfigClass = (jclass) _env->NewGlobalRef(eglconfigClassLocal);
- egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getHandle", "()I");
- eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getHandle", "()I");
- eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getHandle", "()I");
- eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getHandle", "()I");
+ egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getNativeHandle", "()J");
+ eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getNativeHandle", "()J");
+ eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getNativeHandle", "()J");
+ eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getNativeHandle", "()J");
- egldisplayConstructor = _env->GetMethodID(egldisplayClass, "<init>", "(I)V");
- eglcontextConstructor = _env->GetMethodID(eglcontextClass, "<init>", "(I)V");
- eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "<init>", "(I)V");
- eglconfigConstructor = _env->GetMethodID(eglconfigClass, "<init>", "(I)V");
+ egldisplayConstructor = _env->GetMethodID(egldisplayClass, "<init>", "(J)V");
+ eglcontextConstructor = _env->GetMethodID(eglcontextClass, "<init>", "(J)V");
+ eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "<init>", "(J)V");
+ eglconfigConstructor = _env->GetMethodID(eglconfigClass, "<init>", "(J)V");
- jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, (jint)EGL_NO_CONTEXT);
+ jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, reinterpret_cast<jlong>(EGL_NO_CONTEXT));
eglNoContextObject = _env->NewGlobalRef(localeglNoContextObject);
- jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, (jint)EGL_NO_DISPLAY);
+ jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, reinterpret_cast<jlong>(EGL_NO_DISPLAY));
eglNoDisplayObject = _env->NewGlobalRef(localeglNoDisplayObject);
- jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, (jint)EGL_NO_SURFACE);
+ jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, reinterpret_cast<jlong>(EGL_NO_SURFACE));
eglNoSurfaceObject = _env->NewGlobalRef(localeglNoSurfaceObject);
@@ -106,7 +106,8 @@ fromEGLHandle(JNIEnv *_env, jmethodID mid, jobject obj) {
"Object is set to null.");
}
- return (void*) (_env->CallIntMethod(obj, mid));
+ jlong handle = _env->CallLongMethod(obj, mid);
+ return reinterpret_cast<void*>(handle);
}
static jobject
@@ -126,7 +127,7 @@ toEGLHandle(JNIEnv *_env, jclass cls, jmethodID con, void * handle) {
return eglNoSurfaceObject;
}
- return _env->NewObject(cls, con, (jint)handle);
+ return _env->NewObject(cls, con, reinterpret_cast<jlong>(handle));
}
// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp b/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp
index 5e1ffa1..b5c19df 100644
--- a/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp
+++ b/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp
@@ -70,22 +70,22 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass)
jclass eglconfigClassLocal = _env->FindClass("android/opengl/EGLConfig");
eglconfigClass = (jclass) _env->NewGlobalRef(eglconfigClassLocal);
- egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getHandle", "()I");
- eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getHandle", "()I");
- eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getHandle", "()I");
- eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getHandle", "()I");
+ egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getNativeHandle", "()J");
+ eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getNativeHandle", "()J");
+ eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getNativeHandle", "()J");
+ eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getNativeHandle", "()J");
- egldisplayConstructor = _env->GetMethodID(egldisplayClass, "<init>", "(I)V");
- eglcontextConstructor = _env->GetMethodID(eglcontextClass, "<init>", "(I)V");
- eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "<init>", "(I)V");
- eglconfigConstructor = _env->GetMethodID(eglconfigClass, "<init>", "(I)V");
+ egldisplayConstructor = _env->GetMethodID(egldisplayClass, "<init>", "(J)V");
+ eglcontextConstructor = _env->GetMethodID(eglcontextClass, "<init>", "(J)V");
+ eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "<init>", "(J)V");
+ eglconfigConstructor = _env->GetMethodID(eglconfigClass, "<init>", "(J)V");
- jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, (jint)EGL_NO_CONTEXT);
+ jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, reinterpret_cast<jlong>(EGL_NO_CONTEXT));
eglNoContextObject = _env->NewGlobalRef(localeglNoContextObject);
- jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, (jint)EGL_NO_DISPLAY);
+ jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, reinterpret_cast<jlong>(EGL_NO_DISPLAY));
eglNoDisplayObject = _env->NewGlobalRef(localeglNoDisplayObject);
- jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, (jint)EGL_NO_SURFACE);
+ jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, reinterpret_cast<jlong>(EGL_NO_SURFACE));
eglNoSurfaceObject = _env->NewGlobalRef(localeglNoSurfaceObject);
@@ -107,7 +107,7 @@ fromEGLHandle(JNIEnv *_env, jmethodID mid, jobject obj) {
"Object is set to null.");
}
- return (void*) (_env->CallIntMethod(obj, mid));
+ return reinterpret_cast<void*>(_env->CallLongMethod(obj, mid));
}
static jobject
@@ -127,7 +127,7 @@ toEGLHandle(JNIEnv *_env, jclass cls, jmethodID con, void * handle) {
return eglNoSurfaceObject;
}
- return _env->NewObject(cls, con, (jint)handle);
+ return _env->NewObject(cls, con, reinterpret_cast<jlong>(handle));
}
// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp b/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp
new file mode 100755
index 0000000..f09c171
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp
@@ -0,0 +1,74 @@
+/* EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list ) */
+static jobject
+android_eglCreatePbufferFromClientBuffer
+ (JNIEnv *_env, jobject _this, jobject dpy, jint buftype, jlong buffer, jobject config, jintArray attrib_list_ref, jint offset) {
+ jint _exception = 0;
+ const char * _exceptionType = NULL;
+ const char * _exceptionMessage = NULL;
+ EGLSurface _returnValue = (EGLSurface) 0;
+ EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
+ EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config);
+ bool attrib_list_sentinel = false;
+ EGLint *attrib_list_base = (EGLint *) 0;
+ jint _remaining;
+ EGLint *attrib_list = (EGLint *) 0;
+
+ if (!attrib_list_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "attrib_list == null";
+ goto exit;
+ }
+ if (offset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "offset < 0";
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
+ attrib_list_base = (EGLint *)
+ _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
+ attrib_list = attrib_list_base + offset;
+ attrib_list_sentinel = false;
+ for (int i = _remaining - 1; i >= 0; i--) {
+ if (attrib_list[i] == EGL_NONE){
+ attrib_list_sentinel = true;
+ break;
+ }
+ }
+ if (attrib_list_sentinel == false) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "attrib_list must contain EGL_NONE!";
+ goto exit;
+ }
+
+ _returnValue = eglCreatePbufferFromClientBuffer(
+ (EGLDisplay)dpy_native,
+ (EGLenum)buftype,
+ reinterpret_cast<EGLClientBuffer>(buffer),
+ (EGLConfig)config_native,
+ (EGLint *)attrib_list
+ );
+
+exit:
+ if (attrib_list_base) {
+ _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
+ JNI_ABORT);
+ }
+ if (_exception) {
+ jniThrowException(_env, _exceptionType, _exceptionMessage);
+ }
+ return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue);
+}
+
+static jobject
+android_eglCreatePbufferFromClientBufferInt
+ (JNIEnv *_env, jobject _this, jobject dpy, jint buftype, jint buffer, jobject config, jintArray attrib_list_ref, jint offset) {
+ if(sizeof(void*) != sizeof(uint32_t)) {
+ jniThrowException(_env, "java/lang/UnsupportedOperationException", "eglCreatePbufferFromClientBuffer");
+ return 0;
+ }
+ return android_eglCreatePbufferFromClientBuffer(_env, _this, dpy, buftype, buffer, config, attrib_list_ref, offset);
+}
+
diff --git a/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.java b/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.java
new file mode 100755
index 0000000..c2ed1d7
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.java
@@ -0,0 +1,23 @@
+ // C function EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list )
+ // TODO Deprecate the below method
+ public static native EGLSurface eglCreatePbufferFromClientBuffer(
+ EGLDisplay dpy,
+ int buftype,
+ int buffer,
+ EGLConfig config,
+ int[] attrib_list,
+ int offset
+ );
+ // TODO Unhide the below method
+ /**
+ * {@hide}
+ */
+ public static native EGLSurface eglCreatePbufferFromClientBuffer(
+ EGLDisplay dpy,
+ int buftype,
+ long buffer,
+ EGLConfig config,
+ int[] attrib_list,
+ int offset
+ );
+
diff --git a/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.nativeReg b/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.nativeReg
new file mode 100755
index 0000000..477e625
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.nativeReg
@@ -0,0 +1,2 @@
+{"eglCreatePbufferFromClientBuffer", "(Landroid/opengl/EGLDisplay;IILandroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferFromClientBufferInt },
+{"eglCreatePbufferFromClientBuffer", "(Landroid/opengl/EGLDisplay;IJLandroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferFromClientBuffer }, \ No newline at end of file
diff --git a/opengl/tools/glgen/stubs/egl/eglGetDisplay.cpp b/opengl/tools/glgen/stubs/egl/eglGetDisplay.cpp
new file mode 100755
index 0000000..4c353a2
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/eglGetDisplay.cpp
@@ -0,0 +1,23 @@
+/* EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) */
+static jobject
+android_eglGetDisplay
+ (JNIEnv *_env, jobject _this, jlong display_id) {
+ EGLDisplay _returnValue = (EGLDisplay) 0;
+ _returnValue = eglGetDisplay(
+ reinterpret_cast<EGLNativeDisplayType>(display_id)
+ );
+ return toEGLHandle(_env, egldisplayClass, egldisplayConstructor, _returnValue);
+}
+
+/* EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) */
+static jobject
+android_eglGetDisplayInt
+ (JNIEnv *_env, jobject _this, jint display_id) {
+
+ if (sizeof(void*) != sizeof(uint32_t)) {
+ jniThrowException(_env, "java/lang/UnsupportedOperationException", "eglGetDisplay");
+ return 0;
+ }
+ return android_eglGetDisplay(_env, _this, display_id);
+}
+
diff --git a/opengl/tools/glgen/stubs/egl/eglGetDisplay.java b/opengl/tools/glgen/stubs/egl/eglGetDisplay.java
new file mode 100755
index 0000000..532eb09
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/eglGetDisplay.java
@@ -0,0 +1,14 @@
+ // C function EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id )
+ // TODO Deprecate the eglGetDisplay(int) API method
+
+ public static native EGLDisplay eglGetDisplay(
+ int display_id
+ );
+ // TODO Unhide the eglGetDisplay(long) API method
+ /**
+ * {@hide}
+ */
+ public static native EGLDisplay eglGetDisplay(
+ long display_id
+ );
+
diff --git a/opengl/tools/glgen/stubs/egl/eglGetDisplay.nativeReg b/opengl/tools/glgen/stubs/egl/eglGetDisplay.nativeReg
new file mode 100755
index 0000000..acfbb1a
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/eglGetDisplay.nativeReg
@@ -0,0 +1,2 @@
+{"eglGetDisplay", "(I)Landroid/opengl/EGLDisplay;", (void *) android_eglGetDisplayInt },
+{"eglGetDisplay", "(J)Landroid/opengl/EGLDisplay;", (void *) android_eglGetDisplay }, \ No newline at end of file