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

8275715: D3D pipeline processes multiple PaintEvent at initial drawing #6064

Closed
wants to merge 2 commits into from

Conversation

masyano
Copy link

@masyano masyano commented Oct 21, 2021

Could you please review the 8275715 bug fixes?

I think D3DScreenUpdateManager posts unnecessary PaintEvent during processing PaintEvent. When the validate method is called from createGraphics, repaintPeerTarget should not be called.


Progress

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

Issue

  • JDK-8275715: D3D pipeline processes multiple PaintEvent at initial drawing

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6064

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 21, 2021

👋 Welcome back myano! 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 Oct 21, 2021
@openjdk
Copy link

openjdk bot commented Oct 21, 2021

@masyano 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 Oct 21, 2021
@mlbridge
Copy link

mlbridge bot commented Oct 21, 2021

Webrevs


public class MultiPaintEventTest extends Canvas {

private int count = 0;
Copy link
Member

@mrserb mrserb Oct 23, 2021

Choose a reason for hiding this comment

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

Some synchronization is needed, the field is updated on EDT and checked on the main thread.

Copy link
Author

Choose a reason for hiding this comment

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

I fixed a test as it was pointed out to me.

if (test.getCount() > 1) {
throw new RuntimeException("Processed unnecessary paint().");
}
} catch (InterruptedException ex) {
Copy link
Member

Choose a reason for hiding this comment

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

Do not ignore an exception

Copy link
Author

Choose a reason for hiding this comment

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

I fixed a test as it was pointed out to me.

@@ -452,7 +452,7 @@ public void run() {
} finally {
rq.unlock();
}
} else if (!validate(sd)) {
} else if (!validate(sd, true)) {
Copy link
Member

Choose a reason for hiding this comment

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

The comment below says that "the surface will also trigger a repaint", will it be possible we will trigger it inside validate here and then later inside "replaceSurfaceDataLater"?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, this run() is called on "D3D Screen Updater" thread. It is reasonable that a new PaintEvent is posted when SurfaceData is replaced on this thread. I would limit posting new PaintEvent via createGraphics() only.

Copy link
Member

@mrserb mrserb Oct 28, 2021

Choose a reason for hiding this comment

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

Probably I should clarify my question, you added a parameter to the validate method and pass the "true" so the "validate" method will post a paint event, but just a few lines below there is a comment that the next code line "sd.getPeer().replaceSurfaceDataLater();" also will post an event. Is the comment outdated, or we will post two of them?

Copy link
Author

Choose a reason for hiding this comment

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

Neither. replaceSurfaceDataLater() is called when validate() fails to post a PaintEvent. So only one of them will be posted.

Copy link
Author

Choose a reason for hiding this comment

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

@mrserb Could you please review and reply to the above comment?

Copy link
Member

Choose a reason for hiding this comment

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

Yes.

Copy link
Author

Choose a reason for hiding this comment

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

@mrserb Could you please check this pull request?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a pretty important block of code and we are about to fork JDK 18 so it should be looked at after that fork.

Copy link
Author

Choose a reason for hiding this comment

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

@mrserb @prrace JDK 18 has been forked, so please resume the review of this fix.

Copy link
Author

Choose a reason for hiding this comment

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

@mrserb @prrace Could you please review the above comments?

@masyano
Copy link
Author

masyano commented Nov 22, 2021

@mrserb The fixes in JDK-8270874 have been integrated, so please review this PR again.

@masyano
Copy link
Author

masyano commented Nov 29, 2021

@mrserb Could you please reply to the above comment?

@masyano
Copy link
Author

masyano commented Dec 3, 2021

@mrserb Could you please check this pull request?

1 similar comment
@masyano
Copy link
Author

masyano commented Jan 5, 2022

@mrserb Could you please check this pull request?

@masyano
Copy link
Author

masyano commented Jan 12, 2022

@mrserb How long will it take to review this fix?

@masyano
Copy link
Author

masyano commented Jan 17, 2022

@mrserb Could you please review this PR again?

@masyano
Copy link
Author

masyano commented Jan 26, 2022

@mrserb Could you tell me the confirmation status of this PR?

@masyano
Copy link
Author

masyano commented Feb 1, 2022

@mrserb @prrace Could you tell me what I need to do to merge this PR fix?

@prrace
Copy link
Contributor

prrace commented Feb 6, 2022

The problem I have with this is that this being in createGraphics() isn't obviously relevant to me.
The repaintPeerTarget() is called only if the surface is lost which means it needs repainting.
Or does surface lost here perhaps mean "surface has not yet been created", because we aren't
yet showing the window contents at all and we really should wait for the first paint event ?

@masyano
Copy link
Author

masyano commented Feb 10, 2022

@prrace createGraphics() is called to create surface during "the first paint event" processing. And validate() posts new PaintEvent with repaintPeerTarget() when creates surface.

Current stack trace is here:

[1] java.awt.event.PaintEvent. (PaintEvent.java:106)
[2] sun.awt.PaintEventDispatcher.createPaintEvent (PaintEventDispatcher.java:80)
[3] sun.awt.windows.WComponentPeer.postPaintIfNecessary (WComponentPeer.java:892)
[4] sun.awt.windows.WComponentPeer.handlePaint (WComponentPeer.java:886)
[5] sun.java2d.d3d.D3DScreenUpdateManager.repaintPeerTarget (D3DScreenUpdateManager.java:283)
[6] sun.java2d.d3d.D3DScreenUpdateManager.validate (D3DScreenUpdateManager.java:492)
[7] sun.java2d.d3d.D3DScreenUpdateManager.createGraphics (D3DScreenUpdateManager.java:260)
[8] sun.awt.windows.WComponentPeer.getGraphics (WComponentPeer.java:646)
[9] java.awt.Component.getGraphics (Component.java:3,128)
[10] sun.awt.RepaintArea.paint (RepaintArea.java:227)
[11] sun.awt.windows.WComponentPeer.handleEvent (WComponentPeer.java:371)
[12] java.awt.Component.dispatchEventImpl (Component.java:5,056)
[13] java.awt.Container.dispatchEventImpl (Container.java:2,325)
[14] java.awt.Window.dispatchEventImpl (Window.java:2,775)
[15] java.awt.Component.dispatchEvent (Component.java:4,827)
[16] java.awt.EventQueue.dispatchEventImpl (EventQueue.java:772)

Created surface is normally handled in this processing PaintEvent, so I think there is no need to call repaintPeerTarget(). Also ScreenUpdateManager class which is used for GDI rendering (and parent class of D3DScreenUpdateManager) does not post new PaintEvent at createGraphics(). This validate() is called from createGraphics(), so I hope to reduce to create another PaintEvent at this route only.

@prrace
Copy link
Contributor

prrace commented Feb 14, 2022

Ok. Please confirm you have run all automated headful jtreg tests on a system with D3D enabled
and that you have also done manual testing (using SwingSet2 and J2Ddemo) and no problems are observed ?

@masyano
Copy link
Author

masyano commented Feb 17, 2022

I tryed jtreg tests with -a -k:headful :jdk_desktop, then all tests are passed. And all graphical tests are rendered correctly. Also SwingSet2 and J2Ddemo works fine.

@masyano
Copy link
Author

masyano commented Feb 24, 2022

@prrace Could you please check the above comments and reply?

@masyano
Copy link
Author

masyano commented Mar 2, 2022

@prrace How long will it take for you to reply to the comment?

@openjdk
Copy link

openjdk bot commented Mar 4, 2022

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

8275715: D3D pipeline processes multiple PaintEvent at initial drawing

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

  • bae0d5e: 8236907: JTable added to nested panels does not paint last visible row
  • b0028a4: 8272853: improve JavadocTester.runTests
  • e07fd39: 8281181: Do not use CPU Shares to compute active processor count
  • 9c817d3: 8015854: [macosx] JButton's HTML ImageView adding unwanted padding
  • 733c790: 8282081: java.time.DateTimeFormatter: wrong definition of symbol F
  • f9f9c0a: 8252769: Warn in configure if git config autocrlf has invalid value
  • 603050b: 8282661: [BACKOUT] ByteBufferTest.java: replace endless recursion with RuntimeException in void ck(double x, double y)
  • 5247153: 8282615: G1: Fix some includes
  • a584c90: 8282573: ByteBufferTest.java: replace endless recursion with RuntimeException in void ck(double x, double y)
  • d5e8e52: 8282532: Allow explicitly setting build platform alongside --openjdk-target
  • ... and 1585 more: https://git.openjdk.java.net/jdk/compare/c41ce6d159e59a8c05dbeacde2d2612b58733d46...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 Mar 4, 2022
@masyano
Copy link
Author

masyano commented Mar 6, 2022

/integrate

@openjdk
Copy link

openjdk bot commented Mar 6, 2022

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

  • 974ef55: 8282617: sun.net.www.protocol.https.HttpsClient#putInKeepAliveCache() doesn't use a lock while dealing with "inCache" field
  • bc42e7c: 8282382: Report glibc malloc tunables in error reports
  • 52278b8: 8282694: ProblemList runtime/CommandLine/VMDeprecatedOptions.java
  • c459f8f: 8282142: [TestCase] compiler/inlining/ResolvedClassTest.java will fail when --with-jvm-features=-compiler1
  • bae0d5e: 8236907: JTable added to nested panels does not paint last visible row
  • b0028a4: 8272853: improve JavadocTester.runTests
  • e07fd39: 8281181: Do not use CPU Shares to compute active processor count
  • 9c817d3: 8015854: [macosx] JButton's HTML ImageView adding unwanted padding
  • 733c790: 8282081: java.time.DateTimeFormatter: wrong definition of symbol F
  • f9f9c0a: 8252769: Warn in configure if git config autocrlf has invalid value
  • ... and 1589 more: https://git.openjdk.java.net/jdk/compare/c41ce6d159e59a8c05dbeacde2d2612b58733d46...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 6, 2022

@masyano Pushed as commit 415bf44.

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

@dholmes-ora
Copy link
Member

@masyano the new test has an invalid copyright notice: missing comma after 2021, which is causing a tier 1 build failure in our CI.

@masyano
Copy link
Author

masyano commented Mar 7, 2022

@dholmes-ora Thank you for notice. Should I create a new pull request to correct the copyright?

@dholmes-ora
Copy link
Member

New bug filed: JDK-8282713 - which will need a new PR. Thanks.

@masyano
Copy link
Author

masyano commented Mar 7, 2022

I opened new PR at #7716.

@prrace
Copy link
Contributor

prrace commented Mar 7, 2022

FWIW this should not have been pushed without a 2nd reviewer (meaning two approvals).
Please review the code review policies section here https://openjdk.java.net/groups/client-libs/
where it says
The standard requirement in Java SE is for one (or more) reviewer prior to code freeze and two (or more) reviewers thereafter. The Java Client Library Group has standardized on two reviewers with few exceptions.

You pushed with only one approval. Bear that in mind !

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
4 participants