JDK-5041225 : Calling setDisplayMode() with unknown refresh rate throws exception
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-05-02
  • Updated: 2005-12-09
  • Resolved: 2004-09-07
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 6
6 mustangFixed
Related Reports
Relates :  
Description
I am calling setDisplayMode() on a graphics device that is currently in fullscreen mode, with a display mode that has an unknown refresh rate (REFRESH_RATE_UNKNOWN). Say 640, 480, 32, 0. When I do it without turning on the opengl flag, it works fine and the default refresh rate of 60hz is taken automatically. But on the same platform, for the same build, when I turn the opengl flag on and execute the same application, an IllegalArgumentException is thrown saying invalid display mode. 

The API doc for DisplayMode specifies that the refresh rate can be unknown. This is reproducible since tiger-beta2-b46 on WinXP with NVIDIA GEFORCE4 MX 440. 

I have attached a sample test. Execute the sample test with opengl flag. If a frame appears and an exception is thrown in the console, the bug is reproduced.

Here is the platform info:
Intel 32bit
Single Processor
Processor Speed: 2394 MHz

Operating System:
Windows XP (version 5.1 Service Pack 1 (Build 2600))

DirectX version: DirectX 8.1 or greater

DirectX display devices:
Device 0:
  Resolution (width x height x depth): 1024 x 768 x 32
  Video memory (Total, Free): 130875 KB, 130792 KB
  Device driver nv4_disp.dll version 6.14.10.5672

GDI display devices:
Primary: Name = \\.\DISPLAY1, Description = NVIDIA GeForce4 MX 440

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang FIXED IN: mustang INTEGRATED IN: mustang
08-09-2004

EVALUATION This is not an OGL-specific issue, but rather is related to disabling ddraw (the behavior is reproducible if you specify -Dsun.java2d.noddraw=true). The problem is that the ddraw pipeline will allow REFRESH_RATE_UNKNOWN, because that is handled automatically by the native ddraw functions that enumerate the various display modes. When ddraw is disabled, we use GDI routines to get the display mode list and manually iterate over the list looking for a match (the relevant code is in Win32GraphicsDevice.isDisplayModeAvailable()). I think the fix here is to change the iteration code so that it will return true if the given DisplayMode is REFRESH_RATE_UNKNOWN and the other elements (width, height, and bit depth) are valid. If there are multiple DisplayModes that differ only in their refresh rate, we can either take the first one, or better yet, take the one with the highest value. (I'm not sure how ddraw selects a display mode in this case, but we should probably make similar choices as the ddraw path.) ###@###.### 2004-05-03
03-05-2004