JDK-4960743 : Should consider using backing store on XAWT
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2003-11-27
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
Name: ssR10077			Date: 11/27/2003

###@###.###
X protocol allows to enable double buffering on the server side by
setting backing_store field of XSetWindowAttributes.

The experiment showed it changes visual perception of java painting
performance, as in cases of Z order change and moving the windows on
the display, the picture is repainted shamelessly without the usual
gray areas.

It's especially true for Metacity on Linux as the Windows are moved
with content(like on W2K) by default.

======================================================================

Comments
EVALUATION This is a useful enchantment. In spite of that currently we can use 'sun.awt.backingStore' flag. It is not primari functionality. Before the feature is implemented we have to verify that 2D DGA works fine with backing store. Taking this into account I am assigning P4 priority to the request.
12-07-2011

EVALUATION During testing of the JDK 6 PIT build 45 SQE reported there were several regressions (related to ScrollPane with OGL pipeline, Choise, PopupMenu) caused by this fix (refer to the comments section for more info). The fix was disabled in the build 45. As from the JDK 6 build 47 backing store attribute is set for a window if the system property (unsupporetd officially) "sun.awt.backingStore" is "Always", backing store is available on each screen, and Java2D doesn't use DGA on whatever screen.
26-07-2005

EVALUATION Name: ssR10077 Date: 11/27/2003 The change is very simple but requires a rigorous testing as it can conflict with 2d code related DGA. For the remote display it seems safe. Jim Graham's comment: The DGA (Direct Graphics Access) protocol provides ways to determine if a window has backing store. I'm not sure that we are checking those conditions when we lock the screen, but it is possible for 2D to be compatible with backing store (and it may already be compatible, but someone will need to check and test)... ====================================================================== Name: ssR10077 Date: 04/29/2004 The following configurations were tested with Java2D demo as a visual criterion: 1. Red Hat Linux Advanced Server release2.1AS, XFree86. "backing_store" option was enabled in screen section of XF86Config-4 file 2. Solaris 8, Xsun. Backing store is on by default for Xsun Both tests were carried out locally as DGA is enabled only in that case. No visual regression with and without backing store enabled was detected. ###@###.### 2004-04-29 ====================================================================== This fix is a good complement to the gray box fix on X platforms (refer to 4967886, 6261582). Usage of backing store is another way of improving our painting procedure. Backing store is a feature of most of X servers: provided that a window has the backing store attribute set, such an X server automatically maintains the contents of the window while it is obscured. When (a part of) a window is exposed, its contents is automatically copied to the screen, and expose events are not generated as the contents is restored. Though the attribute is only a hint to an X server. Backing store does conflict with DGA, so backing store attribute is not set for a window if Java2D uses DGA on at least one screen. (DGA is used only on some Solaris/SPARC machines.) To allow setting of the backing store attribute for a window (if DGA is used), one may set the env var NO_J2D_DGA; refer to http://java.sun.com/j2se/1.5.0/docs/guide/2d/flags.html. To leverage backing store feature, in addition to setting of the backing store attribute for a window, the X server must have backing store support enabled. One should consult his/her X server documentation in order to enable X server's support for backing store. Let's consider typical setting of 3 most popular X servers. 1. Xsun has backing store support enabled by default. 2. XFree86: put Option "backingstore" in each Screen section of /etc/X11/XF86Config-4 or /etc/X11/XF86Config if the former isn't present. (See also http://www.xfree86.org/current/ati5.html) 3. Xorg: put Option "backingstore" in each Screen section of /etc/X11/xorg.conf. (See also http://www.x.org/X11R6.8.2/doc/ati5.html) To find out if backing store is enabled on the X server, run $ xdpyinfo | grep -i backing If if backing store is enabled on the X server, one will see something like the following options: backing-store YES, save-unders YES otherwise options: backing-store NO, save-unders NO In general, backing store attribute is set for a window if backing store is available on each screen and Java2D doesn't use DGA on whatever screen. (Refer to the comments section for more detailed info.) ###@###.### 2005-07-08 15:21:13 GMT To find out a window's backing store attribute, run xwininfo and click on the window. ###@###.### 2005-07-08 16:01:22 GMT
08-07-2005

