mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-14 04:15:04 +00:00
8312198: [macos] metal pipeline - window rendering stops after display sleep
Reviewed-by: serb, avu, prr
This commit is contained in:
parent
aac287ebac
commit
a50d3bee12
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -56,6 +56,7 @@
|
||||
@property (readwrite, assign) int leftInset;
|
||||
@property (readwrite, assign) CVDisplayLinkRef displayLink;
|
||||
@property (readwrite, atomic) int displayLinkCount;
|
||||
@property (readwrite, atomic) int displayLinkFailCount;
|
||||
|
||||
- (id) initWithJavaLayer:(jobject)layer;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,6 +30,8 @@
|
||||
#import "MTLSurfaceData.h"
|
||||
#import "JNIUtilities.h"
|
||||
#define KEEP_ALIVE_INC 4
|
||||
#define CV_DISPLAYLINK_FAIL_DELAY 1.0
|
||||
#define MAX_DISPLAYLINK_FAIL_COUNT 5
|
||||
|
||||
@implementation MTLLayer
|
||||
|
||||
@ -44,11 +46,27 @@
|
||||
@synthesize nextDrawableCount;
|
||||
@synthesize displayLink;
|
||||
@synthesize displayLinkCount;
|
||||
@synthesize displayLinkFailCount;
|
||||
|
||||
- (void) createDisplayLink {
|
||||
CVDisplayLinkCreateWithActiveCGDisplays(&displayLink);
|
||||
CVDisplayLinkSetOutputCallback(displayLink, &displayLinkCallback, (__bridge void*)self);
|
||||
self.displayLinkCount = 0;
|
||||
CVReturn r = CVDisplayLinkCreateWithActiveCGDisplays(&displayLink);
|
||||
if (r != kCVReturnSuccess) {
|
||||
if (self.displayLinkFailCount >= MAX_DISPLAYLINK_FAIL_COUNT) {
|
||||
J2dTraceLn(J2D_TRACE_ERROR,
|
||||
"MTLLayer.createDisplayLink --- unable to create CVDisplayLink.");
|
||||
self.displayLinkFailCount = 0;
|
||||
return;
|
||||
}
|
||||
self.displayLinkFailCount++;
|
||||
[self performSelector:@selector(createDisplayLink)
|
||||
withObject:nil
|
||||
afterDelay:CV_DISPLAYLINK_FAIL_DELAY];
|
||||
return;
|
||||
} else {
|
||||
CVDisplayLinkSetOutputCallback(displayLink, &displayLinkCallback, (__bridge void*)self);
|
||||
self.displayLinkCount = 0;
|
||||
self.displayLinkFailCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithJavaLayer:(jobject)layer
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user