diff options
author | Ashok Bhat <ashok.bhat@arm.com> | 2014-02-13 09:47:18 +0000 |
---|---|---|
committer | Ashok Bhat <ashok.bhat@arm.com> | 2014-02-24 14:27:44 +0000 |
commit | ab6fc2a86f34be455c144a2d691e94909998c959 (patch) | |
tree | a27833a7dd7fdd3daaf7614c7564120a7bde8979 /opengl/tools/glgen/static | |
parent | d1c87d37025c49f6a47fe43328572da495ff04c1 (diff) | |
download | frameworks_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/static')
-rw-r--r-- | opengl/tools/glgen/static/egl/EGLConfig.java | 4 | ||||
-rw-r--r-- | opengl/tools/glgen/static/egl/EGLContext.java | 4 | ||||
-rw-r--r-- | opengl/tools/glgen/static/egl/EGLDisplay.java | 4 | ||||
-rw-r--r-- | opengl/tools/glgen/static/egl/EGLObjectHandle.java | 32 | ||||
-rw-r--r-- | opengl/tools/glgen/static/egl/EGLSurface.java | 4 |
5 files changed, 36 insertions, 12 deletions
diff --git a/opengl/tools/glgen/static/egl/EGLConfig.java b/opengl/tools/glgen/static/egl/EGLConfig.java index a7a6bbb..9881070 100644 --- a/opengl/tools/glgen/static/egl/EGLConfig.java +++ b/opengl/tools/glgen/static/egl/EGLConfig.java @@ -22,7 +22,7 @@ package android.opengl; * */ public class EGLConfig extends EGLObjectHandle { - private EGLConfig(int handle) { + private EGLConfig(long handle) { super(handle); } @@ -32,6 +32,6 @@ public class EGLConfig extends EGLObjectHandle { if (!(o instanceof EGLConfig)) return false; EGLConfig that = (EGLConfig) o; - return getHandle() == that.getHandle(); + return getNativeHandle() == that.getNativeHandle(); } } diff --git a/opengl/tools/glgen/static/egl/EGLContext.java b/opengl/tools/glgen/static/egl/EGLContext.java index c93bd6e..f791e7e 100644 --- a/opengl/tools/glgen/static/egl/EGLContext.java +++ b/opengl/tools/glgen/static/egl/EGLContext.java @@ -22,7 +22,7 @@ package android.opengl; * */ public class EGLContext extends EGLObjectHandle { - private EGLContext(int handle) { + private EGLContext(long handle) { super(handle); } @@ -32,6 +32,6 @@ public class EGLContext extends EGLObjectHandle { if (!(o instanceof EGLContext)) return false; EGLContext that = (EGLContext) o; - return getHandle() == that.getHandle(); + return getNativeHandle() == that.getNativeHandle(); } } diff --git a/opengl/tools/glgen/static/egl/EGLDisplay.java b/opengl/tools/glgen/static/egl/EGLDisplay.java index 5b8043a..e872761 100644 --- a/opengl/tools/glgen/static/egl/EGLDisplay.java +++ b/opengl/tools/glgen/static/egl/EGLDisplay.java @@ -22,7 +22,7 @@ package android.opengl; * */ public class EGLDisplay extends EGLObjectHandle { - private EGLDisplay(int handle) { + private EGLDisplay(long handle) { super(handle); } @@ -32,6 +32,6 @@ public class EGLDisplay extends EGLObjectHandle { if (!(o instanceof EGLDisplay)) return false; EGLDisplay that = (EGLDisplay) o; - return getHandle() == that.getHandle(); + return getNativeHandle() == that.getNativeHandle(); } } diff --git a/opengl/tools/glgen/static/egl/EGLObjectHandle.java b/opengl/tools/glgen/static/egl/EGLObjectHandle.java index d2710de..e6e3976 100644 --- a/opengl/tools/glgen/static/egl/EGLObjectHandle.java +++ b/opengl/tools/glgen/static/egl/EGLObjectHandle.java @@ -22,12 +22,20 @@ package android.opengl; * */ public abstract class EGLObjectHandle { - private final int mHandle; + private final long mHandle; + // TODO Deprecate EGLObjectHandle(int) method protected EGLObjectHandle(int handle) { mHandle = handle; } - + // TODO Unhide the EGLObjectHandle(long) method + /** + * {@hide} + */ + protected EGLObjectHandle(long handle) { + mHandle = handle; + } + // TODO Deprecate getHandle() method in favor of getNativeHandle() /** * Returns the native handle of the wrapped EGL object. This handle can be * cast to the corresponding native type on the native side. @@ -37,11 +45,27 @@ public abstract class EGLObjectHandle { * @return the native handle of the wrapped EGL object. */ public int getHandle() { - return mHandle; + if ((mHandle & 0xffffffffL) != mHandle) { + throw new UnsupportedOperationException(); + } + return (int)mHandle; } + // TODO Unhide getNativeHandle() method + /** + * {@hide} + */ + public long getNativeHandle() { + return mHandle; + } @Override public int hashCode() { - return getHandle(); + /* + * Based on the algorithm suggested in + * http://developer.android.com/reference/java/lang/Object.html + */ + int result = 17; + result = 31 * result + (int) (mHandle ^ (mHandle >>> 32)); + return result; } } diff --git a/opengl/tools/glgen/static/egl/EGLSurface.java b/opengl/tools/glgen/static/egl/EGLSurface.java index c379dc9..c200f72 100644 --- a/opengl/tools/glgen/static/egl/EGLSurface.java +++ b/opengl/tools/glgen/static/egl/EGLSurface.java @@ -22,7 +22,7 @@ package android.opengl; * */ public class EGLSurface extends EGLObjectHandle { - private EGLSurface(int handle) { + private EGLSurface(long handle) { super(handle); } @@ -32,6 +32,6 @@ public class EGLSurface extends EGLObjectHandle { if (!(o instanceof EGLSurface)) return false; EGLSurface that = (EGLSurface) o; - return getHandle() == that.getHandle(); + return getNativeHandle() == that.getNativeHandle(); } } |