8041900: [macosx] Java forces the use of discrete GPU
Reviewed-by: ssadetsky, alexsch
This commit is contained in:
parent
5c26723516
commit
9a97133265
@ -26,6 +26,7 @@
|
|||||||
#import "AWT_debug.h"
|
#import "AWT_debug.h"
|
||||||
|
|
||||||
#import "jni_util.h"
|
#import "jni_util.h"
|
||||||
|
#import "ThreadUtilities.h"
|
||||||
|
|
||||||
#import <JavaNativeFoundation/JavaNativeFoundation.h>
|
#import <JavaNativeFoundation/JavaNativeFoundation.h>
|
||||||
|
|
||||||
@ -114,17 +115,20 @@ static void displaycb_handle
|
|||||||
{
|
{
|
||||||
if (flags == kCGDisplayBeginConfigurationFlag) return;
|
if (flags == kCGDisplayBeginConfigurationFlag) return;
|
||||||
|
|
||||||
|
[ThreadUtilities performOnMainThreadWaiting:NO block:^() {
|
||||||
|
|
||||||
JNFPerformEnvBlock(JNFThreadDetachImmediately, ^(JNIEnv *env) {
|
JNFPerformEnvBlock(JNFThreadDetachImmediately, ^(JNIEnv *env) {
|
||||||
JNFWeakJObjectWrapper *wrapper = (JNFWeakJObjectWrapper *)userInfo;
|
JNFWeakJObjectWrapper *wrapper = (JNFWeakJObjectWrapper *)userInfo;
|
||||||
|
|
||||||
jobject graphicsEnv = [wrapper jObjectWithEnv:env];
|
jobject graphicsEnv = [wrapper jObjectWithEnv:env];
|
||||||
if (graphicsEnv == NULL) return; // ref already GC'd
|
if (graphicsEnv == NULL) return; // ref already GC'd
|
||||||
static JNF_CLASS_CACHE(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment");
|
static JNF_CLASS_CACHE(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment");
|
||||||
static JNF_MEMBER_CACHE(jm_displayReconfiguration, jc_CGraphicsEnvironment, "_displayReconfiguration", "(IZ)V");
|
static JNF_MEMBER_CACHE(jm_displayReconfiguration,
|
||||||
|
jc_CGraphicsEnvironment, "_displayReconfiguration","(IZ)V");
|
||||||
JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration,
|
JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration,
|
||||||
(jint) display,
|
(jint) display, (jboolean) flags & kCGDisplayRemoveFlag);
|
||||||
(jboolean) flags & kCGDisplayRemoveFlag);
|
|
||||||
});
|
});
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -233,6 +233,7 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSOpenGLPixelFormatAttribute attrs[] = {
|
NSOpenGLPixelFormatAttribute attrs[] = {
|
||||||
|
NSOpenGLPFAAllowOfflineRenderers,
|
||||||
NSOpenGLPFAClosestPolicy,
|
NSOpenGLPFAClosestPolicy,
|
||||||
NSOpenGLPFAWindow,
|
NSOpenGLPFAWindow,
|
||||||
NSOpenGLPFAPixelBuffer,
|
NSOpenGLPFAPixelBuffer,
|
||||||
|
Loading…
Reference in New Issue
Block a user