8229896: Delete an unused code in the BufferedContext
authorserb
Fri, 13 Sep 2019 17:35:12 -0700
changeset 58324 0aba35254e00
parent 58323 7b3101216e61
child 58325 d32a3b1ca84a
8229896: Delete an unused code in the BufferedContext Reviewed-by: prr, jdv
src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java
src/java.desktop/share/classes/sun/java2d/opengl/OGLContext.java
src/java.desktop/share/classes/sun/java2d/pipe/BufferedContext.java
src/java.desktop/share/classes/sun/java2d/pipe/BufferedOpCodes.java
src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.c
src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java
src/java.desktop/windows/classes/sun/java2d/d3d/D3DContext.java
src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java
src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp
src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.h
src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderQueue.cpp
test/jdk/sun/java2d/pipe/hw/RSLAPITest/RSLAPITest.java
test/jdk/sun/java2d/pipe/hw/RSLContextInvalidationTest/RSLContextInvalidationTest.java
--- a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java	Thu Sep 12 22:20:35 2019 -0700
+++ b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java	Fri Sep 13 17:35:12 2019 -0700
@@ -75,7 +75,7 @@
     private BufferCapabilities bufferCaps;
     private long pConfigInfo;
     private ContextCapabilities oglCaps;
-    private OGLContext context;
+    private final OGLContext context;
     private final Object disposerReferent = new Object();
     private final int maxTextureSize;
 
@@ -105,7 +105,7 @@
         this.pConfigInfo = configInfo;
         this.oglCaps = oglCaps;
         this.maxTextureSize = maxTextureSize;
-        context = new OGLContext(OGLRenderQueue.getInstance(), this);
+        context = new OGLContext(OGLRenderQueue.getInstance());
 
         // add a record to the Disposer so that we destroy the native
         // CGLGraphicsConfigInfo data when this object goes away
--- a/src/java.desktop/share/classes/sun/java2d/opengl/OGLContext.java	Thu Sep 12 22:20:35 2019 -0700
+++ b/src/java.desktop/share/classes/sun/java2d/opengl/OGLContext.java	Fri Sep 13 17:35:12 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, 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
@@ -25,26 +25,24 @@
 
 package sun.java2d.opengl;
 
+import java.lang.annotation.Native;
+
 import sun.java2d.pipe.BufferedContext;
 import sun.java2d.pipe.RenderBuffer;
 import sun.java2d.pipe.RenderQueue;
 import sun.java2d.pipe.hw.ContextCapabilities;
-import static sun.java2d.pipe.BufferedOpCodes.*;
-import static sun.java2d.pipe.hw.ContextCapabilities.*;
 
-import java.lang.annotation.Native;
+import static sun.java2d.pipe.BufferedOpCodes.INVALIDATE_CONTEXT;
+import static sun.java2d.pipe.BufferedOpCodes.SET_SCRATCH_SURFACE;
 
 /**
  * Note that the RenderQueue lock must be acquired before calling any of
  * the methods in this class.
  */
