changeset 6541:a4f4d7834a8f

Fix for RT-36360 [Monocle] Slight refactor; cache native display in java instead of native code. Reviewed by dblaukopf. Tested with HelloSanity.
author Lisa.Selle@oracle.com
date Tue, 25 Mar 2014 13:30:26 -0400
parents c037c7fb6786
children e260e71603ca
files modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6AcceleratedScreen.java modules/graphics/src/main/native-glass/monocle/mx6/MX6AcceleratedScreen.c
diffstat 2 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6AcceleratedScreen.java	Tue Mar 25 11:05:07 2014 +0100
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6AcceleratedScreen.java	Tue Mar 25 13:30:26 2014 -0400
@@ -31,8 +31,10 @@
 public class MX6AcceleratedScreen extends AcceleratedScreen {
 
     private long fbGetDisplayByIndexHandle, fbCreateWindowHandle;
+    private long cachedNativeDisplay = 0l;
 
-    private native long _platformGetNativeWindow(long methodHandle);
+    private native long _platformGetNativeWindow(long methodHandle,
+                                                 long display);
 
     private native long _platformGetNativeDisplay(long methodHandle);
 
@@ -43,12 +45,13 @@
     @Override
     protected long platformGetNativeWindow() {
         fbCreateWindowHandle = ls.dlsym(getEGLHandle(), "fbCreateWindow");
-        return _platformGetNativeWindow(fbCreateWindowHandle);
+        return _platformGetNativeWindow(fbCreateWindowHandle, cachedNativeDisplay);
     }
 
     @Override
     protected long platformGetNativeDisplay() {
         fbGetDisplayByIndexHandle = ls.dlsym(getEGLHandle(), "fbGetDisplayByIndex");
-        return _platformGetNativeDisplay(fbGetDisplayByIndexHandle);
+        cachedNativeDisplay = _platformGetNativeDisplay(fbGetDisplayByIndexHandle);
+        return cachedNativeDisplay;
     }
-}
\ No newline at end of file
+}
--- a/modules/graphics/src/main/native-glass/monocle/mx6/MX6AcceleratedScreen.c	Tue Mar 25 11:05:07 2014 +0100
+++ b/modules/graphics/src/main/native-glass/monocle/mx6/MX6AcceleratedScreen.c	Tue Mar 25 13:30:26 2014 -0400
@@ -31,10 +31,10 @@
 //Vivante specials
 static EGLNativeDisplayType (*wr_fbGetDisplayByIndex)(int DisplayIndex);
 static EGLNativeWindowType (*wr_fbCreateWindow)(EGLNativeDisplayType Display, int X, int Y, int Width, int Height);
-EGLNativeDisplayType cachedDisplay = NULL;
 
 JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_monocle_mx6_MX6AcceleratedScreen__1platformGetNativeDisplay
     (JNIEnv *env, jobject obj, jlong methodHandle) {
+    EGLNativeDisplayType cachedDisplay = NULL;
 
     if (cachedDisplay == NULL) {
         wr_fbGetDisplayByIndex = asPtr(methodHandle);
@@ -44,10 +44,10 @@
 }
 
 JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_monocle_mx6_MX6AcceleratedScreen__1platformGetNativeWindow
-    (JNIEnv *env, jobject obj, jlong methodHandle) {
+    (JNIEnv *env, jobject obj, jlong methodHandle, jlong nativeDisplay) {
     NativeWindowType retval;
 
     wr_fbCreateWindow = asPtr(methodHandle);
-    retval = wr_fbCreateWindow(cachedDisplay, 0, 0, 0, 0);
+    retval = wr_fbCreateWindow(asPtr(nativeDisplay), 0, 0, 0, 0);
     return asJLong(retval);
 }
\ No newline at end of file