--- old/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java 2015-06-14 21:44:02.000000000 +0300 +++ new/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java 2015-06-14 21:44:02.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -379,21 +379,14 @@ public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency, int type) { - if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED || - transparency == Transparency.BITMASK) - { + if ((type != FBOBJECT && type != TEXTURE) + || transparency == Transparency.BITMASK) { return null; } - if (type == FBOBJECT) { if (!isCapPresent(CAPS_EXT_FBOBJECT)) { return null; } - } else if (type == PBUFFER) { - boolean isOpaque = transparency == Transparency.OPAQUE; - if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) { - return null; - } } SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height, --- old/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java 2015-06-14 21:44:03.000000000 +0300 +++ new/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java 2015-06-14 21:44:02.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -51,9 +51,6 @@ private native void initOps(long pConfigInfo, long pPeerData, long layerPtr, int xoff, int yoff, boolean isOpaque); - protected native boolean initPbuffer(long pData, long pConfigInfo, - boolean isOpaque, int width, int height); - protected CGLSurfaceData(CGLGraphicsConfig gc, ColorModel cm, int type, int width, int height) { super(gc, cm, type); --- old/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java 2015-06-14 21:44:03.000000000 +0300 +++ new/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java 2015-06-14 21:44:03.000000000 +0300 @@ -29,7 +29,6 @@ import static java.awt.BufferCapabilities.FlipContents.*; import java.awt.Component; import java.awt.GraphicsConfiguration; -import java.awt.Transparency; import java.awt.image.ColorModel; import java.awt.peer.ComponentPeer; @@ -45,7 +44,7 @@ public class CGLVolatileSurfaceManager extends VolatileSurfaceManager { - private boolean accelerationEnabled; + private final boolean accelerationEnabled; public CGLVolatileSurfaceManager(SunVolatileImage vImg, Object context) { super(vImg, context); @@ -53,18 +52,10 @@ /* * We will attempt to accelerate this image only under the * following conditions: - * - the image is opaque OR - * - the image is translucent AND - * - the GraphicsConfig supports the FBO extension OR - * - the GraphicsConfig has a stored alpha channel + * - the GraphicsConfig supports the FBO extension */ - int transparency = vImg.getTransparency(); CGLGraphicsConfig gc = (CGLGraphicsConfig)vImg.getGraphicsConfig(); - accelerationEnabled = - (transparency == Transparency.OPAQUE) || - ((transparency == Transparency.TRANSLUCENT) && - (gc.isCapPresent(CAPS_EXT_FBOBJECT) || - gc.isCapPresent(CAPS_STORED_ALPHA))); + accelerationEnabled = gc.isCapPresent(CAPS_EXT_FBOBJECT); } protected boolean isAccelerationEnabled() { @@ -113,10 +104,9 @@ ColorModel cm = gc.getColorModel(vImg.getTransparency()); int type = vImg.getForcedAccelSurfaceType(); // if acceleration type is forced (type != UNDEFINED) then - // use the forced type, otherwise choose one based on caps + // use the forced type, otherwise choose FBOBJECT if (type == OGLSurfaceData.UNDEFINED) { - type = gc.isCapPresent(CAPS_EXT_FBOBJECT) ? - OGLSurfaceData.FBOBJECT : OGLSurfaceData.PBUFFER; + type = OGLSurfaceData.FBOBJECT; } if (createVSynced) { // TODO: modify parameter to delegate --- old/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m 2015-06-14 21:44:04.000000000 +0300 +++ new/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m 2015-06-14 21:44:04.000000000 +0300 @@ -342,18 +342,10 @@ if (value != 0) { caps |= CAPS_DOUBLEBUFFERED; } - [sharedPixelFormat - getValues: &value - forAttribute: NSOpenGLPFAAlphaSize - forVirtualScreen: contextVirtualScreen]; - if (value != 0) { - caps |= CAPS_STORED_ALPHA; - } - J2dRlsTraceLn2(J2D_TRACE_INFO, - "CGLGraphicsConfig_getCGLConfigInfo: db=%d alpha=%d", - (caps & CAPS_DOUBLEBUFFERED) != 0, - (caps & CAPS_STORED_ALPHA) != 0); + J2dRlsTraceLn1(J2D_TRACE_INFO, + "CGLGraphicsConfig_getCGLConfigInfo: db=%d", + (caps & CAPS_DOUBLEBUFFERED) != 0); // remove before shipping (?) #if 1 --- old/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.h 2015-06-14 21:44:05.000000000 +0300 +++ new/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.h 2015-06-14 21:44:05.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -39,7 +39,6 @@ AWTView *peerData; CGLLayer *layer; GLclampf argb[4]; // background clear color - NSOpenGLPixelBuffer *pbuffer; CGLGraphicsConfigInfo *configInfo; } CGLSDOps; --- old/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m 2015-06-14 21:44:06.000000000 +0300 +++ new/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m 2015-06-14 21:44:05.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -111,7 +111,7 @@ /** * This function disposes of any native windowing system resources associated * with this surface. For instance, if the given OGLSDOps is of type - * OGLSD_PBUFFER, this method implementation will destroy the actual pbuffer + * OGLSD_WINDOW, this method implementation will destroy the actual pbuffer * surface. */ void @@ -122,16 +122,7 @@ JNF_COCOA_ENTER(env); CGLSDOps *cglsdo = (CGLSDOps *)oglsdo->privOps; - if (oglsdo->drawableType == OGLSD_PBUFFER) { - if (oglsdo->textureID != 0) { - j2d_glDeleteTextures(1, &oglsdo->textureID); - oglsdo->textureID = 0; - } - if (cglsdo->pbuffer != NULL) { - [cglsdo->pbuffer release]; - cglsdo->pbuffer = NULL; - } - } else if (oglsdo->drawableType == OGLSD_WINDOW) { + if (oglsdo->drawableType == OGLSD_WINDOW) { // detach the NSView from the NSOpenGLContext CGLGraphicsConfigInfo *cglInfo = cglsdo->configInfo; OGLContext *oglc = cglInfo->context; @@ -277,23 +268,12 @@ JNF_COCOA_ENTER(env); - // set the current surface - if (dstOps->drawableType == OGLSD_PBUFFER) { - // REMIND: pbuffers are not fully tested yet... - [ctxinfo->context clearDrawable]; + CGLSDOps *cglsdo = (CGLSDOps *)dstOps->privOps; + NSView *nsView = (NSView *)cglsdo->peerData; + + if ([ctxinfo->context view] != nsView) { [ctxinfo->context makeCurrentContext]; - [ctxinfo->context setPixelBuffer: dstCGLOps->pbuffer - cubeMapFace: 0 - mipMapLevel: 0 - currentVirtualScreen: [ctxinfo->context currentVirtualScreen]]; - } else { - CGLSDOps *cglsdo = (CGLSDOps *)dstOps->privOps; - NSView *nsView = (NSView *)cglsdo->peerData; - - if ([ctxinfo->context view] != nsView) { - [ctxinfo->context makeCurrentContext]; - [ctxinfo->context setView: nsView]; - } + [ctxinfo->context setView: nsView]; } if (OGLC_IS_CAP_PRESENT(oglc, CAPS_EXT_FBOBJECT)) { @@ -303,16 +283,6 @@ j2d_glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); } - if ((srcOps != dstOps) && (srcOps->drawableType == OGLSD_PBUFFER)) { - // bind pbuffer to the render texture object (since we are preparing - // to copy from the pbuffer) - CGLSDOps *srcCGLOps = (CGLSDOps *)srcOps->privOps; - j2d_glBindTexture(GL_TEXTURE_2D, srcOps->textureID); - [ctxinfo->context - setTextureImageToPixelBuffer: srcCGLOps->pbuffer - colorBuffer: GL_FRONT]; - } - JNF_COCOA_EXIT(env); return oglc; @@ -464,105 +434,6 @@ cglsdo->layer = NULL; } -JNIEXPORT jboolean JNICALL -Java_sun_java2d_opengl_CGLSurfaceData_initPbuffer - (JNIEnv *env, jobject cglsd, - jlong pData, jlong pConfigInfo, jboolean isOpaque, - jint width, jint height) -{ - J2dTraceLn3(J2D_TRACE_INFO, "CGLSurfaceData_initPbuffer: w=%d h=%d opq=%d", width, height, isOpaque); - - OGLSDOps *oglsdo = (OGLSDOps *)jlong_to_ptr(pData); - if (oglsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: ops are null"); - return JNI_FALSE; - } - - CGLSDOps *cglsdo = (CGLSDOps *)oglsdo->privOps; - if (cglsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: cgl ops are null"); - return JNI_FALSE; - } - - CGLGraphicsConfigInfo *cglInfo = (CGLGraphicsConfigInfo *) - jlong_to_ptr(pConfigInfo); - if (cglInfo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: cgl config info is null"); - return JNI_FALSE; - } - - // find the maximum allowable texture dimensions (this value ultimately - // determines our maximum pbuffer size) - int pbMax = 0; - j2d_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &pbMax); - - int pbWidth = 0; - int pbHeight = 0; - if (OGLC_IS_CAP_PRESENT(cglInfo->context, CAPS_TEXNONPOW2)) { - // use non-power-of-two dimensions directly - pbWidth = (width <= pbMax) ? width : 0; - pbHeight = (height <= pbMax) ? height : 0; - } else { - // find the appropriate power-of-two dimensions - pbWidth = OGLSD_NextPowerOfTwo(width, pbMax); - pbHeight = OGLSD_NextPowerOfTwo(height, pbMax); - } - - J2dTraceLn3(J2D_TRACE_VERBOSE, " desired pbuffer dimensions: w=%d h=%d max=%d", pbWidth, pbHeight, pbMax); - - // if either dimension is 0, we cannot allocate a pbuffer/texture with the - // requested dimensions - if (pbWidth == 0 || pbHeight == 0) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: dimensions too large"); - return JNI_FALSE; - } - - int format = isOpaque ? GL_RGB : GL_RGBA; - -JNF_COCOA_ENTER(env); - - cglsdo->pbuffer = - [[NSOpenGLPixelBuffer alloc] - initWithTextureTarget: GL_TEXTURE_2D - textureInternalFormat: format - textureMaxMipMapLevel: 0 - pixelsWide: pbWidth - pixelsHigh: pbHeight]; - if (cglsdo->pbuffer == nil) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: could not create pbuffer"); - return JNI_FALSE; - } - - // make sure the actual dimensions match those that we requested - GLsizei actualWidth = [cglsdo->pbuffer pixelsWide]; - GLsizei actualHeight = [cglsdo->pbuffer pixelsHigh]; - if (actualWidth != pbWidth || actualHeight != pbHeight) { - J2dRlsTraceLn2(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: actual (w=%d h=%d) != requested", actualWidth, actualHeight); - [cglsdo->pbuffer release]; - return JNI_FALSE; - } - - GLuint texID = 0; - j2d_glGenTextures(1, &texID); - j2d_glBindTexture(GL_TEXTURE_2D, texID); - - oglsdo->drawableType = OGLSD_PBUFFER; - oglsdo->isOpaque = isOpaque; - oglsdo->width = width; - oglsdo->height = height; - oglsdo->textureID = texID; - oglsdo->textureWidth = pbWidth; - oglsdo->textureHeight = pbHeight; - oglsdo->activeBuffer = GL_FRONT; - oglsdo->needsInit = JNI_TRUE; - - OGLSD_INIT_TEXTURE_FILTER(oglsdo, GL_NEAREST); - -JNF_COCOA_EXIT(env); - - return JNI_TRUE; -} - #pragma mark - #pragma mark "--- CGLSurfaceData methods - Mac OS X specific ---" --- old/src/java.desktop/share/classes/sun/java2d/opengl/OGLContext.java 2015-06-14 21:44:06.000000000 +0300 +++ new/src/java.desktop/share/classes/sun/java2d/opengl/OGLContext.java 2015-06-14 21:44:06.000000000 +0300 @@ -164,9 +164,6 @@ @Native static final int CAPS_EXT_FBOBJECT = (CAPS_RT_TEXTURE_ALPHA | CAPS_RT_TEXTURE_OPAQUE); - /** Indicates that the context supports a stored alpha channel. */ - @Native - static final int CAPS_STORED_ALPHA = CAPS_RT_PLAIN_ALPHA; /** Indicates that the context is doublebuffered. */ @Native static final int CAPS_DOUBLEBUFFERED = (FIRST_PRIVATE_CAP << 0); @@ -205,9 +202,6 @@ if ((caps & CAPS_EXT_FBOBJECT) != 0) { sb.append("CAPS_EXT_FBOBJECT|"); } - if ((caps & CAPS_STORED_ALPHA) != 0) { - sb.append("CAPS_STORED_ALPHA|"); - } if ((caps & CAPS_DOUBLEBUFFERED) != 0) { sb.append("CAPS_DOUBLEBUFFERED|"); } --- old/src/java.desktop/share/classes/sun/java2d/opengl/OGLSurfaceData.java 2015-06-14 21:44:07.000000000 +0300 +++ new/src/java.desktop/share/classes/sun/java2d/opengl/OGLSurfaceData.java 2015-06-14 21:44:07.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -91,7 +91,6 @@ * OGL Type Corresponding SurfaceType * -------- ------------------------- * WINDOW OpenGLSurface - * PBUFFER OpenGLSurface * TEXTURE OpenGLTexture * FLIP_BACKBUFFER OpenGLSurface * FBOBJECT OpenGLSurfaceRTT @@ -104,7 +103,6 @@ * * @see sun.java2d.pipe.hw.AccelSurface */ - public static final int PBUFFER = RT_PLAIN; public static final int FBOBJECT = RT_TEXTURE; /** @@ -172,9 +170,6 @@ boolean texRect, int width, int height); protected native boolean initFlipBackbuffer(long pData); - protected abstract boolean initPbuffer(long pData, long pConfigInfo, - boolean isOpaque, - int width, int height); private native int getTextureTarget(long pData); private native int getTextureID(long pData); @@ -250,7 +245,6 @@ return OpenGLTexture; case FBOBJECT: return OpenGLSurfaceRTT; - case PBUFFER: default: return OpenGLSurface; } @@ -266,13 +260,6 @@ boolean success = false; switch (type) { - case PBUFFER: - success = initPbuffer(getNativeOps(), - graphicsConfig.getNativeConfigInfo(), - isOpaque, - width, height); - break; - case TEXTURE: success = initTexture(getNativeOps(), isOpaque, isTexNonPow2Available(), @@ -311,10 +298,9 @@ try { switch (type) { case TEXTURE: - case PBUFFER: case FBOBJECT: // need to make sure the context is current before - // creating the texture (or pbuffer, or fbobject) + // creating the texture or fbobject OGLContext.setScratchSurface(graphicsConfig); break; default: --- old/src/java.desktop/share/classes/sun/java2d/opengl/OGLUtilities.java 2015-06-14 21:44:08.000000000 +0300 +++ new/src/java.desktop/share/classes/sun/java2d/opengl/OGLUtilities.java 2015-06-14 21:44:08.000000000 +0300 @@ -51,7 +51,6 @@ */ public static final int UNDEFINED = OGLSurfaceData.UNDEFINED; public static final int WINDOW = OGLSurfaceData.WINDOW; - public static final int PBUFFER = OGLSurfaceData.PBUFFER; public static final int TEXTURE = OGLSurfaceData.TEXTURE; public static final int FLIP_BACKBUFFER = OGLSurfaceData.FLIP_BACKBUFFER; public static final int FBOBJECT = OGLSurfaceData.FBOBJECT; --- old/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelSurface.java 2015-06-14 21:44:09.000000000 +0300 +++ new/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelSurface.java 2015-06-14 21:44:09.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -43,8 +43,7 @@ */ @Native public static final int WINDOW = 1; /** - * Render-To Plain surface (pbuffer for OpenGL, Render Target surface - * for Direct3D) + * Render-To Plain surface (Render Target surface for Direct3D) */ @Native public static final int RT_PLAIN = 2; /** --- old/src/java.desktop/share/native/common/java2d/opengl/OGLContext.h 2015-06-14 21:44:10.000000000 +0300 +++ new/src/java.desktop/share/native/common/java2d/opengl/OGLContext.h 2015-06-14 21:44:09.000000000 +0300 @@ -122,8 +122,6 @@ sun_java2d_opengl_OGLContext_OGLContextCaps_LAST_SHARED_CAP #define CAPS_EXT_FBOBJECT \ sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_EXT_FBOBJECT -#define CAPS_STORED_ALPHA \ - sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_STORED_ALPHA #define CAPS_DOUBLEBUFFERED \ sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_DOUBLEBUFFERED #define CAPS_EXT_LCD_SHADER \ --- old/src/java.desktop/share/native/common/java2d/opengl/OGLSurfaceData.h 2015-06-14 21:44:10.000000000 +0300 +++ new/src/java.desktop/share/native/common/java2d/opengl/OGLSurfaceData.h 2015-06-14 21:44:10.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -118,7 +118,7 @@ * x/yOffset would be (0,0) (the same applies to pbuffers). * * jint width/height; - * The cached surface bounds. For offscreen surface types (OGLSD_PBUFFER, + * The cached surface bounds. For offscreen surface types (OGLSD_FBOBJECT, * OGLSD_TEXTURE, etc.) these values must remain constant. Onscreen window * surfaces (OGLSD_WINDOW, OGLSD_FLIP_BACKBUFFER, etc.) may have their * bounds changed in response to a programmatic or user-initiated event, so @@ -218,7 +218,6 @@ */ #define OGLSD_UNDEFINED sun_java2d_pipe_hw_AccelSurface_UNDEFINED #define OGLSD_WINDOW sun_java2d_pipe_hw_AccelSurface_WINDOW -#define OGLSD_PBUFFER sun_java2d_pipe_hw_AccelSurface_RT_PLAIN #define OGLSD_TEXTURE sun_java2d_pipe_hw_AccelSurface_TEXTURE #define OGLSD_FLIP_BACKBUFFER sun_java2d_pipe_hw_AccelSurface_FLIP_BACKBUFFER #define OGLSD_FBOBJECT sun_java2d_pipe_hw_AccelSurface_RT_TEXTURE --- old/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java 2015-06-14 21:44:11.000000000 +0300 +++ new/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java 2015-06-14 21:44:11.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -399,9 +399,8 @@ createCompatibleVolatileImage(int width, int height, int transparency, int type) { - if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED || - transparency == Transparency.BITMASK) - { + if ((type != FBOBJECT && type != TEXTURE) + || transparency == Transparency.BITMASK) { return null; } @@ -409,11 +408,6 @@ if (!isCapPresent(CAPS_EXT_FBOBJECT)) { return null; } - } else if (type == PBUFFER) { - boolean isOpaque = transparency == Transparency.OPAQUE; - if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) { - return null; - } } SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height, --- old/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java 2015-06-14 21:44:12.000000000 +0300 +++ new/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java 2015-06-14 21:44:12.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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,11 +30,10 @@ import java.awt.GraphicsEnvironment; import java.awt.Image; import java.awt.Rectangle; -import java.awt.Transparency; import java.awt.image.ColorModel; + import sun.awt.X11ComponentPeer; import sun.java2d.SurfaceData; -import sun.java2d.loops.SurfaceType; public abstract class GLXSurfaceData extends OGLSurfaceData { @@ -42,9 +41,6 @@ private GLXGraphicsConfig graphicsConfig; private native void initOps(X11ComponentPeer peer, long aData); - protected native boolean initPbuffer(long pData, long pConfigInfo, - boolean isOpaque, - int width, int height); protected GLXSurfaceData(X11ComponentPeer peer, GLXGraphicsConfig gc, ColorModel cm, int type) --- old/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java 2015-06-14 21:44:12.000000000 +0300 +++ new/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java 2015-06-14 21:44:12.000000000 +0300 @@ -29,7 +29,6 @@ import static java.awt.BufferCapabilities.FlipContents.*; import java.awt.Component; import java.awt.GraphicsConfiguration; -import java.awt.Transparency; import java.awt.image.ColorModel; import sun.awt.AWTAccessor; @@ -46,7 +45,7 @@ public class GLXVolatileSurfaceManager extends VolatileSurfaceManager { - private boolean accelerationEnabled; + private final boolean accelerationEnabled; public GLXVolatileSurfaceManager(SunVolatileImage vImg, Object context) { super(vImg, context); @@ -54,18 +53,10 @@ /* * We will attempt to accelerate this image only under the * following conditions: - * - the image is opaque OR - * - the image is translucent AND - * - the GraphicsConfig supports the FBO extension OR - * - the GraphicsConfig has a stored alpha channel + * - the GraphicsConfig supports the FBO extension */ - int transparency = vImg.getTransparency(); GLXGraphicsConfig gc = (GLXGraphicsConfig)vImg.getGraphicsConfig(); - accelerationEnabled = - (transparency == Transparency.OPAQUE) || - ((transparency == Transparency.TRANSLUCENT) && - (gc.isCapPresent(CAPS_EXT_FBOBJECT) || - gc.isCapPresent(CAPS_STORED_ALPHA))); + accelerationEnabled = gc.isCapPresent(CAPS_EXT_FBOBJECT); } protected boolean isAccelerationEnabled() { @@ -113,10 +104,9 @@ ColorModel cm = gc.getColorModel(vImg.getTransparency()); int type = vImg.getForcedAccelSurfaceType(); // if acceleration type is forced (type != UNDEFINED) then - // use the forced type, otherwise choose one based on caps + // use the forced type, otherwise choose FBOBJECT if (type == OGLSurfaceData.UNDEFINED) { - type = gc.isCapPresent(CAPS_EXT_FBOBJECT) ? - OGLSurfaceData.FBOBJECT : OGLSurfaceData.PBUFFER; + type = OGLSurfaceData.FBOBJECT; } if (createVSynced) { sData = GLXSurfaceData.createData(peer, vImg, type); --- old/src/java.desktop/unix/native/common/java2d/opengl/GLXGraphicsConfig.c 2015-06-14 21:44:13.000000000 +0300 +++ new/src/java.desktop/unix/native/common/java2d/opengl/GLXGraphicsConfig.c 2015-06-14 21:44:13.000000000 +0300 @@ -472,7 +472,7 @@ GLXPbuffer scratch; GLXGraphicsConfigInfo *glxinfo; jint caps = CAPS_EMPTY; - int db, alpha; + int db; const unsigned char *versionstr; J2dRlsTraceLn(J2D_TRACE_INFO, "GLXGraphicsConfig_getGLXConfigInfo"); @@ -583,10 +583,6 @@ if (db) { caps |= CAPS_DOUBLEBUFFERED; } - j2d_glXGetFBConfigAttrib(awt_display, fbconfig, GLX_ALPHA_SIZE, &alpha); - if (alpha > 0) { - caps |= CAPS_STORED_ALPHA; - } // initialize the OGLContext, which wraps the GLXFBConfig and GLXContext oglc = GLXGC_InitOGLContext(fbconfig, context, scratch, caps); --- old/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c 2015-06-14 21:44:14.000000000 +0300 +++ new/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c 2015-06-14 21:44:14.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -111,25 +111,12 @@ /** * This function disposes of any native windowing system resources associated - * with this surface. For instance, if the given OGLSDOps is of type - * OGLSD_PBUFFER, this method implementation will destroy the actual pbuffer - * surface. + * with this surface. */ void OGLSD_DestroyOGLSurface(JNIEnv *env, OGLSDOps *oglsdo) { - GLXSDOps *glxsdo = (GLXSDOps *)oglsdo->privOps; - - J2dTraceLn(J2D_TRACE_INFO, "OGLSD_DestroyOGLSurface"); - - if (oglsdo->drawableType == OGLSD_PBUFFER) { - if (glxsdo->drawable != 0) { - j2d_glXDestroyPbuffer(awt_display, glxsdo->drawable); - glxsdo->drawable = 0; - } - } else if (oglsdo->drawableType == OGLSD_WINDOW) { - // X Window is free'd later by AWT code... - } + // X Window is free'd later by AWT code... } /** @@ -358,74 +345,6 @@ return 0; } -JNIEXPORT jboolean JNICALL -Java_sun_java2d_opengl_GLXSurfaceData_initPbuffer - (JNIEnv *env, jobject glxsd, - jlong pData, jlong pConfigInfo, - jboolean isOpaque, - jint width, jint height) -{ - OGLSDOps *oglsdo = (OGLSDOps *)jlong_to_ptr(pData); - GLXGraphicsConfigInfo *glxinfo = - (GLXGraphicsConfigInfo *)jlong_to_ptr(pConfigInfo); - GLXSDOps *glxsdo; - GLXPbuffer pbuffer; - int attrlist[] = {GLX_PBUFFER_WIDTH, 0, - GLX_PBUFFER_HEIGHT, 0, - GLX_PRESERVED_CONTENTS, GL_FALSE, 0}; - - J2dTraceLn3(J2D_TRACE_INFO, - "GLXSurfaceData_initPbuffer: w=%d h=%d opq=%d", - width, height, isOpaque); - - if (oglsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "GLXSurfaceData_initPbuffer: ops are null"); - return JNI_FALSE; - } - - glxsdo = (GLXSDOps *)oglsdo->privOps; - if (glxsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "GLXSurfaceData_initPbuffer: glx ops are null"); - return JNI_FALSE; - } - - if (glxinfo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "GLXSurfaceData_initPbuffer: glx config info is null"); - return JNI_FALSE; - } - - attrlist[1] = width; - attrlist[3] = height; - - surfaceCreationFailed = JNI_FALSE; - EXEC_WITH_XERROR_HANDLER( - GLXSD_BadAllocXErrHandler, - pbuffer = j2d_glXCreatePbuffer(awt_display, - glxinfo->fbconfig, attrlist)); - if ((pbuffer == 0) || surfaceCreationFailed) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "GLXSurfaceData_initPbuffer: could not create glx pbuffer"); - return JNI_FALSE; - } - - oglsdo->drawableType = OGLSD_PBUFFER; - oglsdo->isOpaque = isOpaque; - oglsdo->width = width; - oglsdo->height = height; - oglsdo->xOffset = 0; - oglsdo->yOffset = 0; - - glxsdo->drawable = pbuffer; - glxsdo->xdrawable = 0; - - OGLSD_SetNativeDimensions(env, oglsdo, width, height); - - return JNI_TRUE; -} - void OGLSD_SwapBuffers(JNIEnv *env, jlong window) { --- old/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java 2015-06-14 21:44:15.000000000 +0300 +++ new/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java 2015-06-14 21:44:14.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, 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,6 @@ import java.awt.AWTException; import java.awt.BufferCapabilities; -import java.awt.BufferCapabilities.FlipContents; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; @@ -425,21 +424,14 @@ createCompatibleVolatileImage(int width, int height, int transparency, int type) { - if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED || - transparency == Transparency.BITMASK) - { + if ((type != FBOBJECT && type != TEXTURE) + || transparency == Transparency.BITMASK) { return null; } - if (type == FBOBJECT) { if (!isCapPresent(CAPS_EXT_FBOBJECT)) { return null; } - } else if (type == PBUFFER) { - boolean isOpaque = transparency == Transparency.OPAQUE; - if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) { - return null; - } } SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height, --- old/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java 2015-06-14 21:44:15.000000000 +0300 +++ new/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java 2015-06-14 21:44:15.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, 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 @@ -43,9 +43,6 @@ private native void initOps(long pConfigInfo, WComponentPeer peer, long hwnd); - protected native boolean initPbuffer(long pData, long pConfigInfo, - boolean isOpaque, - int width, int height); protected WGLSurfaceData(WComponentPeer peer, WGLGraphicsConfig gc, ColorModel cm, int type) --- old/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java 2015-06-14 21:44:16.000000000 +0300 +++ new/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java 2015-06-14 21:44:16.000000000 +0300 @@ -29,7 +29,6 @@ import static java.awt.BufferCapabilities.FlipContents.*; import java.awt.Component; import java.awt.GraphicsConfiguration; -import java.awt.Transparency; import java.awt.image.ColorModel; import sun.awt.AWTAccessor; @@ -43,10 +42,9 @@ import sun.java2d.pipe.hw.ExtendedBufferCapabilities; import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*; -public class WGLVolatileSurfaceManager - extends VolatileSurfaceManager -{ - private boolean accelerationEnabled; +public class WGLVolatileSurfaceManager extends VolatileSurfaceManager { + + private final boolean accelerationEnabled; public WGLVolatileSurfaceManager(SunVolatileImage vImg, Object context) { super(vImg, context); @@ -54,18 +52,10 @@ /* * We will attempt to accelerate this image only under the * following conditions: - * - the image is opaque OR - * - the image is translucent AND - * - the GraphicsConfig supports the FBO extension OR - * - the GraphicsConfig has a stored alpha channel + * - the GraphicsConfig supports the FBO extension */ - int transparency = vImg.getTransparency(); WGLGraphicsConfig gc = (WGLGraphicsConfig)vImg.getGraphicsConfig(); - accelerationEnabled = - (transparency == Transparency.OPAQUE) || - ((transparency == Transparency.TRANSLUCENT) && - (gc.isCapPresent(CAPS_EXT_FBOBJECT) || - gc.isCapPresent(CAPS_STORED_ALPHA))); + accelerationEnabled = gc.isCapPresent(CAPS_EXT_FBOBJECT); } protected boolean isAccelerationEnabled() { @@ -111,10 +101,9 @@ ColorModel cm = gc.getColorModel(vImg.getTransparency()); int type = vImg.getForcedAccelSurfaceType(); // if acceleration type is forced (type != UNDEFINED) then - // use the forced type, otherwise choose one based on caps + // use the forced type, otherwise choose FBOBJECT if (type == OGLSurfaceData.UNDEFINED) { - type = gc.isCapPresent(CAPS_EXT_FBOBJECT) ? - OGLSurfaceData.FBOBJECT : OGLSurfaceData.PBUFFER; + type = OGLSurfaceData.FBOBJECT; } if (createVSynced) { sData = WGLSurfaceData.createData(peer, vImg, type); --- old/src/java.desktop/windows/native/libawt/java2d/opengl/WGLGraphicsConfig.c 2015-06-14 21:44:17.000000000 +0300 +++ new/src/java.desktop/windows/native/libawt/java2d/opengl/WGLGraphicsConfig.c 2015-06-14 21:44:17.000000000 +0300 @@ -502,8 +502,8 @@ const unsigned char *versionstr; const char *extstr; jint caps = CAPS_EMPTY; - int attrKeys[] = { WGL_DOUBLE_BUFFER_ARB, WGL_ALPHA_BITS_ARB }; - int attrVals[2]; + int attrKeys[] = { WGL_DOUBLE_BUFFER_ARB}; + int attrVals[1]; J2dRlsTraceLn(J2D_TRACE_INFO, "WGLGraphicsConfig_getWGLConfigInfo"); @@ -624,13 +624,10 @@ } // get config-specific capabilities - j2d_wglGetPixelFormatAttribivARB(hdc, pixfmt, 0, 2, attrKeys, attrVals); + j2d_wglGetPixelFormatAttribivARB(hdc, pixfmt, 0, 1, attrKeys, attrVals); if (attrVals[0]) { caps |= CAPS_DOUBLEBUFFERED; } - if (attrVals[1] > 0) { - caps |= CAPS_STORED_ALPHA; - } // create the scratch pbuffer scratch = j2d_wglCreatePbufferARB(hdc, pixfmt, 1, 1, NULL); --- old/src/java.desktop/windows/native/libawt/java2d/opengl/WGLSurfaceData.c 2015-06-14 21:44:17.000000000 +0300 +++ new/src/java.desktop/windows/native/libawt/java2d/opengl/WGLSurfaceData.c 2015-06-14 21:44:17.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, 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 @@ -107,28 +107,12 @@ /** * This function disposes of any native windowing system resources associated - * with this surface. For instance, if the given OGLSDOps is of type - * OGLSD_PBUFFER, this method implementation will destroy the actual pbuffer - * surface. + * with this surface. */ void OGLSD_DestroyOGLSurface(JNIEnv *env, OGLSDOps *oglsdo) { - WGLSDOps *wglsdo = (WGLSDOps *)oglsdo->privOps; - - J2dTraceLn(J2D_TRACE_INFO, "OGLSD_DestroyOGLSurface"); - - if (oglsdo->drawableType == OGLSD_PBUFFER) { - if (wglsdo->pbuffer != 0) { - if (wglsdo->pbufferDC != 0) { - j2d_wglReleasePbufferDCARB(wglsdo->pbuffer, - wglsdo->pbufferDC); - wglsdo->pbufferDC = 0; - } - j2d_wglDestroyPbufferARB(wglsdo->pbuffer); - wglsdo->pbuffer = 0; - } - } + // Window is free'd later by AWT code... } /** @@ -276,19 +260,11 @@ ctxinfo = (WGLCtxInfo *)oglc->ctxInfo; // get the hdc for the destination surface - if (dstOps->drawableType == OGLSD_PBUFFER) { - dstHDC = dstWGLOps->pbufferDC; - } else { - dstHDC = GetDC(dstWGLOps->window); - } + dstHDC = GetDC(dstWGLOps->window); // get the hdc for the source surface - if (srcOps->drawableType == OGLSD_PBUFFER) { - srcHDC = srcWGLOps->pbufferDC; - } else { - // the source will always be equal to the destination in this case - srcHDC = dstHDC; - } + // the source will always be equal to the destination in this case + srcHDC = dstHDC; // REMIND: in theory we should be able to use wglMakeContextCurrentARB() // even when the src/dst surfaces are the same, but this causes problems @@ -306,9 +282,7 @@ if (!success) { J2dRlsTraceLn(J2D_TRACE_ERROR, "OGLSD_MakeOGLContextCurrent: could not make current"); - if (dstOps->drawableType != OGLSD_PBUFFER) { - ReleaseDC(dstWGLOps->window, dstHDC); - } + ReleaseDC(dstWGLOps->window, dstHDC); return NULL; } @@ -319,9 +293,7 @@ j2d_glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); } - if (dstOps->drawableType != OGLSD_PBUFFER) { - ReleaseDC(dstWGLOps->window, dstHDC); - } + ReleaseDC(dstWGLOps->window, dstHDC); return oglc; } @@ -400,141 +372,6 @@ return JNI_TRUE; } -JNIEXPORT jboolean JNICALL -Java_sun_java2d_opengl_WGLSurfaceData_initPbuffer - (JNIEnv *env, jobject wglsd, - jlong pData, jlong pConfigInfo, - jboolean isOpaque, - jint width, jint height) -{ - int attrKeys[] = { - WGL_MAX_PBUFFER_WIDTH_ARB, - WGL_MAX_PBUFFER_HEIGHT_ARB, - }; - int attrVals[2]; - int pbAttrList[] = { 0 }; - OGLSDOps *oglsdo = (OGLSDOps *)jlong_to_ptr(pData); - WGLGraphicsConfigInfo *wglInfo = - (WGLGraphicsConfigInfo *)jlong_to_ptr(pConfigInfo); - WGLSDOps *wglsdo; - HWND hwnd; - HDC hdc, pbufferDC; - HPBUFFERARB pbuffer; - int maxWidth, maxHeight; - int actualWidth, actualHeight; - - J2dTraceLn3(J2D_TRACE_INFO, - "WGLSurfaceData_initPbuffer: w=%d h=%d opq=%d", - width, height, isOpaque); - - if (oglsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: ops are null"); - return JNI_FALSE; - } - - wglsdo = (WGLSDOps *)oglsdo->privOps; - if (wglsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: wgl ops are null"); - return JNI_FALSE; - } - - if (wglInfo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: wgl config info is null"); - return JNI_FALSE; - } - - // create a scratch window - hwnd = WGLGC_CreateScratchWindow(wglInfo->screen); - if (hwnd == 0) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: could not create scratch window"); - return JNI_FALSE; - } - - // get the HDC for the scratch window - hdc = GetDC(hwnd); - if (hdc == 0) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: could not get dc for scratch window"); - DestroyWindow(hwnd); - return JNI_FALSE; - } - - // get the maximum allowable pbuffer dimensions - j2d_wglGetPixelFormatAttribivARB(hdc, wglInfo->pixfmt, 0, 2, - attrKeys, attrVals); - maxWidth = attrVals[0]; - maxHeight = attrVals[1]; - - J2dTraceLn4(J2D_TRACE_VERBOSE, - " desired pbuffer dimensions: w=%d h=%d maxw=%d maxh=%d", - width, height, maxWidth, maxHeight); - - // if either dimension is 0 or larger than the maximum, we cannot - // allocate a pbuffer with the requested dimensions - if (width == 0 || width > maxWidth || - height == 0 || height > maxHeight) - { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: invalid dimensions"); - ReleaseDC(hwnd, hdc); - DestroyWindow(hwnd); - return JNI_FALSE; - } - - pbuffer = j2d_wglCreatePbufferARB(hdc, wglInfo->pixfmt, - width, height, pbAttrList); - - ReleaseDC(hwnd, hdc); - DestroyWindow(hwnd); - - if (pbuffer == 0) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: could not create wgl pbuffer"); - return JNI_FALSE; - } - - // note that we get the DC for the pbuffer at creation time, and then - // release the DC when the pbuffer is disposed; the WGL_ARB_pbuffer - // spec is vague about such things, but from past experience we know - // this approach to be more robust than, for example, doing a - // Get/ReleasePbufferDC() everytime we make a context current - pbufferDC = j2d_wglGetPbufferDCARB(pbuffer); - if (pbufferDC == 0) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: could not get dc for pbuffer"); - j2d_wglDestroyPbufferARB(pbuffer); - return JNI_FALSE; - } - - // make sure the actual dimensions match those that we requested - j2d_wglQueryPbufferARB(pbuffer, WGL_PBUFFER_WIDTH_ARB, &actualWidth); - j2d_wglQueryPbufferARB(pbuffer, WGL_PBUFFER_HEIGHT_ARB, &actualHeight); - - if (width != actualWidth || height != actualHeight) { - J2dRlsTraceLn2(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: actual (w=%d h=%d) != requested", - actualWidth, actualHeight); - j2d_wglReleasePbufferDCARB(pbuffer, pbufferDC); - j2d_wglDestroyPbufferARB(pbuffer); - return JNI_FALSE; - } - - oglsdo->drawableType = OGLSD_PBUFFER; - oglsdo->isOpaque = isOpaque; - oglsdo->width = width; - oglsdo->height = height; - wglsdo->pbuffer = pbuffer; - wglsdo->pbufferDC = pbufferDC; - - OGLSD_SetNativeDimensions(env, oglsdo, width, height); - - return JNI_TRUE; -} - void OGLSD_SwapBuffers(JNIEnv *env, jlong pPeerData) {