Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX 0x300b: Could not get EGL surface

I'm trying to run a javafx sample on a raspaberry pi 3 in a embedded environment (buildroot), i want to run it without X. when i run the command:

/root/jre-13.0.1/bin/java  -Dfile.encoding=UTF-8 --add-modules javafx.controls,javafx.fxml -Dprism.verbose=true -Djavafx.verbose=true -Dglass.platform=Monocle -Dprism.order=es2 -Djava.library.path=/root/jre-13.0.1/lib/ -Dembedded=monocle   -jar /home/root/NetBeansProjects//JavaFXFXML/dist/JavaFXFXML.jar 

i get the following error:

cmd : cd '/home/root/NetBeansProjects//JavaFXFXML'; '/root/jre-13.0.1//bin/java'  -Dfile.encoding=UTF-8 --add-modules javafx.controls,javafx.fxml -Dprism.verbose=true -Djavafx.verbose=true -Dglass.platform=Monocle -Dprism.order=es2 -Djava.library.path=/root/jre-13.0.1/lib/ -Dembedded=monocle   -jar /home/root/NetBeansProjects//JavaFXFXML/dist/JavaFXFXML.jar 
JavaFX launchApplication method: launchMode=LM_JAR
Prism pipeline init order: 
es2 
Using Double Precision Marlin Rasterizer
Using dirty region optimizations
Using system sized mask for primitives
Not 
f
orcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
Loading ES2 native library ... prism_es2_monocle
Loaded /root/jre-13.0.1/lib/libprism_es2_monocle.so from java.library.path
    succeeded.
GLFactory using com.sun.prism.es2.MonocleGLFactory
Loaded /root/jre-13.0.1/lib/libglass_monocle.so from java.library.path
com.sun.glass.ui.monocle.GLException: 0x300b: Could not get EGL surface
    at javafx.graphics/com.sun.glass.ui.monocle.AcceleratedScreen.<init>(Unknown Source)
    at javafx.graphics/com.sun.glass.ui.monocle.NativePlatform.getAcceleratedScreen(Unknown Source)
    at javafx.graphics/com.sun.prism.es2.MonocleGLFactory.initialize(Unknown Source)
    at javafx.graphics/com.sun.prism.es2.ES2Pipeline.<clinit>(Unknown Source)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Unknown Source)
    at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(Unknown Source)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(Unknown Source)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
(X) Got class = class com.sun.prism.es2.ES2Pipeline
GraphicsPipeline.createPipeline: error initializing pipeline com.sun.prism.es2.ES2Pipeline
Graphics Device initialization failed for :  es2

I ran the hello_triangle and hello_dispmanx examples to test gpu accelaration and there where no problems. Don't know why i'm getting the Could not get EGL surface error, is there any way to debug this error

Java settings:

# java --version
openjdk 13.0.1-BellSoft 2019-10-15
OpenJDK Runtime Environment (build 13.0.1-BellSoft+9)
OpenJDK Server VM (build 13.0.1-BellSoft+9, mixed mode)
like image 709
Rui Sebastião Avatar asked Jan 02 '20 17:01

Rui Sebastião


1 Answers

Finally I figured out... Since I'm using buildroot all raspberry pi userland (GPU) libraries are in the /usr/lib folder. However, going deep in the monocle source code, more precisely in the DispmanPlatformFactory.java, we can see the the way they match the platform is to search for the libbcm_host.so in /opt/vc/lib which does not exist in the buildroot configuration. A quick workaround for those who use buildroot is to create a symbolic link to libbcm_host.so in /opt/vc/lib

like image 131
Rui Sebastião Avatar answered Oct 06 '22 00:10

Rui Sebastião