-public class OGLContext extends BufferedContext {
-
-    private final OGLGraphicsConfig config;
+final class OGLContext extends BufferedContext {
 
-    OGLContext(RenderQueue rq, OGLGraphicsConfig config) {
+    OGLContext(RenderQueue rq) {
         super(rq);
-        this.config = config;
     }
 
     /**
@@ -111,10 +109,6 @@
         rq.flushNow();
     }
 
-    public RenderQueue getRenderQueue() {
-        return OGLRenderQueue.getInstance();
-    }
-
     /**
      * Returns a string representing adapter id (vendor, renderer, version).
      * Must be called on the rendering thread.
@@ -123,38 +117,6 @@
      */
     static final native String getOGLIdString();
 
-    @Override
-    public void saveState() {
-        // assert rq.lock.isHeldByCurrentThread();
-
-        // reset all attributes of this and current contexts
-        invalidateContext();
-        invalidateCurrentContext();
-
-        setScratchSurface(config);
-
-        // save the state on the native level
-        rq.ensureCapacity(4);
-        buf.putInt(SAVE_STATE);
-        rq.flushNow();
-    }
-
-    @Override
-    public void restoreState() {
-        // assert rq.lock.isHeldByCurrentThread();
-
-        // reset all attributes of this and current contexts
-        invalidateContext();
-        invalidateCurrentContext();
-
-        setScratchSurface(config);
-
-        // restore the state on the native level
-        rq.ensureCapacity(4);
-        buf.putInt(RESTORE_STATE);
-        rq.flushNow();
-    }
-
     static class OGLContextCaps extends ContextCapabilities {
         /**
          * Indicates the presence of the GL_EXT_framebuffer_object extension.
--- a/src/java.desktop/share/classes/sun/java2d/pipe/BufferedContext.java	Thu Sep 12 22:20:35 2019 -0700
+++ b/src/java.desktop/share/classes/sun/java2d/pipe/BufferedContext.java	Fri Sep 13 17:35:12 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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,16 +30,27 @@
 import java.awt.Composite;
 import java.awt.Paint;
 import java.awt.geom.AffineTransform;
-import sun.java2d.pipe.hw.AccelSurface;
+import java.lang.annotation.Native;
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
+
 import sun.java2d.InvalidPipeException;
 import sun.java2d.SunGraphics2D;
 import sun.java2d.loops.XORComposite;
-import static sun.java2d.pipe.BufferedOpCodes.*;
-import static sun.java2d.pipe.BufferedRenderPipe.BYTES_PER_SPAN;
+import sun.java2d.pipe.hw.AccelSurface;
 
-import java.lang.annotation.Native;
-import java.lang.ref.Reference;
-import java.lang.ref.WeakReference;
+import static sun.java2d.pipe.BufferedOpCodes.BEGIN_SHAPE_CLIP;
+import static sun.java2d.pipe.BufferedOpCodes.END_SHAPE_CLIP;
+import static sun.java2d.pipe.BufferedOpCodes.RESET_CLIP;
+import static sun.java2d.pipe.BufferedOpCodes.RESET_COMPOSITE;
+import static sun.java2d.pipe.BufferedOpCodes.RESET_TRANSFORM;
+import static sun.java2d.pipe.BufferedOpCodes.SET_ALPHA_COMPOSITE;
+import static sun.java2d.pipe.BufferedOpCodes.SET_RECT_CLIP;
+import static sun.java2d.pipe.BufferedOpCodes.SET_SHAPE_CLIP_SPANS;
+import static sun.java2d.pipe.BufferedOpCodes.SET_SURFACES;
+import static sun.java2d.pipe.BufferedOpCodes.SET_TRANSFORM;
+import static sun.java2d.pipe.BufferedOpCodes.SET_XOR_COMPOSITE;
+import static sun.java2d.pipe.BufferedRenderPipe.BYTES_PER_SPAN;
 
 /**
  * Base context class for managing state in a single-threaded rendering
@@ -77,8 +88,8 @@
      */
     @Native public static final int USE_MASK         = (1 << 1);
 
-    protected RenderQueue rq;
-    protected RenderBuffer buf;
+    private final RenderQueue rq;
+    private final RenderBuffer buf;
 
     /**
      * This is a reference to the most recently validated BufferedContext.  If
@@ -172,7 +183,7 @@
      * @throws InvalidPipeException if either src or dest surface is not valid
      * or lost
      */
-    public void validate(AccelSurface srcData, AccelSurface dstData,
+    private void validate(AccelSurface srcData, AccelSurface dstData,
                          Region clip, Composite comp,
                          AffineTransform xform,
                          Paint paint, SunGraphics2D sg2d, int flags)
@@ -310,21 +321,6 @@
         dstData.markDirty();
     }
 
-    /**
-     * Invalidates the surfaces associated with this context.  This is
-     * useful when the context is no longer needed, and we want to break
-     * the chain caused by these surface references.
-     *
-     * Note: must be called while the RenderQueue lock is held.
-     *
-     * @see RenderQueue#lock
-     * @see RenderQueue#unlock
-     */
-    private void invalidateSurfaces() {
-        validSrcDataRef.clear();
-        validDstDataRef.clear();
-    }
-
     private void setSurfaces(AccelSurface srcData,
                              AccelSurface dstData)
     {
@@ -433,12 +429,13 @@
      * @see RenderQueue#lock
      * @see RenderQueue#unlock
      */
-    public void invalidateContext() {
+    public final void invalidateContext() {
         resetTransform();
         resetComposite();
         resetClip();
         BufferedPaints.resetPaint(rq);
-        invalidateSurfaces();
+        validSrcDataRef.clear();
+        validDstDataRef.clear();
         validCompRef.clear();
         validClipRef.clear();
         validPaintRef.clear();
@@ -453,27 +450,7 @@
      * @return a render queue
      * @see RenderQueue
      */
-    public abstract RenderQueue getRenderQueue();
-
-    /**
-     * Saves the state of this context.
-     * It may reset the current context.
-     *
-     * Note: must be called while the RenderQueue lock is held.
-     *
-     * @see RenderQueue#lock
-     * @see RenderQueue#unlock
-     */
-    public abstract void saveState();
-
-    /**
-     * Restores the native state of this context.
-     * It may reset the current context.
-     *
-     * Note: must be called while the RenderQueue lock is held.
-     *
-     * @see RenderQueue#lock
-     * @see RenderQueue#unlock
-     */
-    public abstract void restoreState();
+    public final RenderQueue getRenderQueue() {
+        return rq;
+    }
 }
--- a/src/java.desktop/share/classes/sun/java2d/pipe/BufferedOpCodes.java	Thu Sep 12 22:20:35 2019 -0700
+++ b/src/java.desktop/share/classes/sun/java2d/pipe/BufferedOpCodes.java	Fri Sep 13 17:35:12 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -27,7 +27,7 @@
 
 import java.lang.annotation.Native;
 
-public class BufferedOpCodes {
+public final class BufferedOpCodes {
     // draw ops
     @Native public static final int DRAW_LINE            = 10;
     @Native public static final int DRAW_RECT            = 11;
@@ -74,8 +74,6 @@
     @Native public static final int INVALIDATE_CONTEXT   = 75;
     @Native public static final int SYNC                 = 76;
     @Native public static final int RESTORE_DEVICES      = 77;
-    @Native public static final int SAVE_STATE           = 78;
-    @Native public static final int RESTORE_STATE        = 79;
 
     // multibuffering ops
     @Native public static final int SWAP_BUFFERS         = 80;
--- a/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.c	Thu Sep 12 22:20:35 2019 -0700
+++ b/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.c	Fri Sep 13 17:35:12 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -502,31 +502,6 @@
                 dstOps = NULL;
             }
             break;
-        case sun_java2d_pipe_BufferedOpCodes_SAVE_STATE:
-            {
-                j2d_glPushAttrib(GL_ALL_ATTRIB_BITS);
-                j2d_glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS);
-                j2d_glMatrixMode(GL_MODELVIEW);
-                j2d_glPushMatrix();
-                j2d_glMatrixMode(GL_PROJECTION);
-                j2d_glPushMatrix();
-                j2d_glMatrixMode(GL_TEXTURE);
-                j2d_glPushMatrix();
-            }
-            break;
-
-        case sun_java2d_pipe_BufferedOpCodes_RESTORE_STATE:
-            {
-                j2d_glPopAttrib();
-                j2d_glPopClientAttrib();
-                j2d_glMatrixMode(GL_MODELVIEW);
-                j2d_glPopMatrix();
-                j2d_glMatrixMode(GL_PROJECTION);
-                j2d_glPopMatrix();
-                j2d_glMatrixMode(GL_TEXTURE);
-                j2d_glPopMatrix();
-            }
-            break;
         case sun_java2d_pipe_BufferedOpCodes_SYNC:
             {
                 sync = JNI_TRUE;
--- a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java	Thu Sep 12 22:20:35 2019 -0700
+++ b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java	Fri Sep 13 17:35:12 2019 -0700
@@ -71,7 +71,7 @@
     private BufferCapabilities bufferCaps;
     private long pConfigInfo;
     private ContextCapabilities oglCaps;
-    private OGLContext context;
+    private final OGLContext context;
 
     private static native long getGLXConfigInfo(int screennum, int visualnum);
     private static native int getOGLCapabilities(long configInfo);
@@ -85,7 +85,7 @@
         pConfigInfo = configInfo;
         initConfig(getAData(), configInfo);
         this.oglCaps = oglCaps;
-        context = new OGLContext(OGLRenderQueue.getInstance(), this);
+        context = new OGLContext(OGLRenderQueue.getInstance());
     }
 
     @Override
--- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DContext.java	Thu Sep 12 22:20:35 2019 -0700
+++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DContext.java	Fri Sep 13 17:35:12 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2019, 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
@@ -26,19 +26,20 @@
 package sun.java2d.d3d;
 
 import java.lang.annotation.Native;
+
 import sun.java2d.pipe.BufferedContext;
 import sun.java2d.pipe.RenderBuffer;
 import sun.java2d.pipe.RenderQueue;
 import sun.java2d.pipe.hw.ContextCapabilities;
-import static sun.java2d.pipe.BufferedOpCodes.*;
-import static sun.java2d.pipe.hw.ContextCapabilities.*;
-import static sun.java2d.d3d.D3DContext.D3DContextCaps.*;
+
+import static sun.java2d.pipe.BufferedOpCodes.INVALIDATE_CONTEXT;
+import static sun.java2d.pipe.BufferedOpCodes.SET_SCRATCH_SURFACE;
 
 /**
  * Note that the RenderQueue lock must be acquired before calling any of
  * the methods in this class.
  */
-class D3DContext extends BufferedContext {
+final class D3DContext extends BufferedContext {
 
     private final D3DGraphicsDevice device;
 
@@ -101,42 +102,6 @@
         buf.putInt(d3dc.getDevice().getScreen());
     }
 
-    public RenderQueue getRenderQueue() {
-        return D3DRenderQueue.getInstance();
-    }
-
-    @Override
-    public void saveState() {
-        // assert rq.lock.isHeldByCurrentThread();
-
-        // reset all attributes of this and current contexts
-        invalidateContext();
-        invalidateCurrentContext();
-
-        setScratchSurface(this);
-
-        // save the state on the native level
-        rq.ensureCapacity(4);
-        buf.putInt(SAVE_STATE);
-        rq.flushNow();
-    }
-
-    @Override
-    public void restoreState() {
-        // assert rq.lock.isHeldByCurrentThread();
-
-        // reset all attributes of this and current contexts
-        invalidateContext();
-        invalidateCurrentContext();
-
-        setScratchSurface(this);
-
-        // restore the state on the native level
-        rq.ensureCapacity(4);
-        buf.putInt(RESTORE_STATE);
-        rq.flushNow();
-    }
-
     D3DGraphicsDevice getDevice() {
         return device;
     }
--- a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Thu Sep 12 22:20:35 2019 -0700
+++ b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Fri Sep 13 17:35:12 2019 -0700
@@ -71,7 +71,7 @@
     private BufferCapabilities bufferCaps;
     private long pConfigInfo;
     private ContextCapabilities oglCaps;
-    private OGLContext context;
+    private final OGLContext context;
     private Object disposerReferent = new Object();
 
     public static native int getDefaultPixFmt(int screennum);
@@ -90,7 +90,7 @@
         super(device, visualnum);
         this.pConfigInfo = configInfo;
         this.oglCaps = oglCaps;
-        context = new OGLContext(OGLRenderQueue.getInstance(), this);
+        context = new OGLContext(OGLRenderQueue.getInstance());
 
         // add a record to the Disposer so that we destroy the native
         // WGLGraphicsConfigInfo data when this object goes away
--- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp	Thu Sep 12 22:20:35 2019 -0700
+++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp	Fri Sep 13 17:35:12 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2019, 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
@@ -685,64 +685,6 @@
     return res;
 }
 
-HRESULT
-D3DContext::SaveState()
-{
-    HRESULT res;
-
-    RETURN_STATUS_IF_NULL(pd3dDevice, S_OK);
-
-    J2dTraceLn(J2D_TRACE_INFO, "D3DContext::SaveState");
-
-    FlushVertexQueue();
-    UpdateState(STATE_CHANGE);
-
-    if (pStateBlock != NULL) {
-        J2dTraceLn(J2D_TRACE_WARNING,
-                   "D3DContext::SaveState: existing state block!");
-        SAFE_RELEASE(pStateBlock);
-    }
-
-    if (SUCCEEDED(res =
-            pd3dDevice->CreateStateBlock(D3DSBT_ALL, &pStateBlock)))
-    {
-        J2dTraceLn(J2D_TRACE_VERBOSE, "  created state block");
-    } else {
-        J2dTraceLn(J2D_TRACE_WARNING,
-                   "D3DContext::SaveState: failed to create state block");
-    }
-    ZeroMemory(lastTexture, sizeof(lastTexture));
-
-    return res;
-}
-
-HRESULT
-D3DContext::RestoreState()
-{
-    HRESULT res = S_OK;
-
-    J2dTraceLn(J2D_TRACE_INFO, "D3DContext::RestoreState");
-
-    FlushVertexQueue();
-    UpdateState(STATE_CHANGE);
-
-    if (pStateBlock != NULL) {
-        if (SUCCEEDED(res = pStateBlock->Apply())) {
-            J2dTraceLn(J2D_TRACE_VERBOSE, "  restored device state");
-        } else {
-            J2dTraceLn(J2D_TRACE_WARNING,
-                       "D3DContext::RestoreState: failed to restore state");
-        }
-        SAFE_RELEASE(pStateBlock);
-    } else {
-        J2dTraceLn(J2D_TRACE_WARNING,
-                   "D3DContext::RestoreState: empty state block!");
-    }
-    ZeroMemory(lastTexture, sizeof(lastTexture));
-
-    return res;
-}
-
 #define POINT_FILTER_CAP (D3DPTFILTERCAPS_MAGFPOINT|D3DPTFILTERCAPS_MINFPOINT)
 #define LINEAR_FILTER_CAP (D3DPTFILTERCAPS_MAGFLINEAR|D3DPTFILTERCAPS_MINFLINEAR)
 
--- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.h	Thu Sep 12 22:20:35 2019 -0700
+++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.h	Fri Sep 13 17:35:12 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2019, 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
@@ -133,13 +133,6 @@
     HRESULT ResetContext();
     HRESULT CheckAndResetDevice();
 
-    // saves the state of the D3D device in a state block, resets
-    // context's state to STATE_CHANGE
-    HRESULT SaveState();
-    // restores the state of the D3D device from existing state block,
-    // resets context's state to STATE_CHANGE
-    HRESULT RestoreState();
-
     void    ReleaseContextResources();
     void    ReleaseDefPoolResources();
     virtual ~D3DContext();
--- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderQueue.cpp	Thu Sep 12 22:20:35 2019 -0700
+++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderQueue.cpp	Fri Sep 13 17:35:12 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2019, 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
@@ -677,23 +677,6 @@
                 }
             }
             break;
-
-        case sun_java2d_pipe_BufferedOpCodes_SAVE_STATE:
-            {
-                CONTINUE_IF_NULL(d3dc);
-
-                res = d3dc->SaveState();
-            }
-            break;
-
-        case sun_java2d_pipe_BufferedOpCodes_RESTORE_STATE:
-            {
-                CONTINUE_IF_NULL(d3dc);
-
-                res = d3dc->RestoreState();
-            }
-            break;
-
         // multibuffering ops
         case sun_java2d_pipe_BufferedOpCodes_SWAP_BUFFERS:
             {
--- a/test/jdk/sun/java2d/pipe/hw/RSLAPITest/RSLAPITest.java	Thu Sep 12 22:20:35 2019 -0700
+++ b/test/jdk/sun/java2d/pipe/hw/RSLAPITest/RSLAPITest.java	Fri Sep 13 17:35:12 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2019, 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
@@ -44,7 +44,6 @@
 import java.util.HashSet;
 import sun.java2d.DestSurfaceProvider;
 import sun.java2d.Surface;
-import sun.java2d.pipe.BufferedContext;
 import sun.java2d.pipe.RenderQueue;
 import sun.java2d.pipe.hw.AccelGraphicsConfig;
 import sun.java2d.pipe.hw.AccelSurface;
@@ -161,8 +160,6 @@
         AccelGraphicsConfig agc = (AccelGraphicsConfig) gc;
         printAGC(agc);
 
-        testContext(agc);
-
         VolatileImage vi = gc.createCompatibleVolatileImage(10, 10);
         vi.validate(gc);
         if (vi instanceof DestSurfaceProvider) {
@@ -250,22 +247,6 @@
         }
     }
 
-    private static void testContext(final AccelGraphicsConfig agc) {
-        BufferedContext c = agc.getContext();
-
-        RenderQueue rq = c.getRenderQueue();
-        rq.lock();
-        try {
-            c.saveState();
-            rq.flushNow();
-            c.restoreState();
-            rq.flushNow();
-            System.out.println("Passed: Save/Restore");
-        } finally {
-            rq.unlock();
-        }
-    }
-
     private static void testForNPEDuringCreation(AccelGraphicsConfig agc) {
         int iterations = 100;
         HashSet<VolatileImage> vis = new HashSet<VolatileImage>();
--- a/test/jdk/sun/java2d/pipe/hw/RSLContextInvalidationTest/RSLContextInvalidationTest.java	Thu Sep 12 22:20:35 2019 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2007, 2018, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @key headful
- * @bug 6764257 8198613
- * @summary Tests that the color is reset properly after save/restore context
- * @author Dmitri.Trembovetski@sun.com: area=Graphics
- * @modules java.desktop/sun.java2d
- *          java.desktop/sun.java2d.pipe
- *          java.desktop/sun.java2d.pipe.hw
- * @compile -XDignore.symbol.file=true RSLContextInvalidationTest.java
- * @run main/othervm RSLContextInvalidationTest
- * @run main/othervm -Dsun.java2d.noddraw=true RSLContextInvalidationTest
- */
-
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import java.awt.image.BufferedImage;
-import java.awt.image.VolatileImage;
-import sun.java2d.DestSurfaceProvider;
-import sun.java2d.Surface;
-import sun.java2d.pipe.RenderQueue;
-import sun.java2d.pipe.hw.*;
-
-public class RSLContextInvalidationTest {
-
-    public static void main(String[] args) {
-        GraphicsEnvironment ge =
-            GraphicsEnvironment.getLocalGraphicsEnvironment();
-        GraphicsDevice gd = ge.getDefaultScreenDevice();
-        GraphicsConfiguration gc = gd.getDefaultConfiguration();
-        VolatileImage vi = gc.createCompatibleVolatileImage(100, 100);
-        vi.validate(gc);
-        VolatileImage vi1 = gc.createCompatibleVolatileImage(100, 100);
-        vi1.validate(gc);
-
-        if (!(vi instanceof DestSurfaceProvider)) {
-            System.out.println("Test considered PASSED: no HW acceleration");
-            return;
-        }
-
-        DestSurfaceProvider p = (DestSurfaceProvider)vi;
-        Surface s = p.getDestSurface();
-        if (!(s instanceof AccelSurface)) {
-            System.out.println("Test considered PASSED: no HW acceleration");
-            return;
-        }
-        AccelSurface dst = (AccelSurface)s;
-
-        Graphics g = vi.createGraphics();
-        g.drawImage(vi1, 95, 95, null);
-        g.setColor(Color.red);
-        g.fillRect(0, 0, 100, 100);
-        g.setColor(Color.black);
-        g.fillRect(0, 0, 100, 100);
-        // after this the validated context color is black
-
-        RenderQueue rq = dst.getContext().getRenderQueue();
-        rq.lock();
-        try {
-            dst.getContext().saveState();
-            dst.getContext().restoreState();
-        } finally {
-            rq.unlock();
-        }
-
-        // this will cause ResetPaint (it will set color to extended EA=ff,
-        // which is ffffffff==Color.white)
-        g.drawImage(vi1, 95, 95, null);
-
-        // now try filling with black again, but it will come up as white
-        // because this fill rect won't validate the color properly
-        g.setColor(Color.black);
-        g.fillRect(0, 0, 100, 100);
-
-        BufferedImage bi = vi.getSnapshot();
-        if (bi.getRGB(50, 50) != Color.black.getRGB()) {
-            throw new RuntimeException("Test FAILED: found color="+
-                Integer.toHexString(bi.getRGB(50, 50))+" instead of "+
-                Integer.toHexString(Color.black.getRGB()));
-        }
-
-        System.out.println("Test PASSED.");
-    }
-}