Skip to content

Instantly share code, notes, and snippets.

@FantomJAC
Created February 20, 2014 23:58
Show Gist options
  • Save FantomJAC/9126012 to your computer and use it in GitHub Desktop.
Save FantomJAC/9126012 to your computer and use it in GitHub Desktop.
OMAP4/5(armv7hf) build patch for OpenJFX8 (b129) based on https://github.com/robclark/kmscube
diff -r b8d6295f4672 build.gradle
--- a/build.gradle Fri Feb 07 13:27:40 2014 -0800
+++ b/build.gradle Thu Feb 20 15:57:51 2014 -0800
@@ -1146,8 +1146,8 @@
if (IS_COMPILE_PANGO) {
// TODO: embedded support
- addNative(project, "fontFreetype", ["linux"])
- addNative(project, "fontPango", ["linux"])
+ addNative(project, "fontFreetype", ["linux", "armv7hf"])
+ addNative(project, "fontPango", ["linux", "armv7hf"])
}
if (IS_WINDOWS) {
@@ -2561,7 +2561,7 @@
def libs = ['font', 'prism', 'prismSW', 'prismES2', 'glass', 'iio']
if (IS_COMPILE_PANGO) {
// TODO: embedded support
- if ("${defaultHostTarget}" == "${t.name}") {
+ if ("${defaultHostTarget}" == "${t.name}" || "armv7hf" == "${t.name}") {
libs += ['fontFreetype', 'fontPango'];
}
}
diff -r b8d6295f4672 buildSrc/armv7hf.gradle
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildSrc/armv7hf.gradle Thu Feb 20 15:57:51 2014 -0800
@@ -0,0 +1,503 @@
+/*
+ * Copyright (c) 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.
+ */
+
+/*
+ * ARMv7HF Pandaboard w/ Yocto Poky/Dylan build.
+ *
+ * Author: Shotaro Uchida <[email protected]>
+ */
+
+ext.ARMV7HF = [:]
+
+// We should create toolchain using crosslibs-armv7hf.sh
+//fetchExternalTools('ARMV7HF',
+// ["armhf-beagleboard-00.tgz",
+// "gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.xz" ],
+// rootProject.CROSS_TOOLS_DIR, rootProject.IS_IMPORT_CROSS_TOOLS)
+
+// Define the location of the sdk and toolchain
+def sdk=file("${rootProject.CROSS_TOOLS_DIR}/armhf-pandaboard-00")
+def compilerHome=file("${rootProject.CROSS_TOOLS_DIR}/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux")
+
+// Declare whether this particular target file applies to the current system
+ARMV7HF.canBuild = IS_LINUX && compilerHome.exists() && sdk.exists()
+if (!ARMV7HF.canBuild) {
+ if (!compilerHome.exists()) println "ERROR: Mising compiler $compilerHome"
+ if (!sdk.exists()) println "ERROR: Mising sdk $sdk"
+ return;
+}
+
+// Lambda for naming the generated libs
+ARMV7HF.library = { name -> return "lib${name}.so" as String }
+
+// alias for this platform in legacy artifacts
+ARMV7HF.artifactsName = "armv7hf-vfp"
+
+ARMV7HF.compileSwing = false;
+ARMV7HF.compileSWT = false;
+ARMV7HF.compileFXPackager = false;
+ARMV7HF.compileDesignTime = false;
+
+// Libraries end up in the sdk/rt/lib/arm directory for arm builds
+ARMV7HF.libDest = "lib/arm"
+
+// TODO this is garbage. Each target file should define what it includes,
+// not what it excludes.
+ARMV7HF.jfxrtJarExcludes = [
+ "**/*.hlsl",
+ "com/sun/glass/ui/win",
+ "com/sun/glass/ui/accessible/win",
+ "com/sun/prism/d3d",
+ "com/sun/prism/es2/gl/win",
+ //"com/sun/prism/null3d",
+ "com/sun/scenario/effect/impl/hw/d3d",
+
+ "com/sun/glass/events/mac",
+ "com/sun/glass/ui/mac",
+ "com/sun/glass/ui/accessible/mac",
+ "com/sun/prism/es2/gl/mac",
+
+ "com/sun/glass/ui/android",
+
+ "com/sun/glass/ui/ios",
+
+ "com/sun/glass/ui/swt", // SWT glass
+
+ "javafx/embed/swing", // Swing Interop
+
+ "javafx/embed/swt", // SWT Interop
+
+ "com/sun/prism/es2/MacGL*",
+ "com/sun/prism/es2/IOSGL*",
+ "com/sun/prism/es2/WinGL*",
+]
+
+def commonFlags = [
+ "-fno-strict-aliasing", "-fPIC", "-fno-omit-frame-pointer", // optimization flags
+ "-W", "-Wall", "-Wno-unused", "-Wno-parentheses", "-Werror=implicit-function-declaration"] // warning flags
+// Specify the compilation parameters and link parameters
+def ccFlags = [
+ commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c",
+ IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten()
+//ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
+def linkFlags = ["-shared", commonFlags].flatten()
+
+// Specify the compilation parameters and link parameters
+def extraCFlags = [
+ "-I", "-L",
+ ccFlags,
+ "-marm", "-mfloat-abi=hard", "-mfpu=vfp",
+ "-I$sdk/usr/include",
+ "-DOMAP3", "-DUSE_KMS"].flatten();
+
+//See if we should build for imx6
+def imxHeader=file("$sdk/usr/include/linux/mxcfb.h")
+if (imxHeader.exists()) {
+ extraCFlags = [extraCFlags,"-DIMX6_PLATFORM"].flatten();
+}
+
+def extraLFlags = [
+ "-I", "-L",
+ linkFlags,
+ "-L$sdk/usr/lib"].flatten()
+
+def lensLFlags = [extraLFlags, "-lpthread", "-ludev", "-ldl", "-lm"].flatten()
+
+def fontCFlags = [extraCFlags].flatten()
+def fontLFlags = [extraLFlags].flatten()
+
+def iioCFlags = [extraCFlags].flatten()
+def iioLFlags = [extraLFlags].flatten()
+
+def es2EglfbCFlags = [extraCFlags, "-DIS_EGLFB", "-DLINUX", "-DDEBUG"].flatten()
+def es2EglfbLFlags = [extraLFlags].flatten()
+
+def es2X11CFlags = [extraCFlags, "-DUSE_XSHM", "-DDEBUG", "-DIS_EGLX11", "-DLINUX"].flatten()
+def es2X11LFlags = [extraLFlags, "-lX11", "-lXext", "-lXdmcp", "-lXau"].flatten()
+
+def mediaCFlags = [extraCFlags,
+ "-I$sdk/usr/include/gstreamer-0.10",
+ "-I$sdk/usr/include/glib-2.0",
+ "-DENABLE_NATIVE_SOURCE=1", "-DENABLE_GST_FFMPEG=1"].flatten()
+def mediaLFlags = [extraLFlags, "-lgstreamer-0.10", "-lgstapp-0.10",
+ "-lgstbase-0.10", "-lglib-2.0", "-lgobject-2.0", "-lgmodule-2.0", "-lgthread-2.0"].flatten()
+
+def webCFlags = [extraCFlags].flatten()
+def webLFlags = [extraLFlags].flatten()
+
+// libraries to remove from the SDK
+//deploy.trim.public.library.filter= \
+// fxavcodecplugin-52.so \
+// fxavcodecplugin-53.so \
+// fxplugins.so \
+// libjfxwebkit.so \
+// libgstplugins-lite.so \
+// libgstreamer-lite.so \
+// libprism-es2-eglx11.so \
+// libglass_lens_fb.so \
+
+def gtkCFlags = [extraCFlags].flatten()
+def gtkLFlags = [extraLFlags].flatten()
+setupTools("armv7hf_tools",
+ { propFile ->
+ ByteArrayOutputStream results = new ByteArrayOutputStream();
+ exec {
+ commandLine("$sdk/bin/pkg-config", "--cflags", "gtk+-2.0", "gthread-2.0", "xtst");
+ setStandardOutput(results);
+ }
+ propFile << "cflags=" << results.toString().trim() << "\n";
+
+ results = new ByteArrayOutputStream();
+ exec {
+ commandLine "$sdk/bin/pkg-config", "--libs", "gtk+-2.0", "gthread-2.0", "xtst"
+ standardOutput = results
+ }
+ propFile << "libs=" << results.toString().trim();
+ },
+ { properties ->
+ gtkCFlags.addAll(properties.getProperty("cflags").split(" "))
+ gtkLFlags.addAll(properties.getProperty("libs").split(" "))
+ }
+)
+
+ARMV7HF.javafxPlatformProperties ="""javafx.platform=eglfb
+directfb.com.sun.javafx.scene.control.skin.ListViewSkin.pannable=true
+directfb.com.sun.javafx.scene.control.skin.TreeViewSkin.pannable=true
+directfb.com.sun.javafx.scene.control.skin.TableViewSkin.pannable=true
+directfb.glass.platform=Lens
+directfb.glass.lens=dfb
+directfb.prism.order=sw
+directfb.com.sun.javafx.isEmbedded=true
+directfb.com.sun.javafx.scene.control.skin.FXVK.cache=true
+eglfb.com.sun.javafx.scene.control.skin.ListViewSkin.pannable=true
+eglfb.com.sun.javafx.scene.control.skin.TreeViewSkin.pannable=true
+eglfb.com.sun.javafx.scene.control.skin.TableViewSkin.pannable=true
+eglfb.glass.platform=Lens
+eglfb.glass.lens=eglfb
+eglfb.prism.order=es2
+eglfb.prism.eglfb=true
+eglfb.prism.lcdtext=false
+eglfb.prism.maxvram=128m
+eglfb.prism.targetvram=112m
+eglfb.use.egl=true
+eglfb.use.gles2=true
+eglfb.embedded=eglfb
+eglfb.com.sun.javafx.isEmbedded=true
+eglfb.doNativeComposite=true
+eglfb.com.sun.javafx.scene.control.skin.FXVK.cache=true
+eglfb.prism.glDepthSize=0
+fb.com.sun.javafx.scene.control.skin.ListViewSkin.pannable=true
+fb.com.sun.javafx.scene.control.skin.TreeViewSkin.pannable=true
+fb.com.sun.javafx.scene.control.skin.TableViewSkin.pannable=true
+fb.glass.platform=Lens
+fb.glass.lens=fb
+fb.prism.order=sw
+fb.com.sun.javafx.isEmbedded=true
+fb.glass.restrictWindowToScreen=true
+fb.com.sun.javafx.scene.control.skin.FXVK.cache=true
+eglx11.com.sun.javafx.scene.control.skin.ListViewSkin.pannable=true
+eglx11.com.sun.javafx.scene.control.skin.TreeViewSkin.pannable=true
+eglx11.com.sun.javafx.scene.control.skin.TableViewSkin.pannable=true
+eglx11.glass.platform=Lens
+eglx11.glass.lens=eglx11
+eglx11.prism.order=es2
+eglx11.prism.eglx11=true
+eglx11.prism.lcdtext=false
+eglx11.prism.maxvram=128m
+eglx11.prism.targetvram=112m
+eglx11.use.egl=true
+eglx11.use.gles2=true
+eglx11.embedded=eglx11
+eglx11.com.sun.javafx.isEmbedded=true
+eglx11.com.sun.javafx.scene.control.skin.FXVK.cache=true
+eglx11.prism.glDepthSize=0
+gtk.com.sun.javafx.scene.control.skin.ListViewSkin.pannable=true
+gtk.com.sun.javafx.scene.control.skin.TreeViewSkin.pannable=true
+gtk.com.sun.javafx.scene.control.skin.TableViewSkin.pannable=true
+gtk.glass.platform=gtk
+gtk.prism.order=sw
+gtk.com.sun.javafx.isEmbedded=true
+gtk.com.sun.javafx.scene.control.skin.FXVK.cache=true"""
+
+def pangoCCFlags = [extraCFlags, "-D_ENABLE_PANGO"];
+def pangoLinkFlags = [extraLFlags];
+setupTools("armv7hf_pango_tools",
+ { propFile ->
+ ByteArrayOutputStream results = new ByteArrayOutputStream();
+ exec {
+ commandLine "$sdk/bin/pkg-config", "--cflags", "pangoft2"
+ standardOutput = results
+ }
+ propFile << "cflags=" << results.toString().trim() << "\n";
+
+ results = new ByteArrayOutputStream();
+ exec {
+ commandLine "$sdk/bin/pkg-config", "--libs", "pangoft2"
+ standardOutput = results
+ }
+ propFile << "libs=" << results.toString().trim();
+ },
+ { properties ->
+ pangoCCFlags.addAll(properties.getProperty("cflags").split(" "))
+ pangoLinkFlags.addAll(properties.getProperty("libs").split(" "))
+ }
+)
+
+def freetypeCCFlags = [ext.COMPILE_PANGO ? "-D_ENABLE_PANGO" :
+ ext.COMPILE_HARFBUZZ ? "-D_ENABLE_HARFBUZZ" : ""]
+def freetypeLinkFlags = []
+setupTools("armv7hf_freetype_tools",
+ { propFile ->
+ ByteArrayOutputStream results = new ByteArrayOutputStream();
+ exec {
+ commandLine "$sdk/bin/pkg-config", "--cflags", "freetype2"
+ standardOutput = results
+ }
+ propFile << "cflags=" << results.toString().trim() << "\n";
+
+ results = new ByteArrayOutputStream();
+ exec {
+ commandLine "$sdk/bin/pkg-config", "--libs", "freetype2"
+ standardOutput = results
+ }
+ propFile << "libs=" << results.toString().trim();
+ },
+ { properties ->
+ freetypeCCFlags.addAll(properties.getProperty("cflags").split(" "))
+ freetypeLinkFlags.addAll(properties.getProperty("libs").split(" "))
+ }
+)
+
+def compiler = file("$compilerHome/bin/arm-linux-gnueabihf-gcc").getAbsolutePath()
+def linker = file("$compilerHome/bin/arm-linux-gnueabihf-g++").getAbsolutePath()
+
+ARMV7HF.glass = [:]
+ARMV7HF.glass.variants = ["eglfb", "directfb", "fb", "gtk", "lensport" ]
+ARMV7HF.glass.javahInclude = [
+ "com/sun/glass/events/**",
+ "com/sun/glass/ui/*",
+ "com/sun/glass/ui/lens/*",
+ "com/sun/glass/ui/gtk/*",
+ "com/sun/glass/ui/accessible/gtk/*"]
+ARMV7HF.glass.lib = "glass"
+
+ARMV7HF.glass.lensport = [:]
+ARMV7HF.glass.lensport.nativeSource = [
+ file("modules/graphics/src/main/native-glass/lens/lensport") ]
+ARMV7HF.glass.lensport.compiler = compiler
+ARMV7HF.glass.lensport.ccFlags = ["-ffast-math", extraCFlags, "-DLINUX", "-DISEGLFB",
+ "-DLENSPORT", "-I$sdk/usr/include/libdrm", "-I$sdk/usr/include/gbm", "-I", file("modules/graphics/src/main/native-glass/lens/") ].flatten()
+ARMV7HF.glass.lensport.linker = linker
+ARMV7HF.glass.lensport.linkFlags = [lensLFlags, "-ldrm", "-lgbm"].flatten()
+ARMV7HF.glass.lensport.lib = "lens_porting"
+
+ARMV7HF.glass.eglfb = [:]
+// TODO when building headless, use lens/cursor/nullcursor/
+// otherwise we use lens/cursor/fbCursor/ and lens/input/udev
+
+// TODO when USE_RFB is specified use lens/rfb
+
+// TODO use /eglfb/x11ContainerScreen when using eglfb and EGL_X11_FB_CONTAINER
+// TODO use /headless/headlessScreen when using headless
+ARMV7HF.glass.eglfb.nativeSource = [
+ file("modules/graphics/src/main/native-glass/lens"),
+ file("modules/graphics/src/main/native-glass/lens/wm"),
+ file("modules/graphics/src/main/native-glass/lens/cursor/fbCursor"),
+ file("modules/graphics/src/main/native-glass/lens/input/udev"),
+ file("modules/graphics/src/main/native-glass/lens/wm/screen/fbdevScreen.c") ]
+ARMV7HF.glass.eglfb.compiler = compiler
+ARMV7HF.glass.eglfb.ccFlags = ["-ffast-math", extraCFlags, "-DLINUX", "-DISEGLFB"].flatten()
+ARMV7HF.glass.eglfb.linker = linker
+ARMV7HF.glass.eglfb.linkFlags = [lensLFlags].flatten()
+ARMV7HF.glass.eglfb.lib = "glass_lens_eglfb"
+
+ARMV7HF.glass.directfb = [:]
+ARMV7HF.glass.directfb.nativeSource = [
+ file("modules/graphics/src/main/native-glass/lens"),
+ file("modules/graphics/src/main/native-glass/lens/wm"),
+ file("modules/graphics/src/main/native-glass/lens/cursor/fbCursor"),
+ file("modules/graphics/src/main/native-glass/lens/input/udev"),
+ file("modules/graphics/src/main/native-glass/lens/wm/screen/dfbScreen.c") ]
+ARMV7HF.glass.directfb.compiler = compiler
+ARMV7HF.glass.directfb.ccFlags = ["-ffast-math", extraCFlags, "-I$sdk/usr/include/directfb", "-DLINUX"].flatten()
+ARMV7HF.glass.directfb.linker = linker
+ARMV7HF.glass.directfb.linkFlags = [lensLFlags].flatten()
+ARMV7HF.glass.directfb.lib = "glass_lens_dfb"
+
+ARMV7HF.glass.fb = [:]
+ARMV7HF.glass.fb.nativeSource = [
+ file("modules/graphics/src/main/native-glass/lens"),
+ file("modules/graphics/src/main/native-glass/lens/wm"),
+ file("modules/graphics/src/main/native-glass/lens/cursor/fbCursor"),
+ file("modules/graphics/src/main/native-glass/lens/input/udev"),
+ file("modules/graphics/src/main/native-glass/lens/wm/screen/fbdevScreen.c") ]
+ARMV7HF.glass.fb.compiler = compiler
+ARMV7HF.glass.fb.ccFlags = ["-ffast-math", extraCFlags, "-DLINUX"].flatten()
+ARMV7HF.glass.fb.linker = linker
+ARMV7HF.glass.fb.linkFlags = [lensLFlags].flatten()
+ARMV7HF.glass.fb.lib = "glass_lens_fb"
+
+ARMV7HF.glass.eglx11 = [:]
+ARMV7HF.glass.eglx11.nativeSource = [
+ file("modules/graphics/src/main/native-glass/lens"),
+ file("modules/graphics/src/main/native-glass/lens/wm"),
+ file("modules/graphics/src/main/native-glass/lens/cursor/fbCursor"),
+ file("modules/graphics/src/main/native-glass/lens/input/udev"),
+ file("modules/graphics/src/main/native-glass/lens/wm/screen/x11ContainerScreen.c")]
+ //file("modules/graphics/src/main/native-glass/lens/wm/screen")]
+ARMV7HF.glass.eglx11.compiler = compiler
+ARMV7HF.glass.eglx11.ccFlags = ["-ffast-math", extraCFlags, "-DLINUX"].flatten()
+ARMV7HF.glass.eglx11.linker = linker
+ARMV7HF.glass.eglx11.linkFlags = [lensLFlags].flatten()
+ARMV7HF.glass.eglx11.lib = "glass_lens_eglx11"
+
+ARMV7HF.glass.gtk = [:]
+ARMV7HF.glass.gtk.nativeSource = file("modules/graphics/src/main/native-glass/gtk")
+ARMV7HF.glass.gtk.compiler = compiler
+ARMV7HF.glass.gtk.ccFlags = ["-ffast-math", gtkCFlags, "-DLINUX"].flatten()
+ARMV7HF.glass.gtk.linker = linker
+ARMV7HF.glass.gtk.linkFlags = [gtkLFlags, "-lstdc++"].flatten()
+ARMV7HF.glass.gtk.lib = "glass"
+
+ARMV7HF.decora = [:]
+ARMV7HF.decora.compiler = compiler
+ARMV7HF.decora.ccFlags = extraCFlags
+ARMV7HF.decora.linker = linker
+ARMV7HF.decora.linkFlags = extraLFlags
+ARMV7HF.decora.lib = "decora_sse"
+
+ARMV7HF.prism = [:]
+ARMV7HF.prism.javahInclude = ["com/sun/prism/impl/**/*", "com/sun/prism/PresentableState*"]
+ARMV7HF.prism.nativeSource = file("modules/graphics/src/main/native-prism")
+ARMV7HF.prism.compiler = compiler
+ARMV7HF.prism.ccFlags = [extraCFlags].flatten()
+ARMV7HF.prism.linker = linker
+ARMV7HF.prism.linkFlags = [extraLFlags, "-lX11", "-lXext", "-lXdmcp", "-lXau"].flatten()
+ARMV7HF.prism.lib = "prism_common"
+
+ARMV7HF.prismSW = [:]
+ARMV7HF.prismSW.javahInclude = ["com/sun/pisces/**/*"]
+ARMV7HF.prismSW.nativeSource = file("modules/graphics/src/main/native-prism-sw")
+ARMV7HF.prismSW.compiler = compiler
+ARMV7HF.prismSW.ccFlags = [extraCFlags].flatten()
+ARMV7HF.prismSW.linker = linker
+ARMV7HF.prismSW.linkFlags = [extraLFlags].flatten()
+ARMV7HF.prismSW.lib = "prism_sw"
+
+ARMV7HF.iio = [:]
+ARMV7HF.iio.javahInclude = ["com/sun/javafx/iio/**/*"]
+ARMV7HF.iio.nativeSource = [
+ file("modules/graphics/src/main/native-iio"),
+ file("modules/graphics/src/main/native-iio/libjpeg7")]
+ARMV7HF.iio.compiler = compiler
+ARMV7HF.iio.ccFlags = iioCFlags
+ARMV7HF.iio.linker = linker
+ARMV7HF.iio.linkFlags = iioLFlags
+ARMV7HF.iio.lib = "javafx_iio"
+
+ARMV7HF.prismES2 = [:]
+ARMV7HF.prismES2.variants = ["eglfb"]
+ARMV7HF.prismES2.javahInclude = ["com/sun/prism/es2/**/*"]
+
+ARMV7HF.prismES2.eglfb = [:]
+ARMV7HF.prismES2.eglfb.nativeSource = [
+ file("modules/graphics/src/main/native-prism-es2"),
+ file("modules/graphics/src/main/native-prism-es2/GL"),
+ file("modules/graphics/src/main/native-prism-es2/eglfb")
+]
+ARMV7HF.prismES2.eglfb.compiler = compiler
+ARMV7HF.prismES2.eglfb.ccFlags = [ es2EglfbCFlags, "-I", ARMV7HF.glass.lensport.nativeSource ].flatten()
+ARMV7HF.prismES2.eglfb.linker = linker
+ARMV7HF.prismES2.eglfb.linkFlags = es2EglfbLFlags
+ARMV7HF.prismES2.eglfb.lib = "prism_es2_eglfb"
+
+ARMV7HF.prismES2.eglx11 = [:]
+ARMV7HF.prismES2.eglx11.nativeSource = [
+ file("modules/graphics/src/main/native-prism-es2"),
+ file("modules/graphics/src/main/native-prism-es2/GL"),
+ file("modules/graphics/src/main/native-prism-es2/eglx11")
+]
+ARMV7HF.prismES2.eglx11.compiler = compiler
+ARMV7HF.prismES2.eglx11.ccFlags = es2X11CFlags
+ARMV7HF.prismES2.eglx11.linker = linker
+ARMV7HF.prismES2.eglx11.linkFlags = es2X11LFlags
+ARMV7HF.prismES2.eglx11.lib = "prism_es2_eglx11"
+
+def closedDir = file("$projectDir/../rt-closed")
+ARMV7HF.font = [:]
+ARMV7HF.font.javahInclude = [
+ "com/sun/javafx/font/**/*",
+ "com/sun/javafx/text/**/*"]
+ARMV7HF.font.nativeSource = [file("modules/graphics/src/main/native-font")]
+ARMV7HF.font.compiler = compiler
+ARMV7HF.font.ccFlags = fontCFlags
+ARMV7HF.font.linker = linker
+ARMV7HF.font.linkFlags = fontLFlags
+ARMV7HF.font.lib = "javafx_font"
+
+ARMV7HF.fontT2K = [:]
+ARMV7HF.fontT2K.javahInclude = ["com/sun/javafx/font/t2k/**/*"]
+ARMV7HF.fontT2K.nativeSource = [
+ file("$closedDir/javafx-font-t2k-native/src"),
+ file("$closedDir/javafx-font-t2k-native/src/layout")]
+ARMV7HF.fontT2K.compiler = compiler
+ARMV7HF.fontT2K.ccFlags = [fontCFlags, "-DLE_STANDALONE"].flatten()
+ARMV7HF.fontT2K.linker = linker
+ARMV7HF.fontT2K.linkFlags = fontLFlags
+ARMV7HF.fontT2K.lib = "javafx_font_t2k"
+
+ARMV7HF.fontFreetype = [:]
+ARMV7HF.fontFreetype.javahInclude = ["com/sun/javafx/font/freetype/OSFreetype.class*"]
+ARMV7HF.fontFreetype.nativeSource = ["src/main/native-font/freetype.c"]
+ARMV7HF.fontFreetype.compiler = compiler
+ARMV7HF.fontFreetype.ccFlags = ["-DJFXFONT_PLUS", ccFlags, fontCFlags, freetypeCCFlags].flatten()
+ARMV7HF.fontFreetype.linker = linker
+ARMV7HF.fontFreetype.linkFlags = [linkFlags, fontLFlags, freetypeLinkFlags].flatten()
+ARMV7HF.fontFreetype.lib = "javafx_font_freetype"
+
+ARMV7HF.fontPango = [:]
+ARMV7HF.fontPango.javahInclude = ["com/sun/javafx/font/freetype/OSPango.class"]
+ARMV7HF.fontPango.nativeSource = ["src/main/native-font/pango.c"]
+ARMV7HF.fontPango.compiler = compiler
+ARMV7HF.fontPango.ccFlags = ["-DJFXFONT_PLUS", ccFlags, pangoCCFlags].flatten()
+ARMV7HF.fontPango.linker = linker
+ARMV7HF.fontPango.linkFlags = [linkFlags, pangoLinkFlags].flatten()
+ARMV7HF.fontPango.lib = "javafx_font_pango"
+
+ARMV7HF.webkit = [:]
+ARMV7HF.webkit.binDir = "$compilerHome/bin"
+ARMV7HF.webkit.compiler = compiler
+ARMV7HF.webkit.linker = linker
+ARMV7HF.webkit.ar = file("$compilerHome/bin/arm-linux-gnueabihf-ar").getAbsolutePath()
+ARMV7HF.webkit.objcopy = file("$compilerHome/bin/arm-linux-gnueabihf-objcopy").getAbsolutePath()
+ARMV7HF.webkit.strip = file("$compilerHome/bin/arm-linux-gnueabihf-strip").getAbsolutePath()
+ARMV7HF.webkit.ccFlags = extraCFlags.join(' ')
+ARMV7HF.webkit.linkFlags = extraLFlags.join(' ')
+
+ARMV7HF.media = [:]
+ARMV7HF.media.compiler = compiler
+ARMV7HF.media.linker = linker
+ARMV7HF.media.extra_cflags = mediaCFlags.join(' ')
+ARMV7HF.media.extra_ldflags = mediaLFlags.join(' ')
diff -r b8d6295f4672 buildSrc/crosslibs/crosslibs-armv7hf.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildSrc/crosslibs/crosslibs-armv7hf.sh Thu Feb 20 15:57:51 2014 -0800
@@ -0,0 +1,187 @@
+#!/bin/bash
+#
+# Copyright (c) 2013 Shotaro Uchida <[email protected]>
+#
+# Script for Yocto Poky/Dylan
+#
+
+if [ -z $1 ]; then
+ echo "usage: crosslibs-armv7hf.sh ROOTFS"
+ exit 1
+else
+ FS=$1
+fi
+
+confirm() {
+ echo -n "Is this correct? [Y/n]: "
+ read -n 1 -r
+ echo
+ if [[ $REPLY == "y" || $REPLY == "Y" || $REPLY == "" ]]; then
+ CONFIRMED=1
+ else
+ CONFIRMED=0
+ fi
+}
+
+checkReinstall() {
+ if [[ -d $1 ]]; then
+ echo
+ echo $1 already exists.
+ echo -n "Delete and re-install? [y/N]: "
+ read -n 1 -r
+ echo
+ if [[ $REPLY == "y" || $REPLY == "Y" ]]; then
+ /bin/rm -rf $1
+ fi
+ fi
+}
+
+installPokyLibs() {
+ echo Using $FS as the Poky filesystem
+
+ echo Copying files to $POKYLIBS
+ mkdir -p $POKYLIBS
+ cd $FS
+ cp --parents -rdt $POKYLIBS \
+ usr/include/atk-1.0 \
+ usr/include/cairo \
+ usr/include/directfb \
+ usr/include/fontconfig \
+ usr/include/freetype2 \
+ usr/include/ft2build.h \
+ usr/include/gdk-pixbuf-2.0/ \
+ usr/include/gio-unix-2.0/ \
+ usr/include/glib-2.0 \
+ usr/include/gstreamer-0.10 \
+ usr/include/gtk-2.0 \
+ usr/include/libudev.h \
+ usr/include/libpng16 \
+ usr/include/libxml2 \
+ usr/include/libxslt \
+ usr/include/linux \
+ usr/include/pango-1.0 \
+ usr/include/pixman-1 \
+ usr/include/X11 \
+ usr/include/xcb \
+ usr/include/zlib.h \
+ usr/include/EGL \
+ usr/include/GLES2 \
+ usr/include/KHR \
+ usr/include/xf86drm.h \
+ usr/include/xf86drmMode.h \
+ usr/include/libdrm \
+ usr/include/gbm \
+ usr/lib/glib-2.0/include \
+ usr/lib/gtk-2.0/include \
+ \
+ usr/lib/libudev* \
+ usr/lib/libasound* \
+ usr/lib/libatk-1.0* \
+ usr/lib/libcairo* \
+ usr/lib/libdirect* \
+ usr/lib/libdirectfb* \
+ usr/lib/libfontconfig* \
+ usr/lib/libfreetype* \
+ usr/lib/libfusion* \
+ usr/lib/libgdk-x11-2.0* \
+ usr/lib/libgdk_pixbuf-2.0* \
+ usr/lib/libgio-2.0* \
+ usr/lib/libGL* \
+ usr/lib/libglib-2.0* \
+ usr/lib/libgmodule-2.0* \
+ usr/lib/libgobject-2.0* \
+ usr/lib/libgst* \
+ usr/lib/libgthread-2.0* \
+ usr/lib/libgtk-x11-2.0* \
+ usr/lib/libm.* \
+ usr/lib/libpango-1.0* \
+ usr/lib/libpangocairo-1.0* \
+ usr/lib/libpangoft2-1.0* \
+ usr/lib/libpthread_nonshared.a \
+ usr/lib/librt* \
+ usr/lib/librt* \
+ usr/lib/libX11* \
+ usr/lib/libXau* \
+ usr/lib/libxcb* \
+ usr/lib/libXdmcp* \
+ usr/lib/libXext* \
+ usr/lib/libXtst.so* \
+ usr/lib/libxml2.so* \
+ usr/lib/libxslt.so* \
+ usr/lib/libz* \
+ usr/lib/libdrm* \
+ usr/lib/libgbm* \
+ \
+ usr/lib/pkgconfig \
+ usr/lib/pkgconfig \
+ usr/share/pkgconfig \
+ lib/libpthread* \
+ lib/libudev* \
+ \
+ |& grep -v warning
+
+ cat > $POKYLIBS/usr/lib/libpthread.so << EOF
+OUTPUT_FORMAT(elf32-littlearm)
+GROUP ( ../../lib/libpthread.so.0 libpthread_nonshared.a )
+EOF
+ if [[ ! $? -eq 0 ]]; then
+ echo libpthread patch failed.
+ exit 1
+ fi
+
+# Install an alternative pkg-config
+ mkdir -p $POKYLIBS/bin || exit 1
+ cp $SCRIPTDIR/pkg-config $POKYLIBS/bin || exit 1
+ chmod +x $POKYLIBS/bin/pkg-config || exit 1
+
+# Patch package configuration files
+ find $POKYLIBS/usr -name "*.pc" | xargs sed -i -e "s:=/usr/:=\${prefix}/:"
+ if [[ ! $? -eq 0 ]]; then
+ echo pkg-config patch failed.
+ exit 1
+ fi
+}
+
+installCrossCompiler() {
+ echo
+ echo Fetching and unpacking compiler in $CROSSLIBS
+ echo
+ echo "NOTE: if you use a proxy server then this download will probably fail. In that"
+ echo "case you need to set a value for the environment variable https_proxy and run"
+ echo "this script again."
+ echo
+ COMPILER_URL=https://launchpad.net/linaro-toolchain-binaries/trunk/2013.10/+download/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.xz
+ wget -c $COMPILER_URL -O ${CROSSCOMPILER}.tar.gz
+ tar xJf ${CROSSCOMPILER}.tar.gz -C $CROSSLIBS
+}
+
+SCRIPTDIR=`dirname $0`
+SCRIPTDIR=`cd $SCRIPTDIR ; pwd`
+RT=`cd $SCRIPTDIR/../.. ; pwd`
+
+echo Using OpenJFX working directory at $RT
+confirm()
+if [[ $CONFIRMED -eq 0 ]]; then
+ echo -n "Enter the location of the OpenJFX working directory: "
+ read RT
+fi
+
+CROSSLIBS=`dirname $RT`/crosslibs
+echo Using crosslibs directory $CROSSLIBS
+
+mkdir -p $CROSSLIBS || exit 1
+
+POKYLIBS=$CROSSLIBS/armhf-pandaboard-00
+
+checkReinstall $POKYLIBS
+if [[ ! -d $POKYLIBS ]]; then
+ installPokyLibs
+fi
+
+CROSSCOMPILER=$CROSSLIBS/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux
+checkReinstall $CROSSCOMPILER
+if [[ ! -d $CROSSCOMPILER ]]; then
+ installCrossCompiler
+fi
+
+echo Done.
diff -r b8d6295f4672 modules/graphics/src/main/native-glass/lens/lensport/initPlatform.c
--- a/modules/graphics/src/main/native-glass/lens/lensport/initPlatform.c Fri Feb 07 13:27:40 2014 -0800
+++ b/modules/graphics/src/main/native-glass/lens/lensport/initPlatform.c Thu Feb 20 15:57:51 2014 -0800
@@ -105,6 +105,7 @@
extern void* util_getNativeWindowType(void);
extern void* util_getNativeDisplayType(void);
extern void* util_wr_eglGetDisplay(void *);
+extern unsigned int util_wr_eglSwapBuffers(void *, void *);
extern void* util_getLibGLEShandle(void);
jboolean prism_platform_initialize(PrismNativePort* prismPort) {
@@ -120,6 +121,7 @@
prismPort->getNativeWindowType = &util_getNativeWindowType;
prismPort->getNativeDisplayType = &util_getNativeDisplayType;
prismPort->wr_eglGetDisplay = &util_wr_eglGetDisplay;
+ prismPort->wr_eglSwapBuffers = &util_wr_eglSwapBuffers;
prismPort->getLibGLEShandle = &util_getLibGLEShandle;
return JNI_TRUE;
diff -r b8d6295f4672 modules/graphics/src/main/native-glass/lens/lensport/lensPort.h
--- a/modules/graphics/src/main/native-glass/lens/lensport/lensPort.h Fri Feb 07 13:27:40 2014 -0800
+++ b/modules/graphics/src/main/native-glass/lens/lensport/lensPort.h Thu Feb 20 15:57:51 2014 -0800
@@ -67,6 +67,7 @@
//returns a EGLNativeDisplayType
void * (*getNativeDisplayType)();
void * (*wr_eglGetDisplay)(void *id);
+ void * (*wr_eglSwapBuffers)(void *display, void *surface);
void * (*getLibGLEShandle)();
} PrismNativePort;
diff -r b8d6295f4672 modules/graphics/src/main/native-glass/lens/lensport/wrapped_functions.c
--- a/modules/graphics/src/main/native-glass/lens/lensport/wrapped_functions.c Fri Feb 07 13:27:40 2014 -0800
+++ b/modules/graphics/src/main/native-glass/lens/lensport/wrapped_functions.c Thu Feb 20 15:57:51 2014 -0800
@@ -70,6 +70,46 @@
int useDispman = 0;
int useVivanteFB = 0;
+#ifdef USE_KMS
+//For KMS/DRM
+
+#include <errno.h>
+#include <xf86drm.h>
+#include <xf86drmMode.h>
+#include <gbm.h>
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#define MAX_DISPLAYS (4)
+//#define CONNECTOR_ID -1
+//#define ALL_DISPLAY
+
+static uint8_t DISP_ID = 0; /* Use the first display. */
+
+static struct gbm_bo *bo = NULL;
+static fd_set fds;
+
+static struct {
+ struct gbm_device *dev;
+ struct gbm_surface *surface;
+} gbm;
+
+static struct {
+ int fd;
+ uint32_t ndisp;
+ uint32_t crtc_id[MAX_DISPLAYS];
+ uint32_t connector_id[MAX_DISPLAYS];
+ drmModeModeInfo *mode[MAX_DISPLAYS];
+ drmModeConnector *connectors[MAX_DISPLAYS];
+} drm;
+
+struct drm_fb {
+ struct gbm_bo *bo;
+ uint32_t fb_id;
+};
+
+#endif /* USE_KMS */
+int useKMS = 0;
+
#define DEBUG
#ifdef DEBUG
@@ -92,6 +132,183 @@
void *libglesv2;
void *libegl;
+/*************************************** KMS/DRM ******************************************/
+
+#ifdef USE_KMS
+static int init_drm(void) {
+ static const char *modules[] = {
+ "omapdrm", "i915", "radeon", "nouveau", "vmwgfx", "exynos"
+ };
+ drmModeRes *resources;
+ drmModeConnector *connector = NULL;
+ drmModeEncoder *encoder = NULL;
+ int i, j;
+#ifdef ALL_DISPLAY
+ uint32_t maxRes, curRes;
+#endif /* ALL_DISPLAY */
+
+ for (i = 0; i < ARRAY_SIZE(modules); i++) {
+ printf("trying to load module %s...", modules[i]);
+ drm.fd = drmOpen(modules[i], NULL);
+ if (drm.fd < 0) {
+ printf("failed.\n");
+ } else {
+ printf("success.\n");
+ break;
+ }
+ }
+
+ if (drm.fd < 0) {
+ printf("could not open drm device\n");
+ return -1;
+ }
+
+ resources = drmModeGetResources(drm.fd);
+ if (!resources) {
+ printf("drmModeGetResources failed: %s\n", strerror(errno));
+ return -1;
+ }
+
+ /* find a connected connector: */
+ for (i = 0; i < resources->count_connectors; i++) {
+ connector = drmModeGetConnector(drm.fd, resources->connectors[i]);
+ if (connector->connection == DRM_MODE_CONNECTED) {
+ /* choose the first supported mode */
+ drm.mode[drm.ndisp] = &connector->modes[0];
+ drm.connector_id[drm.ndisp] = connector->connector_id;
+
+ for (j = 0; j < resources->count_encoders; j++) {
+ encoder = drmModeGetEncoder(drm.fd, resources->encoders[j]);
+ if (encoder->encoder_id == connector->encoder_id) {
+ break;
+ }
+ drmModeFreeEncoder(encoder);
+ encoder = NULL;
+ }
+
+ if (!encoder) {
+ printf("no encoder!\n");
+ return -1;
+ }
+
+ drm.crtc_id[drm.ndisp] = encoder->crtc_id;
+ drm.connectors[drm.ndisp] = connector;
+
+ printf("### Display [%d]: CRTC = %d, Connector = %d\n", drm.ndisp, drm.crtc_id[drm.ndisp], drm.connector_id[drm.ndisp]);
+ printf("\tMode chosen [%s] : Clock => %d, Vertical refresh => %d, Type => %d\n", drm.mode[drm.ndisp]->name, drm.mode[drm.ndisp]->clock, drm.mode[drm.ndisp]->vrefresh, drm.mode[drm.ndisp]->type);
+ printf("\tHorizontal => %d, %d, %d, %d, %d\n", drm.mode[drm.ndisp]->hdisplay, drm.mode[drm.ndisp]->hsync_start, drm.mode[drm.ndisp]->hsync_end, drm.mode[drm.ndisp]->htotal, drm.mode[drm.ndisp]->hskew);
+ printf("\tVertical => %d, %d, %d, %d, %d\n", drm.mode[drm.ndisp]->vdisplay, drm.mode[drm.ndisp]->vsync_start, drm.mode[drm.ndisp]->vsync_end, drm.mode[drm.ndisp]->vtotal, drm.mode[drm.ndisp]->vscan);
+
+#ifdef ALL_DISPLAY
+ /* If all displays are enabled, choose the connector with maximum
+ * resolution as the primary display
+ */
+ maxRes = drm.mode[DISP_ID]->vdisplay * drm.mode[DISP_ID]->hdisplay;
+ curRes = drm.mode[drm.ndisp]->vdisplay * drm.mode[drm.ndisp]->hdisplay;
+ if (curRes > maxRes) {
+ DISP_ID = drm.ndisp;
+ }
+#else
+#ifdef CONNECTOR_ID
+ /* If a connector_id is specified, use the corresponding display */
+ if (CONNECTOR_ID == drm.connector_id[drm.ndisp]) {
+ DISP_ID = drm.ndisp;
+ }
+#endif /* CONNECTOR_ID */
+#endif /* ALL_DISPLAY */
+
+ drm.ndisp++;
+ } else {
+ drmModeFreeConnector(connector);
+ }
+ }
+
+ if (drm.ndisp == 0) {
+ /* we could be fancy and listen for hotplug events and wait for
+ * a connector..
+ */
+ printf("no connected connector!\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+static void drm_fb_destroy_callback(struct gbm_bo *bo, void *data) {
+ struct drm_fb *fb = data;
+ struct gbm_device *gbm = gbm_bo_get_device(bo);
+
+ if (fb->fb_id)
+ drmModeRmFB(drm.fd, fb->fb_id);
+
+ free(fb);
+}
+
+static struct drm_fb * drm_fb_get_from_bo(struct gbm_bo *bo) {
+ struct drm_fb *fb = gbm_bo_get_user_data(bo);
+ uint32_t width, height, stride, handle;
+ int ret;
+
+ if (fb)
+ return fb;
+
+ fb = calloc(1, sizeof *fb);
+ fb->bo = bo;
+
+ width = gbm_bo_get_width(bo);
+ height = gbm_bo_get_height(bo);
+ stride = gbm_bo_get_stride(bo);
+ handle = gbm_bo_get_handle(bo).u32;
+
+ ret = drmModeAddFB(drm.fd, width, height, 24, 32, stride, handle, &fb->fb_id);
+ if (ret) {
+ printf("failed to create fb: %s\n", strerror(errno));
+ free(fb);
+ return NULL;
+ }
+
+ gbm_bo_set_user_data(bo, fb, drm_fb_destroy_callback);
+
+ return fb;
+}
+
+static void page_flip_handler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data) {
+ int *waiting_for_flip = data;
+ *waiting_for_flip = 0;
+}
+
+static drmEventContext evctx = {
+ .version = DRM_EVENT_CONTEXT_VERSION,
+ .page_flip_handler = page_flip_handler,
+};
+
+#endif /* USE_KMS */
+
+static int load_kms() {
+#ifdef USE_KMS
+ int ret;
+
+ ret = init_drm();
+ if (ret) {
+ printf("failed to initialize DRM\n");
+ return 1;
+ }
+
+ printf("### Primary display => ConnectorId = %d, Resolution = %dx%d\n",
+ drm.connector_id[DISP_ID], drm.mode[DISP_ID]->hdisplay,
+ drm.mode[DISP_ID]->vdisplay);
+
+ FD_ZERO(&fds);
+ FD_SET(0, &fds);
+ FD_SET(drm.fd, &fds);
+
+ useKMS = 1;
+
+ return 0;
+#else
+ return 1;
+#endif /* USE_KMS */
+}
/***************************** Special cases ***************************/
@@ -102,6 +319,75 @@
return ret;
}
+static EGLBoolean(*_eglSwapBuffers)(EGLDisplay display, EGLSurface surface);
+
+EGLBoolean util_wr_eglSwapBuffers(EGLDisplay display, EGLSurface surface) {
+ EGLBoolean ret;
+#ifdef USE_KMS
+ struct drm_fb *fb;
+ struct gbm_bo *next_bo;
+ int waiting_for_flip = 1;
+ static int mode_set = 0;
+#ifdef ALL_DISPLAY
+ int i;
+#endif /* ALL_DISPLAY */
+#endif /* USE_KMS */
+
+ ret = (*_eglSwapBuffers)(display, surface);
+
+#ifdef USE_KMS
+ next_bo = gbm_surface_lock_front_buffer(gbm.surface);
+ fb = drm_fb_get_from_bo(next_bo);
+
+ if (!mode_set) {
+ mode_set = 1;
+#ifdef ALL_DISPLAY
+ for (i = 0; i < drm.ndisp; i++) {
+ if (drmModeSetCrtc(drm.fd, drm.crtc_id[i], fb->fb_id, 0, 0, &drm.connector_id[i], 1, drm.mode[i])) {
+ printf("display %d failed to set mode: %s\n", i, strerror(errno));
+ }
+ }
+#else
+ if (drmModeSetCrtc(drm.fd, drm.crtc_id[DISP_ID], fb->fb_id, 0, 0, &drm.connector_id[DISP_ID], 1, drm.mode[DISP_ID])) {
+ printf("display %d failed to set mode: %s\n", DISP_ID, strerror(errno));
+ }
+#endif /* ALL_DISPLAY */
+ }
+
+ /*
+ * Here you could also update drm plane layers if you want
+ * hw composition
+ */
+
+ if (drmModePageFlip(drm.fd, drm.crtc_id[DISP_ID], fb->fb_id, DRM_MODE_PAGE_FLIP_EVENT, &waiting_for_flip)) {
+ printf("failed to queue page flip: %s\n", strerror(errno));
+ return ret;
+ }
+
+ while (waiting_for_flip) {
+ if (select(drm.fd + 1, &fds, NULL, NULL, NULL) < 0) {
+ printf("select err: %s\n", strerror(errno));
+ return ret;
+ } else if (ret == 0) {
+ printf("select timeout!\n");
+ return ret;
+ } else if (FD_ISSET(0, &fds)) {
+ printf("user interrupted!\n");
+ break;
+ }
+ drmHandleEvent(drm.fd, &evctx);
+ }
+
+ /* release last buffer to render on again: */
+ if (bo) {
+ gbm_surface_release_buffer(gbm.surface, bo);
+ }
+ bo = next_bo;
+#endif /* USE_KMS */
+
+ return ret;
+}
+
/***************************** EGL *************************************/
static int load_egl_symbols(void *lib) {
@@ -111,6 +397,10 @@
error++;
}
+ if (!(_eglSwapBuffers = GET_SYMBOL(lib, "eglSwapBuffers"))) {
+ error++;
+ }
+
if (error) {
// handle error conditions better ?
fprintf(stderr, "failed to load all EGL symbols %d\n", error);
@@ -217,6 +507,8 @@
if (load_bcm_symbols() == 0) {
// useDispman
+ } else if (load_kms() == 0) {
+ // useKMS
} else if (access("/dev/mxc_vpu", F_OK) == 0) {
useVivanteFB = 1;
error += load_vivante_symbols(libegl);
@@ -240,6 +532,11 @@
cachedNativeDisplayType = EGL_DEFAULT_DISPLAY;
} else if (useVivanteFB) {
cachedNativeDisplayType = wr_fbGetDisplayByIndex(0);
+ } else if (useKMS) {
+#ifdef USE_KMS
+ gbm.dev = gbm_create_device(drm.fd);
+ cachedNativeDisplayType = (EGLNativeDisplayType)gbm.dev;
+#endif /* USE_KMS */
} else {
cachedNativeDisplayType = (EGLNativeDisplayType)NULL;
}
@@ -324,6 +621,20 @@
#endif /* USE_DISPMAN */
} else if (useVivanteFB) {
cachedWindowType = (*wr_fbCreateWindow)(util_getNativeDisplayType(), 0, 0, 0, 0);
+ } else if (useKMS) {
+#ifdef USE_KMS
+ int ret;
+ // Make sure that GBM has been initialized.
+ util_getNativeDisplayType();
+ gbm.surface = gbm_surface_create(gbm.dev,
+ drm.mode[DISP_ID]->hdisplay, drm.mode[DISP_ID]->vdisplay,
+ GBM_FORMAT_XRGB8888,
+ GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
+ if (!gbm.surface) {
+ printf("failed to create gbm surface\n");
+ }
+ cachedWindowType = (NativeWindowType)gbm.surface;
+#endif /* USE_KMS */
} else {
cachedWindowType = NULL; // hence the EGL NULL
}
diff -r b8d6295f4672 modules/graphics/src/main/native-prism-es2/eglfb/wrapped_egl.c
--- a/modules/graphics/src/main/native-prism-es2/eglfb/wrapped_egl.c Fri Feb 07 13:27:40 2014 -0800
+++ b/modules/graphics/src/main/native-prism-es2/eglfb/wrapped_egl.c Thu Feb 20 15:57:51 2014 -0800
@@ -182,6 +182,10 @@
#endif
}
+EGLBoolean wr_eglSwapBuffers(EGLDisplay display, EGLSurface surface) {
+ return (EGLBoolean) (*prismPort.wr_eglSwapBuffers)((void*)display, (void*)surface);
+}
+
void * getLibGLEShandle() {
#ifdef ANDROID_NDK
return libglesv2;
diff -r b8d6295f4672 modules/graphics/src/main/native-prism-es2/eglfb/wrapped_egl.h
--- a/modules/graphics/src/main/native-prism-es2/eglfb/wrapped_egl.h Fri Feb 07 13:27:40 2014 -0800
+++ b/modules/graphics/src/main/native-prism-es2/eglfb/wrapped_egl.h Thu Feb 20 15:57:51 2014 -0800
@@ -44,4 +44,7 @@
//This is needed until we can make sure load_wrapped_gles_symbols
#define eglGetDisplay(display_id) (*wr_eglGetDisplay)(display_id)
+WRAPPEDAPI EGLBoolean wr_eglSwapBuffers(EGLDisplay display, EGLSurface surface);
+#define eglSwapBuffers(display, surface) (*wr_eglSwapBuffers)(display, surface)
+
#endif // __WRAPPED_EGL__
@FantomJAC
Copy link
Author

Basically, it should work with any KMS/DRM environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment