--- old/buildSrc/armv6hf.gradle 2014-03-17 14:33:20.123299788 -0400 +++ new/buildSrc/armv6hf.gradle 2014-03-17 14:33:19.915406404 -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 --- old/modules/graphics/src/main/java/com/sun/glass/ui/monocle/AcceleratedScreen.java 2014-03-17 14:33:20.551080409 -0400 +++ new/modules/graphics/src/main/java/com/sun/glass/ui/monocle/AcceleratedScreen.java 2014-03-17 14:33:20.335191125 -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", --- old/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6Platform.java 2014-03-17 14:33:20.950875380 -0400 +++ new/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6Platform.java 2014-03-17 14:33:20.738984046 -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; + } + } --- old/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6PlatformFactory.java 2014-03-17 14:33:21.338676503 -0400 +++ new/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6PlatformFactory.java 2014-03-17 14:33:21.134781067 -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 2014-03-17 10:39:19.924787893 -0400 +++ new/modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6AcceleratedScreen.java 2014-03-17 14:33:21.522582189 -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 --- /dev/null 2014-03-17 10:39:19.924787893 -0400 +++ new/modules/graphics/src/main/native-glass/monocle/mx6/MX6AcceleratedScreen.c 2014-03-17 14:33:21.902387412 -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 + +#include +#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