JDK-6636469 : Java Fullscreen Exclusive Mode not working with Xorg server 1.3.0 and above
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2007-12-03
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 Other
7 b28Fixed OpenJDK6Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

Problem not fixed yet as of java 1.7.0 b23

ADDITIONAL OS VERSION INFORMATION :
I came across this problem in Ubuntu 7.10 (Gutsy) but having checked the upstream code of both X and Java I believe it may be present in any Unix/Linux OS shipping a version of Xorg Server 1.3.0 or above with Xrandr 1.2

A DESCRIPTION OF THE PROBLEM :
I've discovered a problem caused by a change in Xorg server 1.3.0 (and above) which prevents use of Full Screen Exclusive mode (FSEM).

As of Xorg server 1.3 the Xinerama backend implementation has been replaced with a fake one provided by Xrandr 1.2. If the real Xinerama is not compiled in (by default it's not) it registers itself as the "XINERAMA" extension and handles the Xinerama protocol calls[2].

Unfortunately this has changed the interface slightly; the real Xinerama
would not initialise if there is only 1 monitor [3], but the Xrandr one
now does [4].

  From studying the IcedTea/OpenJDK code [5] I see the Java native calls
that setup FSEM use Xrandr. However if Xinerama is active they rightly
avoid using Xrandr and therefore disable FSEM [6].

Because Xinerama now appears to be loaded even for single monitor setups
it seems FSEM is not possible.

I discussed this problem on #xorg and was advised that if calling XRRQueryVersion() returns >= 1.2, Java should go ahead and use Xrandr even if Xinerama does appear present. I'm happy to code up a patch to do this and will attach here and or submit to the awt-dev mailing list.

[1] https://lists.ubuntu.com/archives/ubuntu-x/2007-November/000061.html
[2] http://gitweb.freedesktop.org/?p=xorg/xserver.git;a=blob;f=randr/rrxinerama.c
[3] See PanoramiXExtensionInit(...) in http://gitweb.freedesktop.org/?p=xorg/xserver.git;a=blob;f=Xext/panoramiX.c
[4] See RRXineramaExtensionInit(void) in [2]
[5] https://openjdk.dev.java.net/source/browse/openjdk/jdk/tags/jdk7-b23/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c?view=markup
[6] See Java_sun_awt_X11GraphicsDevice_initXrandrExtension() in [5]

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Install any recent Linux distro that ships xorg server 1.3+, for instance Ubuntu Gutsy Gibbon 7.10 onto a system with only a single monitor attached.

2) Run the following command

    xdpyinfo | grep XINERAMA

Note no output on pre xorg-server 1.3 installations (e.g Ubuntu Feisty) which indicates Xinerama not loaded/active, but on an xorg-server 1.3 installation:

    XINERAMA

which indicates Xinerama is in the list of active X server extensions.

3) Install Java 6 or 7

4) Run QueryFSEM.java (attached in Test Case section below) compare with Expected and Actual Result sections below.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
GRAPHICS DEVICE:

  isFullScreenSupported: true

DISPLAY MODES:

  1: 1440 x 900 @ 60Hz -1bit
  2: 1024 x 768 @ 60Hz -1bit
... list of display modes continues

ACTUAL -
GRAPHICS DEVICE:

  isFullScreenSupported: false

DISPLAY MODES:

  1: 1440 x 900 @ 60Hz -1bit

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public static void main(String[] args) {
	GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
	GraphicsDevice gd = ge.getDefaultScreenDevice();
	DisplayMode[] dms = gd.getDisplayModes();
	
	System.out.println("GRAPHICS DEVICE:\n");
	System.out.println("  isFullScreenSupported: " + gd.isFullScreenSupported() + "\n");
	
	System.out.println("DISPLAY MODES:\n");
	DisplayMode dm = null;
	for (int i = 0; i < dms.length; i++) {
		dm = dms[i];
		System.out.printf("%3d: %4d x%4d @ %dHz %dbit\n",
			i+1, dm.getWidth(), dm.getHeight(),
			dm.getRefreshRate(), dm.getBitDepth());
	}
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
None as yet.

The old xorg.conf ServerFlags option "Xinerama" can no longer be used to disable the fake Xinerama as the code that checks this flag is conditionally compiled-in with Xinerama itself. The real Xinerama doesn't appear to be compiled in by default in Ubuntu's X server.

Comments
SUGGESTED FIX http://hg.openjdk.java.net/jdk7/2d/jdk/rev/11a35970b90e
14-05-2008

SUGGESTED FIX http://sa.sfbay.sun.com/projects/java2d_data/7/6636469.0
14-05-2008

EVALUATION The fix was proposed by the member of the community (munkfish). See this thread for more information: http://mail.openjdk.java.net/pipermail/2d-dev/2008-May/000272.html http://www.nabble.com/-PATCH--6636469%3A-Java-Fullscreen-Exclusive-Mode-not-working-with%09Xorg-server-1.3.0-and-above-to14228454.html
13-05-2008

EVALUATION This bug is related to 6599351: javaws only runs in the left-hand screen on snv_71 which is caused by the way we detect Xinerama. But as the submitter pointed out we may also relax the conditions for using randr when xinerama is present.
03-12-2007