38 * may be disabled at runtime by internal settings unless the user
39 * has forced it on with d3d=true. These associated variables have
40 * the same base (eg, d3d) but end in "Set" (eg, d3dEnabled and
41 * d3dSet).
42 * ddEnabled: usage: "-Dsun.java2d.noddraw[=false|true]"
43 * turns on/off all usage of Direct3D
44 * ddOffscreenEnabled: equivalent of sun.java2d.noddraw
45 * gdiBlitEnabled: usage: "-Dsun.java2d.gdiblit=false"
46 * turns off Blit loops that use GDI for copying to
47 * the screen from certain image types. Copies will,
48 * instead, happen via ddraw locking or temporary GDI DIB
49 * creation/copying (depending on OS and other flags)
50 * d3dEnabled: usage: "-Dsun.java2d.d3d=[true|false]"
51 * Forces our use of Direct3D on or off. Direct3D is on
52 * by default, but may be disabled in some situations, such
53 * as on a card with bad d3d line quality, or on a video card
54 * that we have had bad experience with (e.g., Trident).
55 * This flag can force us to use d3d
56 * anyway in these situations. Or, this flag can force us to
57 * not use d3d in a situation where we would use it otherwise.
58 * translAccelEnabled: usage: "-Dsun.java2d.translaccel=true"
59 * equivalent to sun.java2d.d3d=true
60 * offscreenSharingEnabled: usage: "-Dsun.java2d.offscreenSharing=true"
61 * Turns on the ability to share a hardware-accelerated
62 * offscreen surface through the JAWT interface. See
63 * src/windows/native/sun/windows/awt_DrawingSurface.* for
64 * more information. This capability is disabled by default
65 * pending more testing and time to work out the right
66 * solution; we do not want to expose more public JAWT api
67 * without being very sure that we will be willing to support
68 * that API in the future regardless of other native
69 * rendering pipeline changes.
70 * accelReset: usage: "-Dsun.java2d.accelReset"
71 * This flag tells us to reset any persistent information
72 * the display device acceleration characteristics so that
73 * we are forced to retest these characteristics. This flag
74 * is primarily used for debugging purposes (to allow testing
75 * of the persistent storage mechanisms) but may also be
76 * needed by some users if, for example, a driver upgrade
77 * may change the runtime characteristics and they want the
78 * tests to be re-run.
79 * checkRegistry: usage: "-Dsun.java2d.checkRegistry"
80 * This flag tells us to output the current registry settings
81 * (after our initialization) to the console.
82 * disableRegistry: usage: "-Dsun.java2d.disableRegistry"
83 * This flag tells us to disable all registry-related
84 * activities. It is mainly here for debugging purposes,
85 * to allow us to see whether any runtime bugs are caused
86 * by or related to registry problems.
87 * magPresent: usage: "-Djavax.accessibility.screen_magnifier_present"
88 * This flag is set either on the command line or in the
89 * properties file. It tells Swing whether the user is
90 * currently using a screen magnifying application. These
91 * applications tend to conflict with ddraw (which assumes
92 * it owns the entire display), so the presence of these
93 * applications implies that we should disable ddraw.
94 * So if magPresent is true, we set ddEnabled and associated
95 * variables to false and do not initialize the native
96 * hardware acceleration for these properties.
97 * opengl: usage: "-Dsun.java2d.opengl=[true|True]"
98 * Enables the use of the OpenGL-pipeline. If the
99 * OpenGL flag is specified and WGL initialization is
100 * successful, we implicitly disable the use of DirectDraw
101 * and Direct3D, as those pipelines may interfere with the
102 * OGL pipeline. (If "True" is specified, a message will
103 * appear on the console stating whether or not the OGL
104 * was successfully initialized.)
105 * setHighDPIAware: Property usage: "-Dsun.java2d.dpiaware=[true|false]"
106 * This property flag "sun.java2d.dpiaware" is used to
107 * override the default behavior, which is:
108 * On Windows Vista, if the java process is launched from a
109 * known launcher (java, javaw, javaws, etc) - which is
110 * determined by whether a -Dsun.java.launcher property is set
111 * to "SUN_STANDARD" - the "high-DPI aware" property will be
112 * set on the native level prior to initializing the display.
113 *
114 */
115
116 private static boolean gdiBlitEnabled;
117 private static boolean d3dEnabled;
118 private static boolean d3dVerbose;
119 private static boolean d3dSet;
120 private static boolean d3dOnScreenEnabled;
121 private static boolean oglEnabled;
122 private static boolean oglVerbose;
123 private static boolean offscreenSharingEnabled;
124 private static boolean accelReset;
125 private static boolean checkRegistry;
126 private static boolean disableRegistry;
127 private static boolean magPresent;
128 private static boolean setHighDPIAware;
129 // TODO: other flags, including nopixfmt
130
131 static {
132 // Ensure awt is loaded already. Also, this forces static init
133 // of WToolkit and Toolkit, which we depend upon.
134 WToolkit.loadLibraries();
135 // First, init all Java level flags
136 initJavaFlags();
137 // Now, init things on the native side. This may call up through
138 // JNI to get/set the Java level flags based on native capabilities
139 // and environment variables
140 initNativeFlags();
141 }
142
143 private static native boolean initNativeFlags();
144
145 // Noop: this method is just here as a convenient calling place when
146 // we are initialized by Win32GraphicsEnv. Calling this will force
217 if (oglEnabled) {
218 oglVerbose = isBooleanPropTrueVerbose("sun.java2d.opengl");
219 if (WGLGraphicsConfig.isWGLAvailable()) {
220 d3dEnabled = false;
221 } else {
222 if (oglVerbose) {
223 System.out.println(
224 "Could not enable OpenGL pipeline " +
225 "(WGL not available)");
226 }
227 oglEnabled = false;
228 }
229 }
230 gdiBlitEnabled = getBooleanProp("sun.java2d.gdiBlit", true);
231 d3dSet = getPropertySet("sun.java2d.d3d");
232 if (d3dSet) {
233 d3dVerbose = isBooleanPropTrueVerbose("sun.java2d.d3d");
234 }
235 offscreenSharingEnabled =
236 getBooleanProp("sun.java2d.offscreenSharing", false);
237 accelReset = getBooleanProp("sun.java2d.accelReset", false);
238 checkRegistry =
239 getBooleanProp("sun.java2d.checkRegistry", false);
240 disableRegistry =
241 getBooleanProp("sun.java2d.disableRegistry", false);
242 String dpiOverride = System.getProperty("sun.java2d.dpiaware");
243 if (dpiOverride != null) {
244 setHighDPIAware = dpiOverride.equalsIgnoreCase("true");
245 } else {
246 String sunLauncherProperty =
247 System.getProperty("sun.java.launcher", "unknown");
248 setHighDPIAware =
249 sunLauncherProperty.equalsIgnoreCase("SUN_STANDARD");
250 }
251 /*
252 // Output info based on some non-default flags:
253 if (offscreenSharingEnabled) {
254 System.out.println(
255 "Warning: offscreenSharing has been enabled. " +
256 "The use of this capability will change in future " +
257 "releases and applications that depend on it " +
258 "may not work correctly");
259 }
260 */
261 return null;
262 }
263 });
264 /*
265 System.out.println("WindowsFlags (Java):");
266 System.out.println(" ddEnabled: " + ddEnabled + "\n" +
267 " ddOffscreenEnabled: " + ddOffscreenEnabled + "\n" +
268 " ddVramForced: " + ddVramForced + "\n" +
269 " ddLockEnabled: " + ddLockEnabled + "\n" +
270 " ddLockSet: " + ddLockSet + "\n" +
271 " ddBlitEnabled: " + ddBlitEnabled + "\n" +
272 " ddScaleEnabled: " + ddScaleEnabled + "\n" +
273 " d3dEnabled: " + d3dEnabled + "\n" +
274 " d3dSet: " + d3dSet + "\n" +
275 " oglEnabled: " + oglEnabled + "\n" +
276 " oglVerbose: " + oglVerbose + "\n" +
277 " gdiBlitEnabled: " + gdiBlitEnabled + "\n" +
278 " translAccelEnabled: " + translAccelEnabled + "\n" +
279 " offscreenSharingEnabled: " + offscreenSharingEnabled + "\n" +
280 " accelReset: " + accelReset + "\n" +
281 " checkRegistry: " + checkRegistry + "\n" +
282 " disableRegistry: " + disableRegistry + "\n" +
283 " d3dTexBPP: " + d3dTexBpp);
284 */
285 }
286
287 public static boolean isD3DEnabled() {
288 return d3dEnabled;
289 }
290
291 public static boolean isD3DSet() {
292 return d3dSet;
293 }
294
295 public static boolean isD3DOnScreenEnabled() {
296 return d3dOnScreenEnabled;
297 }
298
299 public static boolean isD3DVerbose() {
300 return d3dVerbose;
301 }
302
303 public static boolean isGdiBlitEnabled() {
304 return gdiBlitEnabled;
305 }
306
307 public static boolean isTranslucentAccelerationEnabled() {
308 return d3dEnabled;
309 }
310
311 public static boolean isOffscreenSharingEnabled() {
312 return offscreenSharingEnabled;
313 }
314
315 public static boolean isMagPresent() {
316 return magPresent;
317 }
318
319 public static boolean isOGLEnabled() {
320 return oglEnabled;
321 }
322
323 public static boolean isOGLVerbose() {
324 return oglVerbose;
325 }
326 }
|
38 * may be disabled at runtime by internal settings unless the user
39 * has forced it on with d3d=true. These associated variables have
40 * the same base (eg, d3d) but end in "Set" (eg, d3dEnabled and
41 * d3dSet).
42 * ddEnabled: usage: "-Dsun.java2d.noddraw[=false|true]"
43 * turns on/off all usage of Direct3D
44 * ddOffscreenEnabled: equivalent of sun.java2d.noddraw
45 * gdiBlitEnabled: usage: "-Dsun.java2d.gdiblit=false"
46 * turns off Blit loops that use GDI for copying to
47 * the screen from certain image types. Copies will,
48 * instead, happen via ddraw locking or temporary GDI DIB
49 * creation/copying (depending on OS and other flags)
50 * d3dEnabled: usage: "-Dsun.java2d.d3d=[true|false]"
51 * Forces our use of Direct3D on or off. Direct3D is on
52 * by default, but may be disabled in some situations, such
53 * as on a card with bad d3d line quality, or on a video card
54 * that we have had bad experience with (e.g., Trident).
55 * This flag can force us to use d3d
56 * anyway in these situations. Or, this flag can force us to
57 * not use d3d in a situation where we would use it otherwise.
58 * offscreenSharingEnabled: usage: "-Dsun.java2d.offscreenSharing=true"
59 * Turns on the ability to share a hardware-accelerated
60 * offscreen surface through the JAWT interface. See
61 * src/windows/native/sun/windows/awt_DrawingSurface.* for
62 * more information. This capability is disabled by default
63 * pending more testing and time to work out the right
64 * solution; we do not want to expose more public JAWT api
65 * without being very sure that we will be willing to support
66 * that API in the future regardless of other native
67 * rendering pipeline changes.
68 * magPresent: usage: "-Djavax.accessibility.screen_magnifier_present"
69 * This flag is set either on the command line or in the
70 * properties file. It tells Swing whether the user is
71 * currently using a screen magnifying application. These
72 * applications tend to conflict with ddraw (which assumes
73 * it owns the entire display), so the presence of these
74 * applications implies that we should disable ddraw.
75 * So if magPresent is true, we set ddEnabled and associated
76 * variables to false and do not initialize the native
77 * hardware acceleration for these properties.
78 * opengl: usage: "-Dsun.java2d.opengl=[true|True]"
79 * Enables the use of the OpenGL-pipeline. If the
80 * OpenGL flag is specified and WGL initialization is
81 * successful, we implicitly disable the use of DirectDraw
82 * and Direct3D, as those pipelines may interfere with the
83 * OGL pipeline. (If "True" is specified, a message will
84 * appear on the console stating whether or not the OGL
85 * was successfully initialized.)
86 * setHighDPIAware: Property usage: "-Dsun.java2d.dpiaware=[true|false]"
87 * This property flag "sun.java2d.dpiaware" is used to
88 * override the default behavior, which is:
89 * On Windows Vista, if the java process is launched from a
90 * known launcher (java, javaw, javaws, etc) - which is
91 * determined by whether a -Dsun.java.launcher property is set
92 * to "SUN_STANDARD" - the "high-DPI aware" property will be
93 * set on the native level prior to initializing the display.
94 *
95 */
96
97 private static boolean gdiBlitEnabled;
98 private static boolean d3dEnabled;
99 private static boolean d3dVerbose;
100 private static boolean d3dSet;
101 private static boolean d3dOnScreenEnabled;
102 private static boolean oglEnabled;
103 private static boolean oglVerbose;
104 private static boolean offscreenSharingEnabled;
105 private static boolean magPresent;
106 private static boolean setHighDPIAware;
107 // TODO: other flags, including nopixfmt
108
109 static {
110 // Ensure awt is loaded already. Also, this forces static init
111 // of WToolkit and Toolkit, which we depend upon.
112 WToolkit.loadLibraries();
113 // First, init all Java level flags
114 initJavaFlags();
115 // Now, init things on the native side. This may call up through
116 // JNI to get/set the Java level flags based on native capabilities
117 // and environment variables
118 initNativeFlags();
119 }
120
121 private static native boolean initNativeFlags();
122
123 // Noop: this method is just here as a convenient calling place when
124 // we are initialized by Win32GraphicsEnv. Calling this will force
195 if (oglEnabled) {
196 oglVerbose = isBooleanPropTrueVerbose("sun.java2d.opengl");
197 if (WGLGraphicsConfig.isWGLAvailable()) {
198 d3dEnabled = false;
199 } else {
200 if (oglVerbose) {
201 System.out.println(
202 "Could not enable OpenGL pipeline " +
203 "(WGL not available)");
204 }
205 oglEnabled = false;
206 }
207 }
208 gdiBlitEnabled = getBooleanProp("sun.java2d.gdiBlit", true);
209 d3dSet = getPropertySet("sun.java2d.d3d");
210 if (d3dSet) {
211 d3dVerbose = isBooleanPropTrueVerbose("sun.java2d.d3d");
212 }
213 offscreenSharingEnabled =
214 getBooleanProp("sun.java2d.offscreenSharing", false);
215 String dpiOverride = System.getProperty("sun.java2d.dpiaware");
216 if (dpiOverride != null) {
217 setHighDPIAware = dpiOverride.equalsIgnoreCase("true");
218 } else {
219 String sunLauncherProperty =
220 System.getProperty("sun.java.launcher", "unknown");
221 setHighDPIAware =
222 sunLauncherProperty.equalsIgnoreCase("SUN_STANDARD");
223 }
224 /*
225 // Output info based on some non-default flags:
226 if (offscreenSharingEnabled) {
227 System.out.println(
228 "Warning: offscreenSharing has been enabled. " +
229 "The use of this capability will change in future " +
230 "releases and applications that depend on it " +
231 "may not work correctly");
232 }
233 */
234 return null;
235 }
236 });
237 /*
238 System.out.println("WindowsFlags (Java):");
239 System.out.println(" ddEnabled: " + ddEnabled + "\n" +
240 " ddOffscreenEnabled: " + ddOffscreenEnabled + "\n" +
241 " d3dEnabled: " + d3dEnabled + "\n" +
242 " d3dSet: " + d3dSet + "\n" +
243 " oglEnabled: " + oglEnabled + "\n" +
244 " oglVerbose: " + oglVerbose + "\n" +
245 " gdiBlitEnabled: " + gdiBlitEnabled + "\n" +
246 " offscreenSharingEnabled: " + offscreenSharingEnabled);
247 */
248 }
249
250 public static boolean isD3DEnabled() {
251 return d3dEnabled;
252 }
253
254 public static boolean isD3DSet() {
255 return d3dSet;
256 }
257
258 public static boolean isD3DOnScreenEnabled() {
259 return d3dOnScreenEnabled;
260 }
261
262 public static boolean isD3DVerbose() {
263 return d3dVerbose;
264 }
265
266 public static boolean isGdiBlitEnabled() {
267 return gdiBlitEnabled;
268 }
269
270 public static boolean isOffscreenSharingEnabled() {
271 return offscreenSharingEnabled;
272 }
273
274 public static boolean isMagPresent() {
275 return magPresent;
276 }
277
278 public static boolean isOGLEnabled() {
279 return oglEnabled;
280 }
281
282 public static boolean isOGLVerbose() {
283 return oglVerbose;
284 }
285 }
|