-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8239894: Xserver crashes when the wrong high refresh rate is used #2136
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
Conversation
👋 Welcome back serb! A progress list of the required criteria for merging this PR into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess not having this functionality at all is better than having a code that hangs. Can we have these new bugs about re-implementing this functionality linked in the initial bug so they can be tracked easier?
@mrserb 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:
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 35 new commits pushed to the
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 |
/integrate |
@mrserb Since your change was applied there have been 49 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit a7c2ebc. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
We use two different approaches to listing the display modes on the system:
Unfortunately, the current code does not work for some specific double scan modes, it doubles the real refresh rate. If this refresh rate will be passed to the Xserver later it could hang/crash.
The same bug existed in xrandr utility before version 1.4:
https://bugs.freedesktop.org/show_bug.cgi?id=37043
https://gitlab.freedesktop.org/xorg/app/xrandr/commit/7fd4f18b649f22fad4dbf9fc64b69b3e7f172207
As suggested in the bug report I have tried to unify the code for single and multiscreen systems and use updated code currently used on the multiscreen.
But unfortunately, I have found that the multi-screen code is even more broken. The problematic code is this:
The idea of the code is: if the passed screen is Xinerama index used by the java2d, then the "scr" will be zero, and "out" will be the "virtual" index for that screen. If the screen is X11 screen then "src" will be the correct screen and "out" will be zero.
The problem is that the code assumes that xrandr expect the "virtual" index as the "out" parameter, but this is not. This parameter is the index of the "output" such as DP1, DP2, other ports/etc.
So sometimes the code works when the first screen is connected to the first port on the video card and the second screen to the second port, otherwise, we just report data for the wrong screen or report nothing.
I did not found a reliable way to map Xinerama srceens to the xrandr. It is better to rework the java2d to use the xrandr instead of xinerama.
As a fix, I suggest dropping the code which uses the incorrect mapping screen->output. This includes the code related to the display modes added in the JDK-8167486 + JDK-8022810, and also the code related to the calculation of scale factor from the "ubuntu property" which does not work on the recent ubuntu version after migration to gnome3 added in the JDK-8149115
I will file a separate two bugs to reimplement this functionality, most probably the "display modes" will be implementing when we fully migrate to the xrandr, and calculation of the scale factor will be implemented via the gtk library.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2136/head:pull/2136
$ git checkout pull/2136