jMonkeyEngine / sdk

The jMonkeyEngine3 Software Development Kit based on Netbeans
BSD 3-Clause "New" or "Revised" License
315 stars 100 forks source link

Error starting OpenGL context on Ubuntu with Intel graphics #294

Open mfdewit opened 3 years ago

mfdewit commented 3 years ago

Hi, When the SDK loads I immediately get an error indicating OpenGL is not working. I'm on an Ubuntu 20.04 system with Intel UHD Graphics 620 using the latest drivers with Mesa support. When running the BasicGame (from the new project wizard) OpenGL seems to work fine.

Judging from the log below it seems LWJGL cannot find the correct video driver. On both Wayland and X-windows I get the same error. This laptop has an NVidia graphics chipset as well and with that one this SDK runs fine. But it should run with Intel as well :) My system supports GLX version 1.4, while the SDK is looking for version 1.3. Should this be backwards compatible?

What strikes me is that a really old version of LWJGL (2.9.3) is used while the SDK also uses the 3.x versions. Any help would be appreciated.

The error from the log NFO [com.jme3.gde.core.scene.SceneApplication]: Could not find GLX 1.3 config from peer info org.lwjgl.LWJGLException: Could not find GLX 1.3 config from peer info at org.lwjgl.opengl.LinuxPbufferPeerInfo.nInitHandle(Native Method) at org.lwjgl.opengl.LinuxPbufferPeerInfo.(LinuxPbufferPeerInfo.java:52) at org.lwjgl.opengl.LinuxDisplay.createPbuffer(LinuxDisplay.java:1349) at org.lwjgl.opengl.Pbuffer.createPbuffer(Pbuffer.java:234) at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:219) at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:190) at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:166) at com.jme3.system.lwjgl.LwjglCanvas.makePbufferAvailable(LwjglCanvas.java:342) [catch] at com.jme3.system.lwjgl.LwjglCanvas.createContext(LwjglCanvas.java:475) at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:113) at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:213) at java.base/java.lang.Thread.run(Thread.java:834) LWJGL 2.9.3 context running on thread jME3 Main

My supported GLX and OpebGL/Mesa version $ glxinfo | grep "version" server glx version string: 1.4 client glx version string: 1.4 GLX version: 1.4 Max core profile version: 4.6 Max compat profile version: 4.6 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 3.2 OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.3.3 - kisak-mesa PPA OpenGL core profile shading language version string: 4.60 OpenGL version string: 4.6 (Compatibility Profile) Mesa 20.3.3 - kisak-mesa PPA OpenGL shading language version string: 4.60 OpenGL ES profile version string: OpenGL ES 3.2 Mesa 20.3.3 - kisak-mesa PPA OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20 GL_EXT_shader_implicit_conversions, GL_EXT_shader_integer_mix,

SDK version info Product Version: jMonkeyEngine SDK v3.3.2-stable Java: 11.0.6; OpenJDK 64-Bit Server VM 11.0.6+10 Runtime: OpenJDK Runtime Environment 11.0.6+10 System: Linux version 5.8.0-38-generic running on amd64; UTF-8; en_US (jmonkeyplatform)

Edit: added some logging of my working setup with Nividia. Here as well some Null values are logged for driver and adapter. Log when starting with Nvidia driverthat works correctly Running on jMonkeyEngine 3.3.2-stable

joliver82 commented 3 years ago

I’m facing the exact same issue with debian bullseye with an intel UHD 620 integrated graphic card

Everything worked fine until some kernel update. From that day on, all GL apps worked except jme sdk. I’ve been trying to make it work and the only workaround that worked for me was booting with the good old 4.x kernel and changing intel firmware files to ancient ones…

Just in case this helps you while this issue is fixed

joliver82 commented 3 years ago

I solved it by changing intel driver configuration. My laptop is intel only, no nvidia discrete graphics card but just in case my setup works for you also.

I changed i915 module options at /etc/modprobe.d/i915.conf as follows: options i915 enable_guc=2

And forced the xorg configuration /etc/X11/xorg.conf.d/20-intel.conf

Section "Module"
   Load "dri3"
EndSection

Section "Device"
   Identifier  "Intel Graphics"
   Driver      "intel"
   Option      "DRI"   "3"
   Option      "AccelMethod"  "uxa"
   Option      "TearFree"     "true"
EndSection

This is based on some askubuntu.com questions

And setting heavyweight canvas in jme sdk because otherwise it was really slow

peedeeboy commented 2 years ago

Same issue on Linux Mint 20.1 with AMD Radeon graphics using the open-source radeon driver. This makes me wonder if there was a change in the 5.4 kernel family that doesn't play nicely with LWJGL 2.9.3?

Everything used to work in Linux Mint 19 with a 4.x kernel...

SDK Startup output

