Skip to content
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

8076313: GraphicsEnvironment does not detect changes in count of monitors on Linux OS #2230

Closed
wants to merge 19 commits into from

Conversation

@mrserb
Copy link
Member

@mrserb mrserb commented Jan 26, 2021

This fix enables display change detection on Linux when the number of monitors is changed in the Xinerama mode.

The fix itself is straightforward:

  1. When we get an event that the root window is changed we assume that it could be caused by some screen manipulation like screen resolution change or adding/removing a monitor.
  2. We rebuild the native data structure for the x11 screens, and then mirror this data on the java level in the X11GraphicsEnvironment.
  3. While we updating the data, we block all access to it in the native -> after the fix all access to the native x11 screens should be done under awt-lock.

Notes:

  • This fix has a long chain of pre-fixes where we dropped the native access to the x11 screens, to minimize the places we need to synchronize.
  • In the current version we rebuild the screens more often than needed, for example, we rebuild it even if resolution changed in a single monitor config. It is done intentionally to increase the test code coverage for now.
  • The current implementation is based on the Xinerama, while the better solution will be use XRandr 1.5, but it does not support AIX, and is not supported in the current devkit.

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8076313: GraphicsEnvironment does not detect changes in count of monitors on Linux OS

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/2230/head:pull/2230
$ git checkout pull/2230

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Jan 26, 2021

👋 Welcome back serb! 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 openjdk bot commented Jan 26, 2021

⚠️ @mrserb This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@openjdk
Copy link

@openjdk openjdk bot commented Jan 26, 2021

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

  • awt

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.

@openjdk openjdk bot added the awt label Jan 26, 2021
@mrserb mrserb marked this pull request as ready for review Jan 26, 2021
@mrserb mrserb marked this pull request as draft Jan 26, 2021
@@ -105,6 +110,25 @@ public int getType() {
return TYPE_RASTER_SCREEN;
}

public int scaleUp(int x) {
Copy link
Member Author

@mrserb mrserb Jan 31, 2021

This is copied not moved from the X11GraphicsConfig, just to minimize the change in the fix. I Will clean up this later.

@mrserb mrserb marked this pull request as ready for review Jan 31, 2021
@openjdk openjdk bot added the rfr label Jan 31, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Jan 31, 2021

Webrevs

Copy link
Member

@azuev-java azuev-java left a comment

Looks good.

@openjdk
Copy link

@openjdk openjdk bot commented Feb 2, 2021

@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:

8076313: GraphicsEnvironment does not detect changes in count of monitors on Linux OS

Reviewed-by: 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 28 new commits pushed to the master branch:

  • 288a4fe: 8260643: Remove parallel version handling in CardTableRS::younger_refs_in_space_iterate()
  • ddd2951: 8260571: Add PrintMetaspaceStatistics to print metaspace statistics upon VM exit
  • fe407cf: 8260420: C2 compilation fails with assert(found_sfpt) failed: no node in loop that's not input to safepoint
  • 474dba2: 8257086: Clarify differences between {Float, Double}.equals and ==
  • 54e7a64: 8260576: Typo in compiler/runtime/safepoints/TestRegisterRestoring.java
  • a6d9505: 8260864: ProblemList two security/krb5 tests on Linux
  • 9880c4c: 8260860: ProblemList tools/jlink/plugins/CompressorPluginTest.java
  • 55d62a5: 8213226: [TESTBUG] Reduce the usage of CDSTestUtils.executeAndLog()
  • b6a7367: 8260349: Cannot programmatically retrieve Metaspace max set via JAVA_TOOL_OPTIONS
  • 50f9a70: 8217327: G1 Post-Cleanup region liveness printing should not print out-of-date efficiency
  • ... and 18 more: https://git.openjdk.java.net/jdk/compare/71bfe962ebcf46537d4624e5ddf36003365fbb84...master

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 openjdk bot added the ready label Feb 2, 2021
@mrserb
Copy link
Member Author

@mrserb mrserb commented Feb 3, 2021

/integrate

@openjdk openjdk bot closed this Feb 3, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Feb 3, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Feb 3, 2021

@mrserb Since your change was applied there have been 42 commits pushed to the master branch:

  • a47befc: 8260878: com/sun/jdi/JdbOptions.java fails without jfr
  • d423d36: 8258508: Merge G1RedirtyCardsQueue into qset
  • bec6043: 8259570: (macos) tools/jpackage tests fails with 'hdiutil: couldn't eject "disk2" - Resource busy'
  • ffbcf1b: 8260471: Change SystemDictionary::X_klass calls to vmClasses::X_klass
  • 9af3339: 8261003: Bad Copyright header format after JDK-8183372
  • 6dc3c6d: 8183372: Refactor java/lang/Class shell tests to java
  • 105d3e8: 8260861: TrustStoreDescriptor log the same value
  • 69189f8: 8256421: Add 2 HARICA roots to cacerts truststore
  • f546fd0: 8260902: CDS mapping errors should not lead to unconditional output
  • d7b1fc5: 8260707: java/lang/instrument/PremainClass/InheritAgent0100.java times out
  • ... and 32 more: https://git.openjdk.java.net/jdk/compare/71bfe962ebcf46537d4624e5ddf36003365fbb84...master

Your commit was automatically rebased without conflicts.

Pushed as commit 98a7692.

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

@mrserb mrserb deleted the JDK-8076313 branch Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants