JDK-7011935 : Using AWT in fullscreen exclusive mode results in a black screen
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6u23,8,9
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2011-01-12
  • Updated: 2018-09-05
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.
Other
tbdUnresolved
Description
FULL PRODUCT VERSION :
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7600]

A DESCRIPTION OF THE PROBLEM :
I'm able to use fullscreen exclusive mode with normal Swing components, but for some reason when I use AWT components I only see a black screen in fullscreen mode. Under Windows7, if I switch away from the window (ALT-TAB) I see that the window preview/thumbnail renders correctly. Upon switching back into the application I get a black screen again.

If I run the same testcase with -Dsun.java2d.d3d=false the screen renders correctly. This problem is 100% reproducible.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the testcase.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The screen should display a small red box in the top left corner. The remaining surface should be rendered blue.
ACTUAL -
Black screen.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.Canvas;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import javax.swing.JFrame;

public class TestMain
{
  public static void main(String[] arg)
  {
    EventQueue.invokeLater(new Runnable()
    {
      @Override
      public void run()
      {
        final GraphicsDevice screen = GraphicsEnvironment.getLocalGraphicsEnvironment().
          getDefaultScreenDevice();
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.getContentPane().setBackground(Color.BLUE);
        frame.getContentPane().setLayout(null);
        frame.setUndecorated(true);

        Canvas canvas = new Canvas();
        canvas.setBackground(Color.RED);
        canvas.setBounds(10, 10, 100, 100);
        frame.getContentPane().add(canvas);

        System.out.println("isFullscreenSupported=" + screen.isFullScreenSupported());
        screen.setFullScreenWindow(frame);
      }
    });
  }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Disable the Direct3d pipeline using -Dsun.java2d.d3d=false

Comments
Even in jdk6, D3D FSEM was not working in d3d pipeline, rather it was falling back to GDI to do fullscreen rendering. So, this D3D FSEM seems to be a feature enhancement rather than a bug.
29-09-2015

d3d FSEM was introduced in jdk6u10 and this problem was seen in jdk6u23 but it canhappen that the problem is introduced before 6u23 also. I can reproduce the problem in my Intel HD 4000 driver with jdk9 build but this driver was supported from jdk8 onwards so I cannot run jdk6 build with d3d pipeline on my hardware so am not able to find out what changes that has been made between jdk6u10 -> 23 is causing this regression to happen. Seems like some heavyweight component is not working in d3d+FSEM combination.
18-08-2015