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

8272288: Funky multiresolution image breaks graphics context #11664

Closed
wants to merge 2 commits into from

Conversation

mrserb
Copy link
Member

@mrserb mrserb commented Dec 14, 2022

This is the next iteration of fixing the issue of rendering "broken" image. The fix for JDK-7183828 changed the possible IllegalArgumentException during rendering to the InvalidPipeException in assumtion that the new exception will be catched by the java2d machinery and the current-accelerated pipeline will be invalidated and software-pipeline will take care about that image.

But that change uncover another bug, the accelerated-pipeline invalidation by the InvalidPipeException works in D3D pipeline only, other pipelines start to use software based surfaces, but do not report about that the client code, as a result the next code does not work as expected, since contentsLost alwys return false:

        do {
            vi.validate(gc);
            Graphics2D g = vi.createGraphics();
            g.fillRect(0, 0, vi.getWidth(), vi.getHeight());
            g.dispose();
        } while (vi.contentsLost());

After this change the correct value will be reported by the contentsLost(), so the RepaintManager will be able to catch that.
But this fix uncovered another bug. That fallback code path in the RepaintManager was not tested on HiDPI screen and does not work well. I'll file a separate bug about that.


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-8272288: Funky multiresolution image breaks graphics context

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11664

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 14, 2022

👋 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 bot commented Dec 14, 2022

@mrserb 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.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Dec 14, 2022
@mrserb mrserb marked this pull request as ready for review December 30, 2022 06:25
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 30, 2022
@mlbridge
Copy link

mlbridge bot commented Dec 30, 2022

Webrevs

vi.validate(gc);
Graphics2D g = vi.createGraphics();
g.setColor(Color.RED);
g.drawImage(image, 0, 0, null); // <- can cause InvalidPipeException
Copy link
Member

@jayathirthrao jayathirthrao Jan 19, 2023

Choose a reason for hiding this comment

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

This drawImage call is expected to through InvalidPipeException all the times or is it intermittent?
If it is intermittent why so? Please explain.

It looks like after 8da6c8d6 we will through InvalidPipeException for all cases of custom images and not intermittently.

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 is not really intermittent but depends on the java2d pipeline currently in use. InvalidPipeException is produced by the accelerated pipelines but code works fine on GDI for example.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the clarification

* @summary Broken rendering should be reported by the contentsLost()
*
* @requires (os.family == "mac")
* @run main/othervm -Dsun.java2d.opengl=True ReportRenderingError
Copy link
Member

Choose a reason for hiding this comment

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

I ran this test in macOS and without the fix it exits after checking only OpenGL pipeline. We dont override restoreContents() in CGLVolatileSurfaceManager/MTLVolatileSurfaceManager so its better if we can force the test to run on all pipelines on individual platforms and not exit on first failure based on jtreg instrcutions. This will make the test more robust.

Copy link
Member Author

Choose a reason for hiding this comment

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

This java file already contains 4 tests(each can be run/problemlists separately), one covers the default pipeline on all platforms, and the other 3 cover some platform specific just in case.

vi.validate(gc);
Graphics2D g = vi.createGraphics();
g.setColor(Color.RED);
g.drawImage(image, 0, 0, null); // <- can cause InvalidPipeException
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the clarification

@openjdk
Copy link

openjdk bot commented Feb 8, 2023

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

8272288: Funky multiresolution image breaks graphics context

Reviewed-by: jdv

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

  • 2a579ab: 8292588: [macos] Multiscreen/MultiScreenLocationTest/MultiScreenLocationTest.java: Robot.mouseMove test failed on Screen #0
  • 53f72ed: 8286510: Tests under dynamicArchive/methodHandles should check for loading of lambda proxy classes
  • 74485a3: 8301810: Bug in doctree DocCommentTester.compress
  • 2712615: 8298445: Add LeakSanitizer support in HotSpot
  • 2e2e71e: 8300416: java.security.MessageDigestSpi clone can result in thread-unsafe clones
  • a73d012: 8295019: Cannot call a method with a parameter of a local class declared in a lambda
  • 4fe99da: 8151413: os::allocation_granularity/page_size and friends return signed values
  • 09b8a19: 8300177: URISyntaxException fields can be final
  • c61a382: 8296646: com/sun/jdi/JdbLastErrorTest.java test failure
  • f5f38a8: 8301371: Interpreter store barriers on x86_64 don't have disjoint temp registers
  • ... and 597 more: https://git.openjdk.org/jdk/compare/04591595374e84cfbfe38d92bff4409105b28009...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 Feb 8, 2023
@mrserb
Copy link
Member Author

mrserb commented Feb 9, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Feb 9, 2023

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

  • 77ead44: 8302066: Counter _number_of_nmethods_with_dependencies should be atomic.
  • f4b72df: 8282379: [LOOM] vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011 sometimes fails
  • 7fd440d: 8298868: Update EngineCloseOnAlert.java for changes to TLS implementation
  • 7901f45: 8301260: Add system property to toggle XML Signature secure validation mode
  • 597a9a4: 8301822: BasicLookAndFeel does not need to check for null after checking for type
  • 3b05a94: 8301858: Verification error when compiling switch with record patterns
  • e4d1cff: 8300268: ServerImpl allows too many idle connections when using sun.net.httpserver.maxIdleConnections
  • af8973d: Merge
  • e81f20b: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE
  • 6f460e4: 8301863: ObjectInputFilter example incorrectly calls rejectUndecidedClass
  • ... and 633 more: https://git.openjdk.org/jdk/compare/04591595374e84cfbfe38d92bff4409105b28009...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 9, 2023

@mrserb Pushed as commit 5147969.

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

@mrserb mrserb deleted the JDK-8272288 branch February 9, 2023 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants