[BUG] getAvailableDisplayModes throws ArrayIndexOutOfBoundException

Started by DaVince, October 19, 2016, 20:33:10

Previous topic - Next topic

DaVince

Hi everyone,
I'm not a dev who uses LWJGL, but registered specifically to address an issue that has been a pretty long-standing one with Minecraft on Linux on NVIDIA graphics cards. Specifically, the bug that happens in this thread. I figured it'd be better to create a new thread about it since it's proper etiquette.

This happens on both vanilla Minecraft and when using the "Optifine" graphics optimization mod, which installs LWJGL 2.9.4-nightly-20150209. For the Optifine version, the output for LWJGL is as follows:
java.lang.ArrayIndexOutOfBoundsException: 0
	at org.lwjgl.opengl.LinuxDisplay.getAvailableDisplayModes(LinuxDisplay.java:951)
	at org.lwjgl.opengl.LinuxDisplay.init(LinuxDisplay.java:738)
	at org.lwjgl.opengl.Display.<clinit>(Display.java:138)
	... 12 more


However, the old thread ends with the issue being resolved by the person installing xrandr. This is not the case for me. Thus, I'll post some details about my system and the issue.
- I use a hybrid laptop. Intel HD 3000 and NVIDIA GT540m.
- NVIDIA is in use in the PRIME profile settings, meaning it does basically everything and the Intel GPU is just a passthrough.
- Proprietary NVIDIA drivers.
- There is a custom Xorg.conf in place which was autogenerated by the NVIDIA settings tools, but removing/changing it doesn't seem to make a difference to this bug.
- The issue only happens when I connect an external monitor, since LWJGL seems to throw an exception once it needs to enumerate the displays and fails/returns 0 somehow.
- The issue seems to persist for more people online with different specs, as long as it's the NVIDIA+external monitor on laptop combination that's triggered.

xrandr output:
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
HDMI-0 disconnected (normal left inverted right x axis y axis)
LVDS-1 connected
   640x480       59.94  
   320x240       60.05  
VGA-1 connected 1920x1080+0+0 531mm x 299mm
   1920x1080     60.00*+
   1680x1050     59.95  
   1400x1050     59.98  
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1440x900      59.89  
   1280x800      59.81  
   1152x864      75.00  
   1280x720      60.00  
   1024x768      75.08    60.00  
   832x624       74.55  
   800x600       75.00    60.32  
   640x480       75.00    60.00  
   720x400       70.08 


Again, this has been a long-standing issue for me, but has it already been fixed at any time since then (February 2015, that is)? Or is this still a valid bug?