Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

azvegint
Copy link
Member

@azvegint azvegint commented Jul 11, 2025

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.
This limitation remains, but we may remove it in the future. A separate issue has been filed 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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8354415: [Ubuntu25.04] api/java_awt/GraphicsDevice/indexTGF.html#SetDisplayMode - setDisplayMode_REFRESH_RATE_UNKNOWN fails: Height is different on vnc (Bug - P2)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26268/head:pull/26268
$ git checkout pull/26268

Update a local copy of the PR:
$ git checkout pull/26268
$ git pull https://git.openjdk.org/jdk.git pull/26268/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26268

View PR using the GUI difftool:
$ git pr show -t 26268

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26268.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 11, 2025

👋 Welcome back azvegint! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jul 11, 2025

@azvegint This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

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

Reviewed-by: honkar, kizune

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 27 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Jul 11, 2025

@azvegint The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@azvegint azvegint changed the title [Ubuntu25.04] api/java_awt/GraphicsDevice/indexTGF.html#SetDisplayMode - setDisplayMode_REFRESH_RATE_UNKNOWN fails: Height is different on vnc 8354415: [Ubuntu25.04] api/java_awt/GraphicsDevice/indexTGF.html#SetDisplayMode - setDisplayMode_REFRESH_RATE_UNKNOWN fails: Height is different on vnc Jul 11, 2025
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 11, 2025
@mlbridge
Copy link

mlbridge bot commented Jul 11, 2025

Webrevs

@mrserb
Copy link
Member

mrserb commented Jul 12, 2025

except for some VNC-configured hosts
what VNC server is used on that hosts?

@azvegint
Copy link
Member Author

except for some VNC-configured hosts

what VNC server is used on that hosts?

It is a TigerVNC with a virtual Xtigervnc server (no physical display is connected).

Copy link
Contributor

@honkar-jdk honkar-jdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix LGTM.
It works as expected on VNC host. No regressions observed with existing java/awt/FullScreen tests on VNC host and on local.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 15, 2025
@@ -62,4 +62,11 @@ struct X11GraphicsConfigIDs {
jfieldID bitsPerPixel;
};

#define MAX_DISPLAY_MODES 256
Copy link
Contributor

@honkar-jdk honkar-jdk Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File requires copyright year update

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be handled as a batch copyright year update.

@azuev-java
Copy link
Member

Seems reasonable. The only strange thing is that passing boolean parameter, immediately negating it and use the new value everywhere. But that's Ok if it increase the code readability which i think it does.

Copy link
Member Author

@azvegint azvegint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/integrate

@@ -62,4 +62,11 @@ struct X11GraphicsConfigIDs {
jfieldID bitsPerPixel;
};

#define MAX_DISPLAY_MODES 256
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be handled as a batch copyright year update.

@openjdk
Copy link

openjdk bot commented Jul 15, 2025

Going to push as commit 18c2e40.
Since your change was applied there have been 29 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 15, 2025
@openjdk openjdk bot closed this Jul 15, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 15, 2025
@openjdk
Copy link

openjdk bot commented Jul 15, 2025

@azvegint Pushed as commit 18c2e40.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

xrandrExtSupported =
Boolean.valueOf(initXrandrExtension());
boolean useOldConfigDisplayMode =
Boolean.getBoolean("awt.x11useOldConfigDisplayMode");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.


static jint refreshRateFromModeInfo(const XRRModeInfo *modeInfo) {
if (!modeInfo->hTotal || !modeInfo->vTotal) {
return 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be REFRESH_RATE_UNKNOWN?

Bool matchW = (isLandscape ? mode.width : mode.height) == (unsigned int) width;
Bool matchH = (isLandscape ? mode.height : mode.width) == (unsigned int) height;

if (matchW && matchH && rr == refreshRate) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to stop on the first mode we found or we should select the nearest refrate to the int? or maybe select the largest one? like 59.7 vs 59.9 vs 60?

@mrserb
Copy link
Member

mrserb commented Jul 16, 2025

Additionally to the comments above I think some test should be updated to touch both cases when the new property is set and not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants