Skip to content

8266159: macOS ARM + Metal pipeline shows artifacts on Swing Menu with Java L&F #4356

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
wants to merge 3 commits into from

Conversation

aghaisas
Copy link
Contributor

@aghaisas aghaisas commented Jun 4, 2021

This PR fixes an issue exclusively seen on Apple M1 systems when SwingSet2 demo is run with uiScale=1.0.

Issue :
SwingSet2 Demo - As reported in JBS description
J2DDemo - As reported in a comment on JBS

Root Cause :
DrawPixel path is used only with uiScale=1.0.
MTLPrimitiveTypePoint is used to draw a pixel while encoding a render command.
As mentioned in the documentation -
https://developer.apple.com/documentation/metal/mtlprimitivetype/mtlprimitivetypepoint?language=objc

"The vertex shader must provide [[point_size]], or the point size is undefined."

In our shader functions, we do not define this point size. It is harmless on x86_64 based mac systems, but causes visual artifacts on M1 mac systems.

Solution :
Explicitly define point size in shader functions that draw MTLPrimitiveTypePoint.


Progress

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

Issue

  • JDK-8266159: macOS ARM + Metal pipeline shows artifacts on Swing Menu with Java L&F

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4356/head:pull/4356
$ git checkout pull/4356

Update a local copy of the PR:
$ git checkout pull/4356
$ git pull https://git.openjdk.java.net/jdk pull/4356/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4356

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4356.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 4, 2021

👋 Welcome back aghaisas! 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 openjdk bot added the rfr Pull request is ready for review label Jun 4, 2021
@openjdk
Copy link

openjdk bot commented Jun 4, 2021

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

  • 2d

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 2d client-libs-dev@openjdk.org label Jun 4, 2021
@mlbridge
Copy link

mlbridge bot commented Jun 4, 2021

Webrevs

Copy link
Member

@jayathirthrao jayathirthrao left a comment

Choose a reason for hiding this comment

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

LGTM.
Please add CI test run link in JBS, once it is completed.

@openjdk
Copy link

openjdk bot commented Jun 4, 2021

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

8266159: macOS ARM + Metal pipeline shows artifacts on Swing Menu with Java L&F

Reviewed-by: jdv, prr

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

  • fd91b2a: 8265440: IGV: make node selection more visible
  • 81bad59: 8257774: G1: Trigger collect when free region count drops below threshold to prevent evacuation failures
  • 341f676: 8267908: linux: thread_native_entry can scribble on stack frame
  • f40c89e: 8267209: Child threads should defer logging to after child-parent handshake
  • ae986bc: 8266749: AArch64: Backtracing broken on PAC enabled systems
  • 36c4e5f: 8267187: Remove deprecated constructor for Log
  • fc08af5: 8174222: LambdaMetafactory: validate inputs and improve documentation
  • 5e557d8: 8266967: debug.cpp utility find() should print Java Object fields.
  • c7c77fd: 8255557: Decouple GCM from CipherCore
  • e546ae2: 8268296: ScopedMemoryAccess build error with readonly filesystems
  • ... and 46 more: https://git.openjdk.java.net/jdk/compare/e2d5ff9d456dd339ccd21df2f75c4e34e5784d9a...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 Pull request is ready to be integrated label Jun 4, 2021
@mrserb
Copy link
Member

mrserb commented Jun 5, 2021

Is it possible to cover this fix with some automated test? Looks non of existed tests found this issue.

@aghaisas
Copy link
Contributor Author

aghaisas commented Jun 7, 2021

Is it possible to cover this fix with some automated test? Looks non of existed tests found this issue.

Draw Pixel operation is unpredictable on macOS M1 with metal pipeline if [[point_size]] is not defined. Due to this unpredictability it is difficult to write an automated test.
I have developed a test which successfully detects this failure. It needs to be run with "-Dsun.java2d.uiScale=1.0". I will update the PR soon.

@mrserb
Copy link
Member

mrserb commented Jun 7, 2021

Looks fine, I assume that you checked the test via mach5 so we will not get a similar bug on other platforms.

@aghaisas
Copy link
Contributor Author

aghaisas commented Jun 8, 2021

/integrate

@openjdk openjdk bot closed this Jun 8, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 8, 2021
@openjdk
Copy link

openjdk bot commented Jun 8, 2021

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

  • 61ab4b9: 8267564: JDK-8252971 causes SPECjbb2015 socket exceptions on Windows when MKS is installed
  • 00c88f7: 8266918: merge_stack in check_code.c add NULL check
  • 8105478: 8268165: AsyncLogging will crash if rotate() fails
  • fd91b2a: 8265440: IGV: make node selection more visible
  • 81bad59: 8257774: G1: Trigger collect when free region count drops below threshold to prevent evacuation failures
  • 341f676: 8267908: linux: thread_native_entry can scribble on stack frame
  • f40c89e: 8267209: Child threads should defer logging to after child-parent handshake
  • ae986bc: 8266749: AArch64: Backtracing broken on PAC enabled systems
  • 36c4e5f: 8267187: Remove deprecated constructor for Log
  • fc08af5: 8174222: LambdaMetafactory: validate inputs and improve documentation
  • ... and 49 more: https://git.openjdk.java.net/jdk/compare/e2d5ff9d456dd339ccd21df2f75c4e34e5784d9a...master

Your commit was automatically rebased without conflicts.

Pushed as commit 89da202.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2d client-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

5 participants