Running on jMonkeyEngine 3.3.0-stable
 * Branch: HEAD
 * Git Hash: 391e0dc
 * Build Date: 2021-04-05
Could not find GLX 1.3 config from peer info
LWJGL 2.9.3 context running on thread jME3 Main
 * Graphics Adapter: null
 * Driver Version: null
 * Scaling Factor: 1
Audio Renderer Information
 * Device: OpenAL Soft
 * Vendor: OpenAL Community
 * Renderer: OpenAL Soft
 * Version: 1.1 ALSOFT 1.15.1
 * Supported channels: 64
 * ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
 * AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency

Graphics Adapter: null doesn't look healthy.

System info

System:    Kernel: 5.4.0-91-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: Cinnamon 4.8.6 
           wm: muffin dm: LightDM Distro: Linux Mint 20.1 Ulyssa base: Ubuntu 20.04 focal
CPU:       Topology: Quad Core model: AMD A10-7300 Radeon R6 10 Compute Cores 4C+6G bits: 64 
           type: MCP arch: Steamroller rev: 1 L2 cache: 2048 KiB 
           flags: avx lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 15171 
           Speed: 1496 MHz min/max: 1100/1900 MHz Core speeds (MHz): 1: 1439 2: 1441 3: 1405 
           4: 1431 
Graphics:  Device-1: AMD Kaveri [Radeon R6 Graphics] vendor: Hewlett-Packard driver: radeon 
           v: kernel bus ID: 00:01.0 chip ID: 1002:130a 
           Display: x11 server: X.Org 1.20.13 driver: ati,radeon unloaded: fbdev,modesetting,vesa 
           resolution: 1920x1080~60Hz, 1366x768~60Hz 
           OpenGL: renderer: AMD KAVERI (DRM 2.50.0 5.4.0-91-generic LLVM 12.0.0) 
           v: 4.5 Mesa 21.0.3 direct render: Yes 

GLXInfo

server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
    Max core profile version: 4.5
    Max compat profile version: 4.5
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL core profile version string: 4.5 (Core Profile) Mesa 21.0.3
OpenGL core profile shading language version string: 4.50
OpenGL version string: 4.5 (Compatibility Profile) Mesa 21.0.3
OpenGL shading language version string: 4.50
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 21.0.3
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
    GL_EXT_shader_implicit_conversions, GL_EXT_shader_integer_mix, 
MeFisto94 commented 2 years ago

I think Graphics Adapter: null isn't the problem, as I think it never worked for me on linux anyway. On Windows I think it's something like the graphics driver/dll stuff.

Anyway, certainly LWJGL2 is out of date and especially has problems on Linux, but we can't easily migrate to LWJGL3, even though we probably should at some point. Other than that you probably have to tinker (and try regular jme applications, they should show the same problem)

MLutt commented 2 years ago

glx_output.txt os_release.txt lshw_output.txt messages.log

Running into the exact same issue

stephengold commented 2 years ago

I'm curious whether this is a regression. Has anyone seen similar issues with the 3.2.4 SDK?

peedeeboy commented 2 years ago

@stephengold I did some testing:

I remembered that this problem occurred to me after I upgraded from Linux Mint 19 to 20, so I tried:

So I'm back to thinking that something changed in later versions of the Linux kernel that doesn't play nicely with LWJGL2

jperezCurso commented 1 year ago

I have the same problem with jMonkeyEngine SDK v3.4.1-stable, OpenSuse Leap 15.4 (kernel 5.14.21 x86_64), Radeon RX 580 with the default drivers and those downloaded from AMD. I just tried it with opensuse tumbleweed and the same thing happens too (kernel 5.19.8-1-default)

Ubuntu 18.04 is using GLX 1.2, Linux mint 20.01 is using GLX 1.4, maybe it has something to do with it?

It doesn't work either, the Help | Check graphics capabilities, I imagine it will be related to the above.

peedeeboy commented 1 year ago

With JME 3.6.0, LWJGL2 based projects now work on Linux, thanks to the LWJGL 2.9.5 version hosted by jMonkey :tada:

However, the SDK 3.6.0 still can't open Scene Editor - same open "Open GL Context not started"

Would do we need to do to get SDK working with LWJGL 2.9.5?

tonihele commented 1 year ago

Hmm, I thought this would be automatically fixed by transitioning the SDK to use jME 3.6. What are we missing? Why isn't the SDK using the jME hosted LWJGL 2? Or why it is not working then?

peedeeboy commented 1 year ago

Looks like the libs are there...

