Re: [OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog [v2]

2021-06-30 Thread Jayathirth D V
On Wed, 30 Jun 2021 14:37:31 GMT, Jayathirth D V  wrote:

>> Final blit operation in MTLLayer.blitTexture() is driven by CVDisplayLink in 
>> Metal.
>> In this test case we are hitting an invalid condition because of which we 
>> exit from MTLLayer.blitTexture(), but we are not stopping the CVDisplayLink. 
>> This is causing the CVDisplayLink callback to run in loop. Fix is to stop 
>> CVDisplayLink when we return without completing final blit operation in 
>> MTLLayer.blitTexture().
>> 
>> Sanity and performance analysis is green. More details in JBS.
>
> Jayathirth D V has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Remove stopDisplayLink call when nextDrawableCount is not zero

Verified that all test run is green with latest commit also.

-

PR: https://git.openjdk.java.net/jdk17/pull/175


Re: [OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog [v2]

2021-06-30 Thread Ajit Ghaisas
On Wed, 30 Jun 2021 14:37:31 GMT, Jayathirth D V  wrote:

>> Final blit operation in MTLLayer.blitTexture() is driven by CVDisplayLink in 
>> Metal.
>> In this test case we are hitting an invalid condition because of which we 
>> exit from MTLLayer.blitTexture(), but we are not stopping the CVDisplayLink. 
>> This is causing the CVDisplayLink callback to run in loop. Fix is to stop 
>> CVDisplayLink when we return without completing final blit operation in 
>> MTLLayer.blitTexture().
>> 
>> Sanity and performance analysis is green. More details in JBS.
>
> Jayathirth D V has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Remove stopDisplayLink call when nextDrawableCount is not zero

Marked as reviewed by aghaisas (Committer).

-

PR: https://git.openjdk.java.net/jdk17/pull/175


Re: [OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog [v2]

2021-06-30 Thread Sergey Bylokhov
On Wed, 30 Jun 2021 08:09:28 GMT, Jayathirth D V  wrote:

>> No, I meant if we dispose the frame/exist from the app/etc before 
>> "Java_sun_java2d_metal_MTLLayer_blitTexture" method is executed but after we 
>> call "startDisplayLink", when we will call the stopDisplayLink in this case?
>
> @mrserb Please let me know if i can resolve this conversation.

ok, looks fine

-

PR: https://git.openjdk.java.net/jdk17/pull/175


Re: [OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog [v2]

2021-06-30 Thread Sergey Bylokhov
On Wed, 30 Jun 2021 14:37:31 GMT, Jayathirth D V  wrote:

>> Final blit operation in MTLLayer.blitTexture() is driven by CVDisplayLink in 
>> Metal.
>> In this test case we are hitting an invalid condition because of which we 
>> exit from MTLLayer.blitTexture(), but we are not stopping the CVDisplayLink. 
>> This is causing the CVDisplayLink callback to run in loop. Fix is to stop 
>> CVDisplayLink when we return without completing final blit operation in 
>> MTLLayer.blitTexture().
>> 
>> Sanity and performance analysis is green. More details in JBS.
>
> Jayathirth D V has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Remove stopDisplayLink call when nextDrawableCount is not zero

Marked as reviewed by serb (Reviewer).

-

PR: https://git.openjdk.java.net/jdk17/pull/175


Re: [OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog [v2]

2021-06-30 Thread Jayathirth D V
> Final blit operation in MTLLayer.blitTexture() is driven by CVDisplayLink in 
> Metal.
> In this test case we are hitting an invalid condition because of which we 
> exit from MTLLayer.blitTexture(), but we are not stopping the CVDisplayLink. 
> This is causing the CVDisplayLink callback to run in loop. Fix is to stop 
> CVDisplayLink when we return without completing final blit operation in 
> MTLLayer.blitTexture().
> 
> Sanity and performance analysis is green. More details in JBS.

Jayathirth D V has updated the pull request incrementally with one additional 
commit since the last revision:

  Remove stopDisplayLink call when nextDrawableCount is not zero

-

Changes:
  - all: https://git.openjdk.java.net/jdk17/pull/175/files
  - new: https://git.openjdk.java.net/jdk17/pull/175/files/5b5914ab..cca4c900

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk17=175=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk17=175=00-01

  Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk17/pull/175.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/175/head:pull/175

PR: https://git.openjdk.java.net/jdk17/pull/175


Re: [OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog

2021-06-30 Thread Jayathirth D V
On Wed, 30 Jun 2021 11:36:18 GMT, Ajit Ghaisas  wrote:

>> Final blit operation in MTLLayer.blitTexture() is driven by CVDisplayLink in 
>> Metal.
>> In this test case we are hitting an invalid condition because of which we 
>> exit from MTLLayer.blitTexture(), but we are not stopping the CVDisplayLink. 
>> This is causing the CVDisplayLink callback to run in loop. Fix is to stop 
>> CVDisplayLink when we return without completing final blit operation in 
>> MTLLayer.blitTexture().
>> 
>> Sanity and performance analysis is green. More details in JBS.
>
> src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.m line 88:
> 
>> 86: 
>> 87: if (self.nextDrawableCount != 0) {
>> 88: [self stopDisplayLink];
> 
> Please check invoking stopDisplayLink at this place.  If a Drawable is not 
> available, we should return from here but recheck after 16ms. A drawable 
> might be made available on subsequent attempts.
> 
> Stopping DisplayLink at other invalid cases makes sense.

@aghaisas Thanks for the review. Redraw of static content is driven by 
setNeedsDisplay, because we stop CVDisplayLink once final blit is done. Also 
with preliminary testing i see that we are not hitting this condition at all 
after CVDisplayLink is enabled. We still have a verification task under 
https://bugs.openjdk.java.net/browse/JDK-8258583 . Stopping or not stopping 
CVDisplayLink at this place is not causing any change. I will go ahead and 
remove stopDisplayLink at this place, in future if we hit this code because of 
some boundary condition we can enable it and verify.

-

PR: https://git.openjdk.java.net/jdk17/pull/175


Re: [OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog

2021-06-30 Thread Ajit Ghaisas
On Tue, 29 Jun 2021 17:34:00 GMT, Jayathirth D V  wrote:

> Final blit operation in MTLLayer.blitTexture() is driven by CVDisplayLink in 
> Metal.
> In this test case we are hitting an invalid condition because of which we 
> exit from MTLLayer.blitTexture(), but we are not stopping the CVDisplayLink. 
> This is causing the CVDisplayLink callback to run in loop. Fix is to stop 
> CVDisplayLink when we return without completing final blit operation in 
> MTLLayer.blitTexture().
> 
> Sanity and performance analysis is green. More details in JBS.

I tested this patch with applications such as SwingSet2 and NetBeans IDE with 
graphics card switching. Also, tested multi-monitor scenarios. No regression 
observed.

src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.m line 88:

> 86: 
> 87: if (self.nextDrawableCount != 0) {
> 88: [self stopDisplayLink];

Please check invoking stopDisplayLink at this place.  If a Drawable is not 
available, we should return from here but recheck after 16ms. A drawable might 
be made available on subsequent attempts.

Stopping DisplayLink at other invalid cases makes sense.

-

PR: https://git.openjdk.java.net/jdk17/pull/175


Re: [OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog

2021-06-30 Thread Jayathirth D V
On Tue, 29 Jun 2021 23:28:44 GMT, Sergey Bylokhov  wrote:

> Please confirm that mach5 is green.

@mrserb Yes CI test run is green. Test link in JBS.

-

PR: https://git.openjdk.java.net/jdk17/pull/175


Re: [OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog

2021-06-30 Thread Jayathirth D V
On Wed, 30 Jun 2021 04:29:56 GMT, Sergey Bylokhov  wrote:

>> At this point if we exit, we just return and unlock MTLRenderQueue for 
>> backbuffer rendering. And when it is done we again start CVDisplayLink in 
>> MTLRenderQueue which in turn calls setNeedsDisplay to get callback to 
>> MTLLayer.display().
>> 
>> This scenario is same as returning from CGLLayer.blitTexture() when 
>> textureID is 0. Appkit thread will be running in the background and we dont 
>> stop it.
>
> No, I meant if we dispose the frame/exist from the app/etc before 
> "Java_sun_java2d_metal_MTLLayer_blitTexture" method is executed but after we 
> call "startDisplayLink", when we will call the stopDisplayLink in this case?

@mrserb Please let me know if i can resolve this conversation.

-

PR: https://git.openjdk.java.net/jdk17/pull/175


Re: [OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog

2021-06-29 Thread Jayathirth D V
On Wed, 30 Jun 2021 04:29:56 GMT, Sergey Bylokhov  wrote:

>> At this point if we exit, we just return and unlock MTLRenderQueue for 
>> backbuffer rendering. And when it is done we again start CVDisplayLink in 
>> MTLRenderQueue which in turn calls setNeedsDisplay to get callback to 
>> MTLLayer.display().
>> 
>> This scenario is same as returning from CGLLayer.blitTexture() when 
>> textureID is 0. Appkit thread will be running in the background and we dont 
>> stop it.
>
> No, I meant if we dispose the frame/exist from the app/etc before 
> "Java_sun_java2d_metal_MTLLayer_blitTexture" method is executed but after we 
> call "startDisplayLink", when we will call the stopDisplayLink in this case?

In that case it will hit MTLLayer.dealloc() where we stop and release 
CVDisplayLink.

-

PR: https://git.openjdk.java.net/jdk17/pull/175


Re: [OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog

2021-06-29 Thread Sergey Bylokhov
On Wed, 30 Jun 2021 04:00:54 GMT, Jayathirth D V  wrote:

>> src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.m line 286:
>> 
>>> 284: if (layer == NULL || ctx == NULL) {
>>> 285: J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer_blit : Layer or 
>>> Context is null");
>>> 286: [layer stopDisplayLink];
>> 
>> What happens if we exit before this "blitTexture" is called? Do not we need 
>> to stop(w/o possibility to restart it) that thread on toolkit shutdown or 
>> something like this?
>
> At this point if we exit, we just return and unlock MTLRenderQueue for 
> backbuffer rendering. And when it is done we again start CVDisplayLink in 
> MTLRenderQueue which in turn calls setNeedsDisplay to get callback to 
> MTLLayer.display().
> 
> This scenario is same as returning from CGLLayer.blitTexture() when textureID 
> is 0. Appkit thread will be running in the background and we dont stop it.

No, I meant if we dispose the frame/exist from the app/etc before 
"Java_sun_java2d_metal_MTLLayer_blitTexture" method is executed but after we 
call "startDisplayLink", when we will call the stopDisplayLink in this case?

-

PR: https://git.openjdk.java.net/jdk17/pull/175


Re: [OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog

2021-06-29 Thread Jayathirth D V
On Tue, 29 Jun 2021 23:31:33 GMT, Sergey Bylokhov  wrote:

>> Final blit operation in MTLLayer.blitTexture() is driven by CVDisplayLink in 
>> Metal.
>> In this test case we are hitting an invalid condition because of which we 
>> exit from MTLLayer.blitTexture(), but we are not stopping the CVDisplayLink. 
>> This is causing the CVDisplayLink callback to run in loop. Fix is to stop 
>> CVDisplayLink when we return without completing final blit operation in 
>> MTLLayer.blitTexture().
>> 
>> Sanity and performance analysis is green. More details in JBS.
>
> src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.m line 286:
> 
>> 284: if (layer == NULL || ctx == NULL) {
>> 285: J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer_blit : Layer or Context 
>> is null");
>> 286: [layer stopDisplayLink];
> 
> What happens if we exit before this "blitTexture" is called? Do not we need 
> to stop(w/o possibility to restart it) that thread on toolkit shutdown or 
> something like this?

At this point if we exit, we just return and unlock MTLRenderQueue for 
backbuffer rendering. And when it is done we again start CVDisplayLink in 
MTLRenderQueue which in turn calls setNeedsDisplay to get callback to 
MTLLayer.display().

This scenario is same as returning from CGLLayer.blitTexture() when textureID 
is 0. Appkit thread will be running in the background and we dont stop it.

-

PR: https://git.openjdk.java.net/jdk17/pull/175


Re: [OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog

2021-06-29 Thread Sergey Bylokhov
On Tue, 29 Jun 2021 17:34:00 GMT, Jayathirth D V  wrote:

> Final blit operation in MTLLayer.blitTexture() is driven by CVDisplayLink in 
> Metal.
> In this test case we are hitting an invalid condition because of which we 
> exit from MTLLayer.blitTexture(), but we are not stopping the CVDisplayLink. 
> This is causing the CVDisplayLink callback to run in loop. Fix is to stop 
> CVDisplayLink when we return without completing final blit operation in 
> MTLLayer.blitTexture().
> 
> Sanity and performance analysis is green. More details in JBS.

Please confirm that mach5 is green.

src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.m line 286:

> 284: if (layer == NULL || ctx == NULL) {
> 285: J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer_blit : Layer or Context 
> is null");
> 286: [layer stopDisplayLink];

What happens if we exit before this "blitTexture" is called? Do not we need to 
stop(w/o possibility to restart it) that thread on toolkit shutdown or 
something like this?

-

PR: https://git.openjdk.java.net/jdk17/pull/175


[OpenJDK 2D-Dev] [jdk17] RFR: 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit on cancelling print dialog

2021-06-29 Thread Jayathirth D V
Final blit operation in MTLLayer.blitTexture() is driven by CVDisplayLink in 
Metal.
In this test case we are hitting an invalid condition because of which we exit 
from MTLLayer.blitTexture(), but we are not stopping the CVDisplayLink. This is 
causing the CVDisplayLink callback to run in loop. Fix is to stop CVDisplayLink 
when we return without completing final blit operation in 
MTLLayer.blitTexture().

Sanity and performance analysis is green. More details in JBS.

-

Commit messages:
 - 8267602: [macos] [lanai] java/awt/PrintJob/Text/stringwidth.sh doesn't exit 
on cancelling print dialog

Changes: https://git.openjdk.java.net/jdk17/pull/175/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk17=175=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8267602
  Stats: 7 lines in 1 file changed: 7 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk17/pull/175.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/175/head:pull/175

PR: https://git.openjdk.java.net/jdk17/pull/175