JDK-8175301 : Java GUI hangs on Windows when Display set to 125%
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-02-21
  • Updated: 2017-04-06
  • Resolved: 2017-03-13
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 10 JDK 9
10Fixed 9 b163Fixed
Description
I was able to reproduce this with 9b156 x64 and 9b157 x64 on Windows 7 64 bit.

To reproduce the problem:
Go to Control Panel\All Control Panel Items\Display and set Display to Medium 125%
Run Java GUI (f.e. jconsole -version or Javatest).
You would see strange artifacts.

I was not able to connect to javatest process with jconsole when this happened. 

When I set Display to 100% the problem is gone. 
Comments
Please push the fix by 3/16 end-of-the-day
13-03-2017

9-critical-request: - Justification: The right and the bottom region of a frame is not repainted on Windows 7 with D3D mode and Basic Windows Theme This is a blocker because without the fix the Java GUI application will be partially drawn on the screen on Windows with Basic Windows theme and scales more than 100 (125, 150 or higher). See the attached screenshots how GUI applications are drawn with artifacts. ���- Risk Analysis: Low. The passed coordinates are transformed from the user space to the device space. - Webrev : http://cr.openjdk.java.net/~alexsch/8175301/webrev.01/ - Testing (done/to-be-done) : Run the automated regression test on Windows 7 with Basic Windows Theme test/javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java. Be sure that Java D3D mode is supported on the tested platform. - Back ports (done/to-be-done) : Not applicable . The issue is reproduced only with HiDPI support which is implemented only in JDK 9. - Fix For Release : JDK 9
10-03-2017

3/8/2017: The fix was internally reviewed and pending new revision to submit for review.
09-03-2017

The proposed fix: http://cr.openjdk.java.net/~alexsch/8175301/webrev.00/ The review thread: http://mail.openjdk.java.net/pipermail/awt-dev/2017-March/012658.html
07-03-2017

Thank you. We are able to reproduce the issue with the D3D enabled and the Windows Basic Theme. Could you set another Windows Theme where the composition is enabled ant try to reproduce the issue? (Click an empty area on the desktop and select Personalize to select a Windows theme.)
02-03-2017

done. simpleframe-s125x.pixrun attached
01-03-2017

Could you download and install DirectX SDK and run the PIX with the following parameters: Microsoft DirectX SDK > DirectX Utilities -> PIX for Windows File->New Experiment Select Program: <path-to-the-JDK-9-b157>\bin\java.exe Select A replayable Direct3D call stream, saved to file: <dir-to-save>\simpleframe-s125x.pixrun More Options Target Program Program: <path-to-the-JDK-9-b157>\bin\java.exe Startup folder: <folder where SimpleFrame class files are placed> Command-line: SimpleFrame Start Experiment Close the frame Attach the simpleframe-s125x.pixrun file to the bug.
28-02-2017

C:\Java\1>SET J2D_TRACE_LEVEL=3 [I] D3DInitializer::InitImpl [I] OS Version = OS_WINDOWS7 or newer [I] CheckAdaptersInfo [I] ------------------ [I] Adapter Ordinal : 0 [I] Adapter Handle : 0x10001 [I] Description : ATI Radeon HD 5700 Series [I] GDI Name, Driver : \\.\DISPLAY1, aticfx64.dll [I] Vendor Id : 0x1002 [I] Device Id : 0x68b8 [I] SubSys Id : 0x3b61043 [I] Driver Version : 8.17.10.1077 [I] GUID : {D7B71EE2-2BF8-11CF-C677-BC23BEC2C535} [I] D3DPPLM::CheckDeviceCaps: adapter 0: Passed [I] ------------------ [I] D3DGD_getDeviceCapsNative [I] D3DContext::InitContext device 0 [I] D3DContext::ConfigureContext device 0 [I] D3DContext::ConfigureContext: successfully created device: 0 [I] D3DContext::InitDevice: device 0 [I] D3DContext::InitDefice: successfully initialized device 0 [I] D3DInitializer::CleanImpl (normal)
28-02-2017

C:\Java\1>SET J2D_TRACE_LEVEL=5 C:\Java\1>java SimpleFrame [I] D3DInitializer::InitImpl [I] OS Version = OS_WINDOWS7 or newer [I] CheckAdaptersInfo [I] ------------------ [I] Adapter Ordinal : 0 [I] Adapter Handle : 0x10001 [I] Description : ATI Radeon HD 5700 Series [I] GDI Name, Driver : \\.\DISPLAY1, aticfx64.dll [I] Vendor Id : 0x1002 [I] Device Id : 0x68b8 [I] SubSys Id : 0x3b61043 [I] Driver Version : 8.17.10.1077 [I] GUID : {D7B71EE2-2BF8-11CF-C677-BC23BEC2C535} [I] D3DPPLM::CheckDeviceCaps: adapter 0: Passed [I] ------------------ [I] D3DGD_getDeviceCapsNative [I] D3DContext::InitContext device 0 [I] D3DContext::ConfigureContext device 0 [V] dwBehaviorFlags=D3DCREATE_FPU_PRESERVE|D3DCREATE_HARDWARE_VERTEXPROCESSING [I] D3DContext::ConfigureContext: successfully created device: 0 [I] D3DContext::InitDevice: device 0 [I] D3DContext::InitDefice: successfully initialized device 0 [V] | CAPS_DEVICE_OK [V] | CAPS_RT_PLAIN_ALPHA [V] | CAPS_RT_TEXTURE_ALPHA [V] | CAPS_RT_TEXTURE_OPAQUE [V] | CAPS_LCD_SHADER | CAPS_BIOP_SHADER | CAPS_PS20 [V] | CAPS_AA_SHADER [V] | CAPS_PS30 [V] | CAPS_MULTITEXTURE [V] | CAPS_TEXNONPOW2 [V] | CAPS_TEXNONSQUARE [I] D3DInitializer::CleanImpl (normal)
28-02-2017

Could you set the J2D_TRACE_LEVEL=3 system property, run the simple java app below on your desktop and attach the printed log. We are mostly interested in the CheckAdaptersInfo. ------------- import java.awt.Color; import java.awt.Graphics; import java.awt.Insets; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class SimpleFrame { public static void main(String[] args) { SwingUtilities.invokeLater(() -> { JFrame frame = new JFrame() { @Override public void paint(Graphics g) { super.paint(g); Insets insets = getInsets(); int x = insets.left; int y = insets.top; int w = getWidth() - insets.left - insets.right; int h = getHeight() - insets.top - insets.bottom; g.setColor(Color.BLUE); g.drawOval(x, y, w, h); g.setColor(Color.RED); g.drawLine(x + w / 2, y, x + w / 2, y + h); g.drawLine(x, y + h / 2, x + w, y + h / 2); } }; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 400); frame.setVisible(true); }); } } -------------
28-02-2017

Thanks, -Dsun.java2d.uiScale=1 works
22-02-2017

As a workaround use the -Dsun.java2d.uiScale=1 option: > java -Dsun.java2d.uiScale=1 -jar sample.jar
22-02-2017