➜  jmonkeyplatform-3.6-sdk3 l jmonkeyplatform/libs | grep 'lwjgl.*2\.9' 
-rw-r--r-- 1 peedeeboy peedeeboy 1.1M Apr 15 06:35 lwjgl-2.9.5.jar
-rw-r--r-- 1 peedeeboy peedeeboy 559K Apr 15 06:35 lwjgl-platform-2.9.5-natives-linux.jar
-rw-r--r-- 1 peedeeboy peedeeboy 417K Apr 15 06:35 lwjgl-platform-2.9.5-natives-osx.jar
-rw-r--r-- 1 peedeeboy peedeeboy 600K Apr 15 06:35 lwjgl-platform-2.9.5-natives-windows.jar
MeFisto94 commented 1 year ago

my gut feeling: aren't we comparing pears and apples? We have had this "dl_open assertion" in various forms on linux with the old lwjgl, which is fixed by that build, but the topic/title of this issue at least sounds more like an engine problem with intel drivers/old cards, especially under llinux.

Especially laptops with hybrid graphics are tricky there. And it may very well be, that lwjgl3 handles them better, but that's a different bug then

tonihele commented 1 year ago

We have had this "dl_open assertion" in various forms on linux with the old lwjgl, which is fixed by that build, but the topic/title of this issue at least sounds more like an engine problem with intel drivers/old cards, especially under llinux.

Yes... that was it... the linkage error was fixed. Nothing else...

peedeeboy commented 1 year ago

my gut feeling: aren't we comparing pears and apples? We have had this "dl_open assertion" in various forms on linux with the old lwjgl, which is fixed by that build, but the topic/title of this issue at least sounds more like an engine problem with intel drivers/old cards, especially under llinux.

I'd assumed the two issues were related, as I'd tested a bunch of different combinations of Linux with both integrated Intel and AMD GPU, and my results were:

But you are probably right, and its two separate issues :cry: I guess the current situation on this laptop (JME application using LWJGL2 2.9.5 works, SDK doesn't) supports that.... :sob:

terranprog commented 7 months ago

I am getting the exact same error as the original poster. Was a resolution ever found for this? I've read through the thread and it's not exactly clear.

(This is not sdk related. I am getting the error when I run my own program. I don't use the sdk.)

For context, I am trying to run a program on Linux, that I have only ever previously run on Windows. I am on an older laptop, with Intel graphics and AMD Radeon. This is a new Linux install and I am not even sure if the 3d drivers are configured correctly...

The main clue I have is that my program normally runs using Swing. When I tried to run an alternative build that runs in full screen, without any swing or awt dependencies, the program ran successfully.

The output I get (when it doesn't work) is:

`Jan 12, 2024 7:04:25 PM com.jme3.system.JmeDesktopSystem initialize INFO: Running on jMonkeyEngine 3.6.1-stable

Jan 12, 2024 7:04:26 PM com.jme3.system.JmeSystemDelegate lambda$new$0 WARNING: JmeDialogsFactory implementation not found. Failed to initialize OpenGL context LWJGLException: Could not find GLX 1.3 config from peer info Jan 12, 2024 7:04:26 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo INFO: LWJGL 2.9.5 context running on thread jME3 Main

Jan 12, 2024 7:04:29 PM com.jme3.system.JmeSystemDelegate lambda$new$0 WARNING: JmeDialogsFactory implementation not found. Uncaught exception thrown in Thread[jME3 Main,6,main] NullPointerException: Cannot invoke "com.jme3.renderer.Renderer.invalidateState()" because "this.renderer" is null

Exception: java.lang.NullPointerException thrown from the UncaughtExceptionHandler in thread "jME3 Main" ` I am running latest Debian (12) with Cinnamon desktop.

Is there a known issue with swing on linux?

When I run in full screen (without swing) I get

`Jan 12, 2024 6:36:34 PM com.jme3.system.JmeSystemDelegate lambda$new$1 WARNING: JmeDialogsFactory implementation not found. Jan 12, 2024 6:36:34 PM com.jme3.system.JmeDesktopSystem initialize INFO: Running on jMonkeyEngine 3.6.1-stable

Output of glxinfo is:

server glx version string: 1.4 client glx version string: 1.4 GLX version: 1.4 Max core profile version: 4.6 Max compat profile version: 4.6 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 3.2 OpenGL core profile version string: 4.6 (Core Profile) Mesa 22.3.6 OpenGL core profile shading language version string: 4.60 OpenGL version string: 4.6 (Compatibility Profile) Mesa 22.3.6 OpenGL shading language version string: 4.60 OpenGL ES profile version string: OpenGL ES 3.2 Mesa 22.3.6 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20 GL_EXT_shader_implicit_conversions, GL_EXT_shader_integer_mix,

tonihele commented 7 months ago

I am getting the exact same error as the original poster. Was a resolution ever found for this? I've read through the thread and it's not exactly clear.

LWJGL 3 would probably work as stated but that is not an option for the SDK as of yet. jME 3.7 will most likely contain LWJGL 3 canvas finally, but there is the question with MacOS as always. Also on other platforms I've seen LWJGL 3 and swing not play too nicely together always.