SUGGESTED FIX Name: ssR10077 Date: 04/27/2004 ------- XComponentPeer.java ------- *** /tmp/sccs.C2aabR=09=A2? =F1?? 27 17:00:40 2004 --- XComponentPeer.java=09=A2? =F1?? 27 17:00:34 2004 *************** *** 106,111 **** --- 106,113 ---- =20 void preInit(XCreateWindowParams params) { super.preInit(params); + params.putIfNull(BACKING_STORE,WhenMapped); + =20 boundsOperation =3D DEFAULT_OPERATION; } void postInit(XCreateWindowParams params) { ====================================================================== Name: ssR10077 Date: 04/29/2004 ------- XWindow.java ------- *** /tmp/sccs.Zcaamj=09?? =F1?? 29 14:29:22 2004 --- XWindow.java=09?? =F1?? 29 14:29:19 2004 *************** *** 161,166 **** --- 161,167 ---- if (target !=3D null) { this.parent =3D getParentXWindowObject(target.getParent()); } + params.putIfNull(BACKING_STORE, WhenMapped); } =20 void postInit(XCreateWindowParams params) { ====================================================================== Code for backing store support was integrated along with the gray box fix 4967886, but backing store wasn't turned on by default. Now, after testing and negotiations with 2D and Swing, backing store is turned on by default. Also the internal system property is changed to facilitate flexible testing/debugging (if needed). *** /net/titan/export1/gas/mustang/webrev/src/solaris/classes/sun/awt/X11/XToolkit.java- Thu Jun 16 14:56:25 2005 --- XToolkit.java Thu Jun 16 13:34:15 2005 -------------------------------------------------------------------------------- *** 95,105 **** } setupModifierMap(); initIDs(); } m_removeSourceEvents = XToolkit.getMethod(EventQueue.class, "removeSourceEvents", new Class[] {Object.class, Boolean.TYPE}) ; ! setBackingStoreAllowed(); } // Error handler stuff static XErrorEvent saved_error; static long saved_error_handler; --- 95,105 ---- } setupModifierMap(); initIDs(); } m_removeSourceEvents = XToolkit.getMethod(EventQueue.class, "removeSourceEvents", new Class[] {Object.class, Boolean.TYPE}) ; ! setBackingStoreType(); } // Error handler stuff static XErrorEvent saved_error; static long saved_error_handler; -------------------------------------------------------------------------------- *** 1668,1708 **** qt.dispose(); } } /** ! * Returns true if backing store is available on each screen, ! * java2d doesn't use DGA(that conflicts with backing store) on whatever screen ! * and the system property xawt.backingStore is true. */ ! static boolean useBackingStore() { ! return isBackingStoreAllowed; } ! private static void setBackingStoreAllowed() { ! if (!(Boolean)AccessController.doPrivileged( ! new sun.security.action.GetBooleanAction("xawt.backingStore")) ! || sun.java2d.x11.X11SurfaceData.isDgaAvailable()) { ! isBackingStoreAllowed = false; return; } - isBackingStoreAllowed = true; synchronized(getAWTLock()) { int screenCount = XlibWrapper.ScreenCount(getDisplay()); for (int i = 0; i < screenCount; i++) { if (XlibWrapper.DoesBackingStore(XlibWrapper.ScreenOfDisplay(getDisplay(), i)) == XConstants.NotUseful) { ! isBackingStoreAllowed = false; ! break; } } } } ! private static boolean isBackingStoreAllowed; static boolean isMapped(long window) { synchronized(getAWTLock()) { XWindowAttributes wattr = new XWindowAttributes(); try { XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler); --- 1668,1731 ---- qt.dispose(); } } /** ! * Returns one of XConstants: NotUseful, WhenMapped or Always. ! * If backing store is not available on at least one screen, or ! * java2d uses DGA(which conflicts with backing store) on at least one screen, ! * or the string system property "sun.awt.backingStore" is "NotUseful", ! * then the method returns XConstants.NotUseful. ! * Otherwise, if system property "sun.awt.backingStore" is "WhenMapped", ! * then the method returns XConstants.WhenMapped. ! * Otherwise, the method returns XConstants.Always. */ ! static int getBackingStoreType() { ! return backingStoreType; } ! private static void setBackingStoreType() { ! if (sun.java2d.x11.X11SurfaceData.isDgaAvailable()) { ! backingStoreType = XConstants.NotUseful; return; } synchronized(getAWTLock()) { int screenCount = XlibWrapper.ScreenCount(getDisplay()); for (int i = 0; i < screenCount; i++) { if (XlibWrapper.DoesBackingStore(XlibWrapper.ScreenOfDisplay(getDisplay(), i)) == XConstants.NotUseful) { ! backingStoreType = XConstants.NotUseful; ! return; } } } + + String prop = (String)AccessController.doPrivileged( + new sun.security.action.GetPropertyAction("sun.awt.backingStore")); + + if (prop == null) { + backingStoreType = XConstants.Always; + return; } ! prop = prop.toLowerCase(); ! if (prop.equals("notuseful")) { ! backingStoreType = XConstants.NotUseful; ! } else if (prop.equals("whenmapped")) { ! backingStoreType = XConstants.WhenMapped; ! } else { ! backingStoreType = XConstants.Always; ! } ! } + /** + * One of XConstants: NotUseful, WhenMapped or Always. + */ + private static int backingStoreType; + + static boolean isMapped(long window) { synchronized(getAWTLock()) { XWindowAttributes wattr = new XWindowAttributes(); try { XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler); *** /net/titan/export1/gas/mustang/webrev/src/solaris/classes/sun/awt/X11/XWindow.java- Thu Jun 16 14:56:25 2005 --- XWindow.java Wed Jun 15 21:25:17 2005 -------------------------------------------------------------------------------- *** 175,188 **** paintArea = new XRepaintArea(); if (target != null) { this.parent = getParentXWindowObject(target.getParent()); } ! if (XToolkit.useBackingStore()) { ! params.putIfNull(BACKING_STORE, WhenMapped); } - } void postInit(XCreateWindowParams params) { super.postInit(params); setWMClass(getWMClass()); --- 175,186 ---- paintArea = new XRepaintArea(); if (target != null) { this.parent = getParentXWindowObject(target.getParent()); } ! params.putIfNull(BACKING_STORE, XToolkit.getBackingStoreType()); } void postInit(XCreateWindowParams params) { super.postInit(params); setWMClass(getWMClass()); ###@###.### 2005-06-17 15:15:00 GMT
17-06-2005

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
21-08-2004