RFR: 8354415: [Ubuntu25.04] api/java_awt/GraphicsDevice/indexTGF.html#SetDisplayMode - setDisplayMode_REFRESH_RATE_UNKNOWN fails: Height is different on vnc

Sergey Bylokhov serb at openjdk.org
Tue Jul 15 06:32:47 UTC 2025


On Fri, 11 Jul 2025 15:47:33 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

> On Linux, we are currently use XRRSetScreenConfigAndRate to change the display mode. This works in most cases, except for some VNC-configured hosts, where the display change may not occur.
> One of the conformance tests fails on these hosts.
> 
> It was discovered, that the xrandr utility app works fine on these hosts and uses the Crtc and Output Randr APIs, which provide more fine-grained control over display settings.
> 
> This changeset utilizes the Crtc and Output Randr APIs to change the display mode.
> 
> Currently, changing the display mode is only [available when running a single screen](https://github.com/openjdk/jdk/blob/a86dd56de34f730b42593236f17118ef5ce4985a/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java#L365).
> This limitation remains, but we may remove it in the future. A separate issue [has been filed](https://bugs.openjdk.org/browse/JDK-8361968) for this purpose.
> 
> The `awt.x11useOldConfigDisplayMode` system property enables the old behavior. Perhaps there's a better name for it.
> 
> Testing looks good on VNC and local machines.

src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java line 354:

> 352:         if (xrandrExtSupported == null) {
> 353:             boolean useOldConfigDisplayMode =
> 354:                     Boolean.getBoolean("awt.x11useOldConfigDisplayMode");

i guess the idea of this property is to share it to the ppl as a workaround in case some errors will occur? Then the CSR might be needed for it. The better name might be: "awt.x11.EnableXrandrDisplayModes"=true.

src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c line 1753:

> 1751: static jint refreshRateFromModeInfo(const XRRModeInfo *modeInfo) {
> 1752:     if (!modeInfo->hTotal || !modeInfo->vTotal) {
> 1753:         return 0;

It should be REFRESH_RATE_UNKNOWN?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26268#discussion_r2206517949
PR Review Comment: https://git.openjdk.org/jdk/pull/26268#discussion_r2206522445


More information about the client-libs-dev mailing list