On Tue, 29 Jun 2021 17:34:00 GMT, Jayathirth D V <j...@openjdk.org> 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