1 /* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. Oracle designates this 7 * particular file as subject to the "Classpath" exception as provided 8 * by Oracle in the LICENSE file that accompanied this code. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 */ 24 25 #include "com_sun_glass_ui_monocle_mx6_MX6AcceleratedScreen.h" 26 #include <EGL/egl.h> 27 28 #include <fcntl.h> 29 #include "Monocle.h" 30 31 //Vivante specials 32 static EGLNativeDisplayType (*wr_fbGetDisplayByIndex)(int DisplayIndex); 33 static EGLNativeWindowType (*wr_fbCreateWindow)(EGLNativeDisplayType Display, int X, int Y, int Width, int Height); 34 EGLNativeDisplayType cachedDisplay = NULL; 35 36 JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_monocle_mx6_MX6AcceleratedScreen__1platformGetNativeDisplay 37 (JNIEnv *env, jobject obj, jlong methodHandle) { 38 39 if (cachedDisplay == NULL) { 40 wr_fbGetDisplayByIndex = asPtr(methodHandle); 41 cachedDisplay = wr_fbGetDisplayByIndex(0); 42 } 43 return asJLong(cachedDisplay); 44 } 45 46 JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_monocle_mx6_MX6AcceleratedScreen__1platformGetNativeWindow 47 (JNIEnv *env, jobject obj, jlong methodHandle) { 48 NativeWindowType retval; 49 50 wr_fbCreateWindow = asPtr(methodHandle); 51 retval = wr_fbCreateWindow(cachedDisplay, 0, 0, 0, 0); 52 return asJLong(retval); 53 }