changeset 6500:a50800b8372c

Fix for RT-35245 [Monocle] EGL setup for Freescale i.MX6 - implements prism es2 on monocle on imx. Currently this is not the default, it can be activated by using runtime flags -Djavafx.platform=monocle -Dembedded=monocle. Tested with HelloSanity.
author Lisa.Selle@oracle.com
date Tue, 18 Mar 2014 09:24:51 -0400
parents 2f2379857779
children 15f389017ffb
files buildSrc/armv6hf.gradle modules/graphics/src/main/java/com/sun/glass/ui/monocle/AcceleratedScreen.java modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6AcceleratedScreen.java modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6Platform.java modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6PlatformFactory.java modules/graphics/src/main/native-glass/monocle/mx6/MX6AcceleratedScreen.c
diffstat 6 files changed, 122 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/buildSrc/armv6hf.gradle	Tue Mar 18 14:17:09 2014 +1300
+++ b/buildSrc/armv6hf.gradle	Tue Mar 18 09:24:51 2014 -0400
@@ -345,6 +345,7 @@
     "com/sun/glass/ui/lens/*",
     "com/sun/glass/ui/monocle/*",
     "com/sun/glass/ui/monocle/dispman/*",
+    "com/sun/glass/ui/monocle/mx6/*",
     "com/sun/glass/ui/monocle/linux/*",
     "com/sun/glass/ui/monocle/util/*",
     "com/sun/glass/ui/monocle/x11/*",
@@ -366,6 +367,7 @@
 ARMV6HF.glass.monocle.nativeSource = [
         file("modules/graphics/src/main/native-glass/monocle"),
         file("modules/graphics/src/main/native-glass/monocle/dispman"),
+        file("modules/graphics/src/main/native-glass/monocle/mx6"),
         file("modules/graphics/src/main/native-glass/monocle/linux"),
         file("modules/graphics/src/main/native-glass/monocle/util") ]
 ARMV6HF.glass.monocle.compiler = compiler
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/AcceleratedScreen.java	Tue Mar 18 14:17:09 2014 +1300
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/AcceleratedScreen.java	Tue Mar 18 09:24:51 2014 -0400
@@ -33,6 +33,7 @@
     private static long eglLibraryHandle;
     protected static boolean initialized = false;
     long eglSurface, eglContext, eglDisplay;
+    protected static LinuxSystem ls = LinuxSystem.getLinuxSystem();
 
     protected long platformGetNativeDisplay() {
         return 0L;
@@ -74,7 +75,6 @@
 
     protected boolean initPlatformLibraries() {
         if (!initialized) {
-            LinuxSystem ls = LinuxSystem.getLinuxSystem();
             glesLibraryHandle = ls.dlopen("libGLESv2.so",
                     LinuxSystem.RTLD_LAZY | LinuxSystem.RTLD_GLOBAL);
             eglLibraryHandle = ls.dlopen("libEGL.so",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6AcceleratedScreen.java	Tue Mar 18 09:24:51 2014 -0400
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.glass.ui.monocle.mx6;
+
+import com.sun.glass.ui.monocle.AcceleratedScreen;
+import com.sun.glass.ui.monocle.linux.LinuxSystem;
+
+public class MX6AcceleratedScreen extends AcceleratedScreen {
+
+    private long fbGetDisplayByIndexHandle, fbCreateWindowHandle;
+
+    private native long _platformGetNativeWindow(long methodHandle);
+
+    private native long _platformGetNativeDisplay(long methodHandle);
+
+    public MX6AcceleratedScreen(int[] attributes) {
+        super(attributes);
+    }
+
+    @Override
+    protected long platformGetNativeWindow() {
+        fbCreateWindowHandle = ls.dlsym(getEGLHandle(), "fbCreateWindow");
+        return _platformGetNativeWindow(fbCreateWindowHandle);
+    }
+
+    @Override
+    protected long platformGetNativeDisplay() {
+        fbGetDisplayByIndexHandle = ls.dlsym(getEGLHandle(), "fbGetDisplayByIndex");
+        return _platformGetNativeDisplay(fbGetDisplayByIndexHandle);
+    }
+}
\ No newline at end of file
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6Platform.java	Tue Mar 18 14:17:09 2014 +1300
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6Platform.java	Tue Mar 18 09:24:51 2014 -0400
@@ -25,9 +25,9 @@
 
 package com.sun.glass.ui.monocle.mx6;
 
+import com.sun.glass.ui.monocle.AcceleratedScreen;
 import com.sun.glass.ui.monocle.NativeCursor;
 import com.sun.glass.ui.monocle.linux.LinuxPlatform;
-import com.sun.glass.ui.monocle.mx6.MX6Cursor;
 
 public class MX6Platform extends LinuxPlatform {
 
@@ -36,4 +36,12 @@
         return new MX6Cursor();
     }
 
+    @Override
+    public synchronized AcceleratedScreen getAcceleratedScreen(int[] attributes) {
+        if (accScreen == null) {
+            accScreen = new MX6AcceleratedScreen(attributes);
+        }
+        return accScreen;
+    }
+
 }
--- a/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6PlatformFactory.java	Tue Mar 18 14:17:09 2014 +1300
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6PlatformFactory.java	Tue Mar 18 09:24:51 2014 -0400
@@ -34,7 +34,9 @@
 
     @Override
     protected boolean matches() {
-        return new File("/sys/devices/platform/Vivante GCCore").exists();
+        boolean retval = new File("/sys/devices/platform/Vivante GCCore:00").exists() ||
+                         new File("/sys/devices/platform/Vivante GCCore").exists();
+        return retval;
     }
 
     @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/graphics/src/main/native-glass/monocle/mx6/MX6AcceleratedScreen.c	Tue Mar 18 09:24:51 2014 -0400
@@ -0,0 +1,53 @@
+/* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "com_sun_glass_ui_monocle_mx6_MX6AcceleratedScreen.h"
+#include <EGL/egl.h>
+
+#include <fcntl.h>
+#include "Monocle.h"
+
+//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) {
+
+    if (cachedDisplay == NULL) {
+        wr_fbGetDisplayByIndex = asPtr(methodHandle);
+        cachedDisplay = wr_fbGetDisplayByIndex(0);
+    }
+    return asJLong(cachedDisplay);
+}
+
+JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_monocle_mx6_MX6AcceleratedScreen__1platformGetNativeWindow
+    (JNIEnv *env, jobject obj, jlong methodHandle) {
+    NativeWindowType retval;
+
+    wr_fbCreateWindow = asPtr(methodHandle);
+    retval = wr_fbCreateWindow(cachedDisplay, 0, 0, 0, 0);
+    return asJLong(retval);
+}
\ No newline at end of file