Enable volatileimage usage for back buffer metal-prototype-branch
authorjdv
Fri, 21 Jun 2019 12:42:10 +0530
branchmetal-prototype-branch
changeset 57417 28582d575a98
parent 57416 e153174dba06
child 57418 fd4ec73925c3
Enable volatileimage usage for back buffer
src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.m
src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m
src/java.desktop/share/classes/javax/swing/RepaintManager.java
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.m	Fri Jun 21 12:08:37 2019 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.m	Fri Jun 21 12:42:10 2019 +0530
@@ -29,7 +29,6 @@
 
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
 #import <QuartzCore/CATransaction.h>
-#import <QuartzCore/CAMetalLayer.h>
 
 @implementation AWTSurfaceLayers
 
@@ -70,10 +69,8 @@
 
 // Updates back buffer size of the layer if it's an OpenGL layer
 // including all OpenGL sublayers
-// TODO : Added check for CAMetalLayer also but this needs to be verified.
 + (void) repaintLayersRecursively:(CALayer*)aLayer {
-    if ([aLayer isKindOfClass:[CAOpenGLLayer class]] ||
-        [aLayer isKindOfClass:[CAMetalLayer class]]) {
+    if ([aLayer isKindOfClass:[CAOpenGLLayer class]]) {
         [aLayer setNeedsDisplay];
     }
     for(CALayer *child in aLayer.sublayers) {
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Fri Jun 21 12:08:37 2019 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Fri Jun 21 12:42:10 2019 +0530
@@ -70,13 +70,7 @@
 @synthesize cglLayer;
 @synthesize mouseIsOver;
 
-/*
- * TODO : Eventhough the name of variable is cgllayer,
- * we are setting common CALayer properties, so we might not
- * to add one more variable for CAMetalLayer. Also have
- * to verify REMOTE_LAYER use case, if it is need then we
- * need to add CAMetalLayer specific logic.
- */
+
 // Note: Must be called on main (AppKit) thread only
 - (id) initWithRect: (NSRect) rect
        platformView: (jobject) cPlatformView
--- a/src/java.desktop/share/classes/javax/swing/RepaintManager.java	Fri Jun 21 12:08:37 2019 +0530
+++ b/src/java.desktop/share/classes/javax/swing/RepaintManager.java	Fri Jun 21 12:42:10 2019 +0530
@@ -129,13 +129,7 @@
     private static final Object repaintManagerKey = RepaintManager.class;
 
     // Whether or not a VolatileImage should be used for double-buffered painting
-    // TODO : We have not yet implemented MetalBlitLoops logic.
-    // Because once we draw into offline buffer we need blitloops
-    // logic to blit the content into destination buffer.
-    // When we have blitloops logic for Metal we can enable usage
-    // of offscreen volatile image
-    //static boolean volatileImageBufferEnabled = true;
-    static boolean volatileImageBufferEnabled = false;
+    static boolean volatileImageBufferEnabled = true;
     /**
      * Type of VolatileImage which should be used for double-buffered
      * painting.
@@ -217,14 +211,13 @@
             }
         });
 
-        // TODO : Revert this change after we implement MetalBlitLoops
-        /*volatileImageBufferEnabled = "true".equals(AccessController.
+        volatileImageBufferEnabled = "true".equals(AccessController.
                 doPrivileged(new GetPropertyAction(
-                "swing.volatileImageBufferEnabled", "true")));*/
+                "swing.volatileImageBufferEnabled", "true")));
         boolean headless = GraphicsEnvironment.isHeadless();
-        /*if (volatileImageBufferEnabled && headless) {
+        if (volatileImageBufferEnabled && headless) {
             volatileImageBufferEnabled = false;
-        }*/
+        }
         nativeDoubleBuffering = "true".equals(AccessController.doPrivileged(
                     new GetPropertyAction("awt.nativeDoubleBuffering")));
         String bs = AccessController.doPrivileged(