# HG changeset patch # User linuxhippy@gmail.com # Date 1519153255 -3600 # Tue Feb 20 20:00:55 2018 +0100 # Node ID 560110e2d82de5f753f8cbb530c9f627a5290a82 # Parent 6dc5e0cdb44c2598aaa34d32dd23e3a0a9d3fede Xrender: remove unused classes from previous java-only backend diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XIDGenerator.java b/src/java.desktop/unix/classes/sun/java2d/xr/XIDGenerator.java deleted file mode 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XIDGenerator.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2010, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -package sun.java2d.xr; - -/** - * Class provides unused XIDs, used for creating server-side objects - * created by the java backend. - * It does buffering, to minimize JNI overhead. - * - * @author Clemens Eisserer - */ - -public class XIDGenerator { - private static final int XID_BUFFER_SIZE = 512; - - int[] xidBuffer = new int[XID_BUFFER_SIZE]; - int currentIndex = XID_BUFFER_SIZE; - - public int getNextXID() { - - if (currentIndex >= XID_BUFFER_SIZE) { - bufferXIDs(xidBuffer, xidBuffer.length); - currentIndex = 0; - } - - return xidBuffer[currentIndex++]; - } - - private static native void bufferXIDs(int[] buffer, int arraySize); -} diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XcbRequestCounter.java b/src/java.desktop/unix/classes/sun/java2d/xr/XcbRequestCounter.java deleted file mode 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XcbRequestCounter.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2010, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -package sun.java2d.xr; - -/** - * UInt32 "emulation", mimics the behaviour of xcb's request counter. - * In order to be compatible with xcb we have to wrap exactly when xcb would do. - * @author Clemens Eisserer - */ - -public class XcbRequestCounter { - private static final long MAX_UINT = 4294967295L; - - long value; - - public XcbRequestCounter(long value) { - this.value = value; - } - - public void setValue(long value) { - this.value = value; - } - - public long getValue() { - return value; - } - - public void add(long v) { - value += v; - - /*Handle 32-bit unsigned int overflow*/ - if (value > MAX_UINT) { - value = 0; //-= MAX_UINT; //Shouldn't that be zero?!?! - } - } -} # HG changeset patch # User linuxhippy@gmail.com # Date 1519153776 -3600 # Tue Feb 20 20:09:36 2018 +0100 # Node ID 379e76246cd39344c3ca1d36b88b9ff5e5d1c13d # Parent 560110e2d82de5f753f8cbb530c9f627a5290a82 Xrender: Rename MaskTil(eManager) to RectTile(Manager) to avoid confusion later diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/DirtyRegion.java b/src/java.desktop/unix/classes/sun/java2d/xr/DirtyRegion.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/DirtyRegion.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/DirtyRegion.java @@ -27,7 +27,7 @@ import static java.lang.Math.min; import static java.lang.Math.max; -import static sun.java2d.xr.MaskTileManager.MASK_SIZE; +import static sun.java2d.xr.RectTileManager.MASK_SIZE; /** * This class implements region tracking, used by the tiled-mask code. diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/MaskTile.java b/src/java.desktop/unix/classes/sun/java2d/xr/RectTile.java rename from src/java.desktop/unix/classes/sun/java2d/xr/MaskTile.java rename to src/java.desktop/unix/classes/sun/java2d/xr/RectTile.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/MaskTile.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/RectTile.java @@ -31,11 +31,11 @@ * * @author Clemens Eisserer */ -public class MaskTile { +public class RectTile { GrowableRectArray rects; DirtyRegion dirtyArea; - public MaskTile() + public RectTile() { rects = new GrowableRectArray(128); dirtyArea = new DirtyRegion(); diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/MaskTileManager.java b/src/java.desktop/unix/classes/sun/java2d/xr/RectTileManager.java rename from src/java.desktop/unix/classes/sun/java2d/xr/MaskTileManager.java rename to src/java.desktop/unix/classes/sun/java2d/xr/RectTileManager.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/MaskTileManager.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/RectTileManager.java @@ -31,20 +31,20 @@ /** * We render non-antialiased geometry (consisting of rectangles) into a mask, * which is later used in a composition step. - * To avoid mask-allocations of large size, MaskTileManager splits + * To avoid mask-allocations of large size, RectTileManager splits * geometry larger than MASK_SIZE into several tiles, - * and stores the geometry in instances of MaskTile. + * and stores the geometry in instances of RectTile. * * @author Clemens Eisserer */ -public class MaskTileManager { +public class RectTileManager { public static final int MASK_SIZE = 256; - MaskTile mainTile = new MaskTile(); + RectTile mainTile = new RectTile(); - ArrayList tileList; + ArrayList tileList; int allocatedTiles = 0; int xTiles, yTiles; @@ -55,8 +55,8 @@ int maskPicture; long maskGC; - public MaskTileManager(XRCompositeManager xrMgr, int parentXid) { - tileList = new ArrayList(); + public RectTileManager(XRCompositeManager xrMgr, int parentXid) { + tileList = new ArrayList(); this.xrMgr = xrMgr; this.con = xrMgr.getBackend(); @@ -97,7 +97,7 @@ for (int i = 0; i < yTiles; i++) { for (int m = 0; m < xTiles; m++) { - MaskTile tile = tileList.get(i * xTiles + m); + RectTile tile = tileList.get(i * xTiles + m); int tileStartX = m * MASK_SIZE; int tileStartY = i * MASK_SIZE; @@ -155,7 +155,7 @@ * Renders the rectangles provided to the mask, and does a composition * operation with the properties set inXRCompositeManager. */ - protected void compositeSingleTile(XRSurfaceData dst, MaskTile tile, + protected void compositeSingleTile(XRSurfaceData dst, RectTile tile, DirtyRegion dirtyArea, boolean maskRequired, int tileStartX, int tileStartY, @@ -212,7 +212,7 @@ /** - * Allocates enough MaskTile instances, to cover the whole + * Allocates enough RectTile instances, to cover the whole * mask area, or resets existing ones. */ protected void allocTiles(DirtyRegion maskArea) { @@ -225,7 +225,7 @@ if (i < allocatedTiles) { tileList.get(i).reset(); } else { - tileList.add(new MaskTile()); + tileList.add(new RectTile()); } } @@ -254,7 +254,7 @@ int tileIndex = xTiles * (tileYStartIndex + n) + tileXStartIndex + m; - MaskTile tile = tileList.get(tileIndex); + RectTile tile = tileList.get(tileIndex); GrowableRectArray rectTileList = tile.getRects(); int tileArrayIndex = rectTileList.getNextIndex(); @@ -305,7 +305,7 @@ /** * @return MainTile to which rectangles are added before composition. */ - public MaskTile getMainTile() { + public RectTile getMainTile() { return mainTile; } } diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java @@ -74,7 +74,7 @@ float validatedExtraAlpha = 1.0f; XRBackend con; - MaskTileManager maskBuffer; + RectTileManager maskBuffer; XRTextRenderer textRenderer; XRMaskImage maskImage; @@ -104,7 +104,7 @@ initResources(surface); - maskBuffer = new MaskTileManager(this, surface.getXid()); + maskBuffer = new RectTileManager(this, surface.getXid()); textRenderer = new XRTextRenderer(this); maskImage = new XRMaskImage(this, surface.getXid()); } @@ -124,7 +124,7 @@ if (enableGradCache) { gradCachePixmap = con.createPixmap(parentXid, 32, - MaskTileManager.MASK_SIZE, MaskTileManager.MASK_SIZE); + RectTileManager.MASK_SIZE, RectTileManager.MASK_SIZE); gradCachePicture = con.createPicture(gradCachePixmap, XRUtils.PictStandardARGB32); } @@ -344,7 +344,7 @@ return textRenderer; } - public MaskTileManager getMaskBuffer() { + public RectTileManager getMaskBuffer() { return maskBuffer; } diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java @@ -53,11 +53,11 @@ public class XRRenderer implements PixelDrawPipe, PixelFillPipe, ShapeDrawPipe { XRDrawHandler drawHandler; - MaskTileManager tileManager; + RectTileManager tileManager; XRDrawLine lineGen; GrowableRectArray rectBuffer; - public XRRenderer(MaskTileManager tileManager) { + public XRRenderer(RectTileManager tileManager) { this.tileManager = tileManager; this.rectBuffer = tileManager.getMainTile().getRects(); # HG changeset patch # User linuxhippy@gmail.com # Date 1519154132 -3600 # Tue Feb 20 20:15:32 2018 +0100 # Node ID 2da6beb01594c93b639df66c8f9734ecb3722750 # Parent 379e76246cd39344c3ca1d36b88b9ff5e5d1c13d Xrender: Remove gradient cache, doesn't make sense with current drivers diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java @@ -28,9 +28,6 @@ import java.awt.*; import java.awt.geom.*; -import java.security.AccessController; -import java.security.PrivilegedAction; - import sun.font.*; import sun.java2d.*; import sun.java2d.loops.*; @@ -44,7 +41,6 @@ */ public class XRCompositeManager { - private static boolean enableGradCache = true; private static XRCompositeManager instance; private static final int SOLID = 0; @@ -64,8 +60,6 @@ XRSurfaceData solidSrcPict; int alphaMaskPict; - int gradCachePixmap; - int gradCachePicture; boolean xorEnabled = false; int validatedPixel = 0; @@ -89,17 +83,6 @@ private XRCompositeManager(XRSurfaceData surface) { con = new XRBackendNative(); - String gradProp = - AccessController.doPrivileged(new PrivilegedAction() { - public String run() { - return System.getProperty("sun.java2d.xrgradcache"); - } - }); - - enableGradCache = gradProp == null || - !(gradProp.equalsIgnoreCase("false") || - gradProp.equalsIgnoreCase("f")); - XRPaints.register(this); initResources(surface); @@ -121,13 +104,6 @@ con.setPictureRepeat(alphaMaskPict, XRUtils.RepeatNormal); con.renderRectangle(alphaMaskPict, XRUtils.PictOpClear, XRColor.NO_ALPHA, 0, 0, 1, 1); - - if (enableGradCache) { - gradCachePixmap = con.createPixmap(parentXid, 32, - RectTileManager.MASK_SIZE, RectTileManager.MASK_SIZE); - gradCachePicture = con.createPicture(gradCachePixmap, - XRUtils.PictStandardARGB32); - } } public void setForeground(int pixel) { @@ -235,20 +211,8 @@ public void XRComposite(int src, int mask, int dst, int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, int width, int height) { int cachedSrc = (src == XRUtils.None) ? getCurrentSource().picture : src; - int cachedX = srcX; - int cachedY = srcY; - if (enableGradCache && gradient != null - && cachedSrc == gradient.picture) { - con.renderComposite(XRUtils.PictOpSrc, gradient.picture, - XRUtils.None, gradCachePicture, srcX, srcY, 0, 0, 0, 0, - width, height); - cachedX = 0; - cachedY = 0; - cachedSrc = gradCachePicture; - } - - con.renderComposite(compRule, cachedSrc, mask, dst, cachedX, cachedY, + con.renderComposite(compRule, cachedSrc, mask, dst, srcX, srcY, maskX, maskY, dstX, dstY, width, height); } # HG changeset patch # User linuxhippy@gmail.com # Date 1519154705 -3600 # Tue Feb 20 20:25:05 2018 +0100 # Node ID 622d9ad937095c2bc6baa96b1bcd24e262294d4e # Parent 2da6beb01594c93b639df66c8f9734ecb3722750 Xrender: make aa tile mask handling a responsibility of the backend implementation diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/RectTileManager.java b/src/java.desktop/unix/classes/sun/java2d/xr/RectTileManager.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/RectTileManager.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/RectTileManager.java @@ -122,36 +122,6 @@ } /** - * Uploads aa geometry generated for maskblit/fill into the mask pixmap. - */ - public int uploadMask(int w, int h, int maskscan, int maskoff, byte[] mask) { - int maskPic = XRUtils.None; - - if (mask != null) { - float maskAlpha = - xrMgr.isTexturePaintActive() ? xrMgr.getExtraAlpha() : 1.0f; - con.putMaskImage(maskPixmap, maskGC, mask, 0, 0, 0, 0, - w, h, maskoff, maskscan, maskAlpha); - maskPic = maskPicture; - } else if (xrMgr.isTexturePaintActive()) { - maskPic = xrMgr.getExtraAlphaMask(); - } - - return maskPic; - } - - /** - * Clears the area of the mask-pixmap used for uploading aa coverage values. - */ - public void clearUploadMask(int mask, int w, int h) { - if (mask == maskPicture) { - con.renderRectangle(maskPicture, XRUtils.PictOpClear, - XRColor.NO_ALPHA, 0, 0, w, h); - } - } - - - /** * Renders the rectangles provided to the mask, and does a composition * operation with the properties set inXRCompositeManager. */ diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackend.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackend.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackend.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackend.java @@ -30,6 +30,8 @@ * Currently there are two different backends implemented: * - XRBackendJava: And experimental backend, generating protocol directly using java-code and xcb's socket handoff functionality. * - XRBackendNative: Native 1:1 binding with libX11. + * - XRBackendDeferred: Deferrs protocol submission, so that aa tiles + * can be submitted in one go. */ import java.awt.geom.*; @@ -40,6 +42,8 @@ public interface XRBackend { + public void initResources(int parentXID); + public void freePicture(int picture); public void freePixmap(int pixmap); @@ -54,11 +58,10 @@ public void copyArea(int src, int dst, long gc, int srcx, int srcy, int width, int height, int dstx, int dsty); - - public void putMaskImage(int drawable, long gc, byte[] imageData, - int sx, int sy, int dx, int dy, - int width, int height, int maskOff, - int maskScan, float ea); + + public void maskedComposite(byte op, int src, int eaMask, int dst, + int srcX, int srcY, int dstX, int dstY, int width, + int height, int maskScan, int maskOff, byte[] mask, float ea); public void setGCClipRectangles(long gc, Region clip); diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java @@ -49,7 +49,29 @@ private static long FMTPTR_A8; private static long FMTPTR_ARGB32; private static long MASK_XIMG; + + private static final int AA_MASK_WIDTH = 128; + private static final int AA_MASK_HEIGHT = 64; + + static { + initIDs(); + } + int maskPicture; + int maskPixmap; + long maskGC; + + public XRBackendNative() { + + } + + public void initResources(int parentXID) { + maskPixmap = createPixmap(parentXID, 8, AA_MASK_WIDTH, AA_MASK_HEIGHT); + maskPicture = createPicture(maskPixmap, XRUtils.PictStandardA8); + maskGC = createGC(maskPixmap); + setGCExposures(maskGC, false); + } + private static native void initIDs(); public native long createGC(int drawable); @@ -272,6 +294,17 @@ glyphs.getArray(), elts.getSize(), glyphs.getSize()); } + + public void maskedComposite(byte op, int src, int eaMask, int dst, + int srcX, int srcY, int dstX, int dstY, int width, + int height, int maskScan, int maskOff, byte[] mask, float ea) { + if(mask == null) { + renderComposite(op, src, eaMask, dst, srcX, srcY, 0, 0, dstX, dstY, width, height); + } else { + putMaskImage(maskPixmap, maskGC, mask, 0, 0, 0, 0, width, height, maskOff, maskScan, ea); + renderComposite(op, src, maskPicture, dst, srcX, srcY, 0, 0, dstX, dstY, width, height); + } + } public void putMaskImage(int drawable, long gc, byte[] imageData, int sx, int sy, int dx, int dy, diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java @@ -82,7 +82,8 @@ private XRCompositeManager(XRSurfaceData surface) { con = new XRBackendNative(); - + con.initResources(surface.getXid()); + XRPaints.register(this); initResources(surface); @@ -215,6 +216,26 @@ con.renderComposite(compRule, cachedSrc, mask, dst, srcX, srcY, maskX, maskY, dstX, dstY, width, height); } + + public void XRMaskedComposite(int src, int dst, + int srcX, int srcY, int dstX, int dstY, int width, + int height, int maskScan, int maskOff, byte[] mask) { + + src = (src == XRUtils.None) ? getCurrentSource().picture : src; + + float maskAlpha = 1.0f; + int maskXid = XRUtils.None; + + if (mask != null) { + maskAlpha = isTexturePaintActive() ? getExtraAlpha() : 1.0f; + } else if (isTexturePaintActive()) { + maskXid = getExtraAlphaMask(); + } + + con.maskedComposite(compRule, src, maskXid, dst, + srcX, srcY, dstX, dstY, width, + height, maskScan, maskOff, mask, maskAlpha); + } public void XRRenderRectangles(XRSurfaceData dst, GrowableRectArray rects) { if (xorEnabled) { diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskBlit.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskBlit.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskBlit.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskBlit.java @@ -81,12 +81,8 @@ XRCompositeManager maskBuffer = x11sd.maskBuffer; XRSurfaceData x11dst = (XRSurfaceData) dst; x11dst.validateAsDestination(null, clip); - - int maskPict = maskBuffer.getMaskBuffer(). - uploadMask(width, height, maskscan, maskoff, mask); - maskBuffer.XRComposite(x11sd.getPicture(), maskPict, x11dst.getPicture(), - srcx, srcy, 0, 0, dstx, dsty, width, height); - maskBuffer.getMaskBuffer().clearUploadMask(maskPict, width, height); + + maskBuffer.XRMaskedComposite(XRUtils.None, x11sd.picture, srcx, srcy, dstx, dsty, width, height, maskscan, maskoff, mask); } finally { SunToolkit.awtUnlock(); } diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskFill.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskFill.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskFill.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskFill.java @@ -104,10 +104,7 @@ XRCompositeManager maskBuffer = x11sd.maskBuffer; maskBuffer.validateCompositeState(comp, sg2d.transform, sg2d.paint, sg2d); - - int maskPict = maskBuffer.getMaskBuffer().uploadMask(w, h, maskscan, maskoff, mask); - maskBuffer.XRComposite(XRUtils.None, maskPict, x11sd.picture, x, y, 0, 0, x, y, w, h); - maskBuffer.getMaskBuffer().clearUploadMask(maskPict, w, h); + maskBuffer.XRMaskedComposite(XRUtils.None, x11sd.picture, x, y, x, y, w, h, maskscan, maskoff, mask); } finally { SunToolkit.awtUnlock(); } # HG changeset patch # User linuxhippy@gmail.com # Date 1519157289 -3600 # Tue Feb 20 21:08:09 2018 +0100 # Node ID 27b3887567c2f7b8c9909003d4cec9aa6370c885 # Parent 622d9ad937095c2bc6baa96b1bcd24e262294d4e Xrender: Introduction of the deferred backend, allows for accumulated AA mask upload. diff --git a/configure b/configure deleted file mode 100644 --- a/configure +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2012, 2014, 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. -# - -# This is a thin wrapper which will call the real configure script, and -# make sure that is called using bash. - -# Get an absolute path to this script, since that determines the top-level directory. -this_script_dir=`dirname $0` -this_script_dir=`cd $this_script_dir > /dev/null && pwd` - -# Delegate to wrapper, forcing wrapper to believe $0 is this script by using -c. -# This trick is needed to get autoconf to co-operate properly. -# The ${-:+-$-} construction passes on bash options. -bash ${-:+-$-} -c ". $this_script_dir/make/autoconf/configure" $this_script_dir/configure CHECKME $this_script_dir "$@" diff --git a/make/lib/Awt2dLibraries.gmk b/make/lib/Awt2dLibraries.gmk --- a/make/lib/Awt2dLibraries.gmk +++ b/make/lib/Awt2dLibraries.gmk @@ -330,7 +330,7 @@ endif endif - LIBAWT_XAWT_LIBS := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm -lc + LIBAWT_XAWT_LIBS := $(LIBM) -lawt -lXext -lX11 -lXrender -lxcb -lX11-xcb $(LIBDL) -lXtst -lXi -ljava -ljvm -lc ifeq ($(OPENJDK_TARGET_OS), linux) LIBAWT_XAWT_LIBS += -lpthread diff --git a/make/mapfiles/libawt/mapfile-mawt-vers b/make/mapfiles/libawt/mapfile-mawt-vers --- a/make/mapfiles/libawt/mapfile-mawt-vers +++ b/make/mapfiles/libawt/mapfile-mawt-vers @@ -177,6 +177,15 @@ Java_sun_java2d_xr_XRBackendNative_setGCMode; Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; Java_sun_java2d_xr_XRUtils_initFormatPtrs; + Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; + Java_sun_java2d_xr_XRBackendDeferred_takeSocketNative; + Java_sun_java2d_xr_XRBackendDeferred_releaseSocketNative; + Java_sun_java2d_xr_XRBackendDeferred_issueSyncReq; + Java_sun_java2d_xr_XRBackendDeferred_generateXID; + Java_sun_java2d_xr_XRBackendDeferred_forceSocketReturn; + Java_sun_java2d_xr_XRBackendDeferred_nativeInit; + Java_sun_java2d_xr_AATileBufMan_initShmImage; + Java_sun_java2d_xr_AATileBufMan_pollForTileCompletion; XRT_DrawGlyphList; Java_sun_java2d_opengl_OGLContext_getOGLIdString; diff --git a/make/mapfiles/libawt_xawt/mapfile-vers b/make/mapfiles/libawt_xawt/mapfile-vers --- a/make/mapfiles/libawt_xawt/mapfile-vers +++ b/make/mapfiles/libawt_xawt/mapfile-vers @@ -408,7 +408,16 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative; Java_sun_java2d_xr_XRBackendNative_setGCMode; Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; - + Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; + Java_sun_java2d_xr_XRBackendDeferred_takeSocketNative; + Java_sun_java2d_xr_XRBackendDeferred_releaseSocketNative; + Java_sun_java2d_xr_XRBackendDeferred_issueSyncReq; + Java_sun_java2d_xr_XRBackendDeferred_generateXID; + Java_sun_java2d_xr_XRBackendDeferred_forceSocketReturn; + Java_sun_java2d_xr_XRBackendDeferred_nativeInit; + Java_sun_java2d_xr_AATileBufMan_initShmImage; + Java_sun_java2d_xr_AATileBufMan_pollForTileCompletion; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1arrow; Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box; Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box_1gap; diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/AATileBufMan.java b/src/java.desktop/unix/classes/sun/java2d/xr/AATileBufMan.java new file mode 100644 --- /dev/null +++ b/src/java.desktop/unix/classes/sun/java2d/xr/AATileBufMan.java @@ -0,0 +1,160 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package sun.java2d.xr; + +import java.awt.Color; +import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.LinkedList; + +/** + * + * @author ce + */ +public class AATileBufMan { + + private static int SHM_NUM_BUFFERS = 4; + private final static int TILE_BUF_WIDTH = 256; + private final static int TILE_BUF_HEIGHT = 256; + + ByteBuffer shmBuffer; + int shmBufferScan; + + AATileBuffer nonShmTile; + + AATileBuffer activeTile; + LinkedList idleShmMasks; + HashMap pendingShmMasks; + AATileBuffer fenceQueuePendingTile; + + int shmCnt; + int noShmCnt; + + int maskPicture; + int maskPixmap; + long maskGC; + + public AATileBufMan() { + idleShmMasks = new LinkedList<>(); + pendingShmMasks = new HashMap<>(); + + nonShmTile = new AATileBuffer(TILE_BUF_WIDTH, TILE_BUF_HEIGHT, TILE_BUF_WIDTH, 0, 0, ByteBuffer.allocateDirect(TILE_BUF_WIDTH * TILE_BUF_HEIGHT), false); + + String shmProp = System.getProperty("sun.java2d.xr.shm"); + + if(shmProp == null || shmProp.length() > 0 + && Character.toLowerCase(shmProp.charAt(0)) == 'f') { + if(System.getProperty("sun.java2d.shmBuffers") != null) { + SHM_NUM_BUFFERS = Integer.parseInt(System.getProperty("sun.java2d.shmBuffers")); + } + + if((shmBuffer = initShmImage(TILE_BUF_WIDTH, TILE_BUF_HEIGHT * SHM_NUM_BUFFERS)) != null) { + for(int i = 0; i < SHM_NUM_BUFFERS; i++) { + int tileYOffset = TILE_BUF_HEIGHT * i; + + shmBuffer.position(tileYOffset * shmBufferScan); + ByteBuffer tileBuffer = shmBuffer.slice(); + AATileBuffer aaShmBuf = new AATileBuffer(TILE_BUF_WIDTH, TILE_BUF_HEIGHT, shmBufferScan, tileYOffset, i + 1, tileBuffer, true); + idleShmMasks.add(aaShmBuf); + } + + } + + shmBuffer.position(0); + } + } + + public void initResources(XRBackendDeferred con, int parentXID) { + maskPixmap = con.createPixmap(parentXID, 8, TILE_BUF_WIDTH, TILE_BUF_HEIGHT); + maskPicture = con.createPicture(maskPixmap, XRUtils.PictStandardA8); + maskGC = con.createGC(maskPixmap); + con.setGCExposures(maskGC, false); + } + + + public AATileBuffer getActiveTileBuffer() { + if(activeTile != null) { + return activeTile; + } + + if(idleShmMasks.size() > 0) { + //System.out.println("shm tiles available: "+idleShmMasks.size()); + activeTile = idleShmMasks.removeLast(); + shmCnt++; + } else { + //System.out.println("shmtiles exhausted"); + activeTile = nonShmTile; + noShmCnt++; + } + + if(((shmCnt + noShmCnt) % 10000 == 0)) { + System.out.println("Shm: "+shmCnt+" noShm:"+noShmCnt); + } + + return activeTile; + } + + public void pollPendingFences() { + if(pendingShmMasks.size() > 0) { + java.util.Iterator shmSeqIt = pendingShmMasks.keySet().iterator(); + + while(shmSeqIt.hasNext()) { + long pendingSeq = shmSeqIt.next(); + + if(pollForTileCompletion(pendingSeq)) { + // System.out.println("Pending fence received: " + pendingSeq); + AATileBuffer idleBuffer = pendingShmMasks.get(pendingSeq); + // System.out.println("tile now available again: "+idleBuffer.getTileId()); + idleShmMasks.add(idleBuffer); + + shmSeqIt.remove(); + } + } + } + } + + public void registerFenceSeqForActiveTile(long seq) { + assert(fenceQueuePendingTile != null); + pendingShmMasks.put(seq, fenceQueuePendingTile); + // System.out.println("fence queued for tile: "+fenceQueuePendingTile.getTileId()); + fenceQueuePendingTile = null; + } + + + public void markActiveTileFlushed(boolean shmQueued) { + if(shmQueued) { + // pendingShmMasks.push(activeTile); + assert (fenceQueuePendingTile == null); + fenceQueuePendingTile = activeTile; + } else if(activeTile != nonShmTile) { + idleShmMasks.add(activeTile); + } + + activeTile.reset(); + activeTile = null; + } + + public boolean isFencePending() { + return fenceQueuePendingTile != null; + } + + public int getMaskPictureXid() { + return maskPicture; + } + + public long getMaskGCPtr() { + return maskGC; + } + + public int getMaskPixmapXid() { + return maskPixmap; + } + + private native ByteBuffer initShmImage(int width, int height); + + private native boolean pollForTileCompletion(long fenceSeq); + +} diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/AATileBuffer.java b/src/java.desktop/unix/classes/sun/java2d/xr/AATileBuffer.java new file mode 100644 --- /dev/null +++ b/src/java.desktop/unix/classes/sun/java2d/xr/AATileBuffer.java @@ -0,0 +1,131 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package sun.java2d.xr; + +import java.awt.Point; +import java.nio.ByteBuffer; + +/** + * + * @author ce + */ +public class AATileBuffer { + final int bufferWidth; + final int bufferHeight; + final int bufferScan; + int yOffset; + + ByteBuffer buffer; + int bufferId; + boolean shmCapable; + + int tileCount; + int currY; + int currX; + int currentRowHeight; + int maxRowWidth; + + public AATileBuffer(int bufferWidth, int bufferHeight, int bufferScan, int yOffset, int bufferId, ByteBuffer buffer, boolean shmCapable) { + this.bufferWidth = bufferWidth; + this.bufferHeight = bufferHeight; + this.bufferScan = bufferScan; + this.shmCapable = shmCapable; + + this.yOffset = yOffset; + this.bufferId = bufferId; + + this.buffer = buffer; + } + + public Point storeTile(int width, int height) { + int dstX; + + if(bufferHeight - currY - currentRowHeight < height) { + return null; + } + + if(bufferHeight - currX > width) { + dstX = currX; + currX += width; + currentRowHeight = Math.max(currentRowHeight, height); + maxRowWidth = Math.max(maxRowWidth, currX); + } else + { + dstX = 0; + currX = width; + currY += currentRowHeight; + currentRowHeight = height; + } + + tileCount++; + + return new Point(dstX, currY); + } + + public int getTileCount() { + return tileCount; + } + + public void reset() { + currX = 0; + currY = 0; + currentRowHeight = 0; + maxRowWidth = 0; + tileCount = 0; + } + + public Point getBufferBounds() { + return new Point(maxRowWidth, currY + currentRowHeight); + } + + public Point storeMaskTile(byte[] tileData, int width, int height, int maskOff, + int tileScan, float ea) { + + Point pt = storeTile(width, height); + if(pt == null) { + return null; + } + + /* + if(ea < 0.99804687f) { + for(int y=0; y < height; y++) { + for(int x = 0; x < width; x++) { + tileData[] + } + } + } */ + + for(int y=0; y < height; y++) { + int srcPos = tileScan * y + maskOff; + int dstPos = bufferScan * (pt.y + y) + pt.x; + + buffer.position(dstPos); + buffer.put(tileData, srcPos, width); + } + + return pt; + } + + public ByteBuffer getByteBuffer() { + return buffer; + } + + public int getBufferScan() { + return bufferScan; + } + + public int getYOffset() { + return yOffset; + } + + public boolean isShmCapable() { + return shmCapable; + } + + public int getBufferId() { + return bufferId; + } +} diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackend.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackend.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackend.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackend.java @@ -28,7 +28,6 @@ /** * XRender pipeline backend interface. * Currently there are two different backends implemented: - * - XRBackendJava: And experimental backend, generating protocol directly using java-code and xcb's socket handoff functionality. * - XRBackendNative: Native 1:1 binding with libX11. * - XRBackendDeferred: Deferrs protocol submission, so that aa tiles * can be submitted in one go. diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendDeferred.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendDeferred.java new file mode 100644 --- /dev/null +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendDeferred.java @@ -0,0 +1,550 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package sun.java2d.xr; + +import java.awt.Color; +import java.awt.Point; +import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import sun.java2d.pipe.Region; +import static sun.java2d.xr.XRUtils.XDoubleToFixed; + +/** + * + * @author ce + */ +public class XRBackendDeferred extends XRBackendNative { + + private static final byte RENDER_CHANGE_PICTURE = 5; + private static final byte RENDER_SET_PICTURE_CLIP_RECTANGLES = 6; + private static final byte RENDER_FREE_PICTURE = 7; + private static final byte RENDER_COMPOSITE = 8; + private static final byte RENDER_FILL_RECTANGLES = 26; + private static final byte RENDER_SET_PICTURE_TRANSFORM = 28; + private static final byte RENDER_SET_PICTURE_FILTER = 30; + private static final byte RENDER_COMPOSITE_GLYPH32 = 25; + private static final byte RENDER_CREATE_LINEAR_GRADIENT = 34; + private static final byte RENDER_CREATE_RADIAL_GRADIENT = 35; + private static final byte FREE_PIXMAP = 54; + + private static final int BUFFER_SIZE = 128*1024; + private static int RENDER_MAJOR_OPCODE; + + ByteBuffer buffer; + + boolean socketTaken; + int requestCounter; + int xcbReqSinceFlush; + + + AATileBufMan aaTileMan; + + //TODO: Check for RadialGradient Correctness + //TODO: Check for Text32 mask attribute + + public XRBackendDeferred() { + buffer = ByteBuffer.allocateDirect(BUFFER_SIZE); + buffer.order(ByteOrder.LITTLE_ENDIAN); + + nativeInit(buffer); + + socketTaken = false; + + aaTileMan = new AATileBufMan(); + } + + public void initResources(int parentXID) { + aaTileMan.initResources(this, parentXID); + } + + protected void takeSocket() { + if (!socketTaken) { + socketTaken = true; + + aaTileMan.pollPendingFences(); + + long shmFenceSeq = takeSocketNative(aaTileMan.isFencePending()); + if(shmFenceSeq != -1) { + aaTileMan.registerFenceSeqForActiveTile(shmFenceSeq); + } + + xcbReqSinceFlush = 0; + } + } + + protected void releaseSocket() { + if (socketTaken) { + flushBuffer(true); + socketTaken = false; + } + } + + protected void flushBuffer(boolean handoff) { + if (requestCounter > 0) { + AATileBuffer tileBuffer = aaTileMan.getActiveTileBuffer(); + + // if(System.getProperty("sun.java2d.debugxrdeferred") != null) { + // System.out.println("BufferFlush with AA tiles queued: " + tileBuffer.getTileCount() + " buffer: " + tileBuffer.getBufferBounds()); + // System.out.println("Flush xreq: "+xcbReqSinceFlush+ " req:"+requestCounter+" bytes: "+buffer.position()); + // } + + Point maskBufferBounds = tileBuffer.getBufferBounds(); + boolean shmMaskUsed = releaseSocketNative(requestCounter, buffer.position(), aaTileMan.getMaskPixmapXid(), aaTileMan.getMaskGCPtr(), maskBufferBounds.x, + maskBufferBounds.y, tileBuffer.getBufferScan(), tileBuffer.getYOffset() , tileBuffer.getByteBuffer(), tileBuffer.isShmCapable()); + + // System.out.println("was shm: " + shmMaskUsed); + + aaTileMan.markActiveTileFlushed(shmMaskUsed); + + buffer.clear(); + requestCounter = 0; + + if(!handoff) { + forceSocketReturn(); + } + } + } + + private native boolean releaseSocketNative(int requests, int bufferSize, int maskPixmap, long maskGC, int maskWidth, int maskHeight, int maskScan, int maskYOffset, ByteBuffer buffer, boolean isSHMTile); + + private native long takeSocketNative(boolean queueShmFence); + + private static native void forceSocketReturn(); + + private native void issueSyncReq(); + + private native int generateXID(); + + private native void nativeInit(ByteBuffer protoBuf); + + private void initNextRequest(int requestLength) { + takeSocket(); + + if (xcbReqSinceFlush > 65500) { + issueSyncReq(); + takeSocket(); + } + + int maskTilesQueued = aaTileMan.getActiveTileBuffer().getTileCount(); + if ((maskTilesQueued == 0 && buffer.position() > 4 * 1024) + || (buffer.position() + (requestLength * 4) > 128 * 1024)) { + flushBuffer(false); + } + + requestCounter++; + xcbReqSinceFlush++; + } + + @Override + public void renderRectangle(int dst, byte op, XRColor color, + int x, int y, int width, int height) { + + if(socketTaken) { + initNextRequest(7); + putRectHeader(dst, op, color, 7); + + buffer.putShort((short) x); + buffer.putShort((short) y); + buffer.putShort((short) width); + buffer.putShort((short) height); + } else { + super.renderRectangle(dst, op, color, x, y, width, height); + } + } + + @Override + public void renderRectangles(int dst, byte op, XRColor color, + GrowableRectArray rects) { + int reqLen = 5 + 2 * rects.getSize(); + + if (socketTaken && reqLen <= BUFFER_SIZE) { + initNextRequest(reqLen); + putRectHeader(dst, op, color, reqLen); + putRects(rects); + } else { + super.renderRectangles(dst, op, color, rects); + } + } + + @Override + public void setPictureRepeat(int picture, int repeat) { + if(socketTaken) { + initNextRequest(4); + + buffer.put((byte) RENDER_MAJOR_OPCODE); + buffer.put(RENDER_CHANGE_PICTURE); + buffer.putShort((short) 4); + + buffer.putInt(picture); + buffer.putInt(1); //CPRepeat + + buffer.putInt(repeat); + } else { + super.setPictureRepeat(picture, repeat); + } + } + + @Override + public void setFilter(int picture, int filter) { + if(socketTaken) { + initNextRequest(4); + + buffer.put((byte) RENDER_MAJOR_OPCODE); + buffer.put(RENDER_SET_PICTURE_FILTER); + buffer.putShort((short) 4); + + buffer.putInt(picture); + buffer.putShort((short) 4); //filtertLen + buffer.putShort((short) 0); //pad + + buffer.put(XRUtils.getFilterName(filter)); + }else { + super.setFilter(picture, filter); + } + } + + @Override + public void renderComposite(byte op, int src, int mask, + int dst, int srcX, int srcY, + int maskX, int maskY, int dstX, int dstY, + int width, int height) { + + if(socketTaken) { + initNextRequest(9); + + buffer.put((byte) RENDER_MAJOR_OPCODE); + buffer.put(RENDER_COMPOSITE); + buffer.putShort((short) 9); + buffer.put(op); //op + + //padding + buffer.put((byte) 0); + buffer.putShort((short) 0); + + buffer.putInt(src); + buffer.putInt(mask); + buffer.putInt(dst); + + buffer.putShort((short) srcX); + buffer.putShort((short) srcY); + buffer.putShort((short) maskX); + buffer.putShort((short) maskY); + buffer.putShort((short) dstX); + buffer.putShort((short) dstY); + buffer.putShort((short) width); + buffer.putShort((short) height); + } else { + super.renderComposite(op, src, mask, dst, srcX, srcY, maskX, maskY, dstX, dstY, width, height); + } + } + + @Override + public void maskedComposite(byte op, int src, int eaMask, int dst, + int srcX, int srcY, int dstX, int dstY, int width, + int height, int maskScan, int maskOff, byte[] mask, float ea) { + + if(mask == null) { + renderComposite(op, src, eaMask, dst, srcX, srcY, 0, 0, dstX, dstY, width, height); + } else { + AATileBuffer tileBuffer = aaTileMan.getActiveTileBuffer(); + + Point tilePos = tileBuffer.storeMaskTile(mask, width, height, maskOff, maskScan, ea); + + if(tilePos == null) { + flushBuffer(false); + maskedComposite(op, src, eaMask, dst, srcX, srcY, dstX, dstY, width, height, maskScan, maskOff, mask, ea); + return; + } + + // Taking the socket here ensures, we emit the XRenderComposite ourself + // so we can generate the XPutImage later when we have to hand the socket back to XCB + takeSocket(); + renderComposite(op, src, aaTileMan.getMaskPictureXid(), dst, srcX, srcY, tilePos.x, tilePos.y, dstX, dstY, width, height); + } + } + + + @Override + public void freePixmap(int pixmap) { + if(socketTaken) { + initNextRequest(2); + + buffer.put(FREE_PIXMAP); + buffer.put((byte) 0); + buffer.putShort((short) 2); + buffer.putInt(pixmap); + } else { + super.freePixmap(pixmap); + } + } + + @Override + public void freePicture(int picture) { + if(socketTaken) { + initNextRequest(2); + + buffer.put((byte) RENDER_MAJOR_OPCODE); + buffer.put(RENDER_FREE_PICTURE); + buffer.putShort((short) 2); + + buffer.putInt(picture); + } else { + super.freePicture(picture); + } + } + + @Override + public void setPictureTransform(int picture, AffineTransform transform) { + if(socketTaken) { + initNextRequest(11); + + buffer.put((byte) RENDER_MAJOR_OPCODE); + buffer.put(RENDER_SET_PICTURE_TRANSFORM); + buffer.putShort((short) 11); + + buffer.putInt(picture); + + buffer.putInt(XDoubleToFixed(transform.getScaleX())); + buffer.putInt(XDoubleToFixed(transform.getShearX())); + buffer.putInt(XDoubleToFixed(transform.getTranslateX())); + buffer.putInt(XDoubleToFixed(transform.getShearY())); + buffer.putInt(XDoubleToFixed(transform.getScaleY())); + buffer.putInt(XDoubleToFixed(transform.getTranslateY())); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(1 << 16); + } else { + super.setPictureTransform(picture, transform); + } + } + + @Override + public int createLinearGradient(Point2D p1, Point2D p2, float[] fractions, + int[] pixels, int repeat) { + int reqLen = 7 + fractions.length + 2 * pixels.length; + + if (socketTaken && reqLen < BUFFER_SIZE) { + + int xid = generateXID(); + + initNextRequest(reqLen); + + buffer.put((byte) RENDER_MAJOR_OPCODE); + buffer.put(RENDER_CREATE_LINEAR_GRADIENT); + buffer.putShort((short) reqLen); + + buffer.putInt(xid); + + buffer.putInt(XDoubleToFixed(p1.getX())); + buffer.putInt(XDoubleToFixed(p1.getY())); + buffer.putInt(XDoubleToFixed(p2.getX())); + buffer.putInt(XDoubleToFixed(p2.getY())); + + putFractions(fractions); + + putPixels(pixels); + + return xid; + } else { + return super.createLinearGradient(p1, p2, fractions, pixels, repeat); + } + } + + @Override + public int createRadialGradient(float centerX, float centerY, + float innerRadius, float outerRadius, + float[] fractions, int[] pixels, int repeat) { + + int reqLen = 8 + fractions.length + 2 * pixels.length; + + if (socketTaken && reqLen < BUFFER_SIZE) { + int xid = generateXID(); + + initNextRequest(reqLen); + + buffer.put((byte) RENDER_MAJOR_OPCODE); + buffer.put(RENDER_CREATE_RADIAL_GRADIENT); + buffer.putShort((short) reqLen); + + buffer.putInt(xid); + + //inner + buffer.putInt(XDoubleToFixed(centerX)); + buffer.putInt(XDoubleToFixed(centerY)); + //outer + buffer.putInt(XDoubleToFixed(centerX)); + buffer.putInt(XDoubleToFixed(centerY)); + + buffer.putInt(XDoubleToFixed(innerRadius)); + buffer.putInt(XDoubleToFixed(outerRadius)); + + putFractions(fractions); + putPixels(pixels); + + return xid; + } else { + return super.createRadialGradient(centerX, centerY, innerRadius, outerRadius, fractions, pixels, repeat); + } + } + + // @Override + public void XRenderCompositeText(byte op, int src, int dst, + int maskFormatID, + int sx, int sy, int dx, int dy, + int glyphset, GrowableEltArray elts) { + + if(!socketTaken) { + super.XRenderCompositeText(op, src, dst, maskFormatID, sx, sy, dx, dy, glyphset, elts); + return; + } + + // super.XRenderCompositeText(op, src, dst, maskFormatID, sx, sy, dx, dy, glyphset, elts); + int len = 7 + elts.getGlyphs().getSize() + elts.getSize() * 2; + int activeGlyphSet = elts.getGlyphSet(0); + + //calculate request length + for (int elt = 0; elt < elts.getSize(); elt++) { + int newGlyphSet = elts.getGlyphSet(elt); + if (activeGlyphSet != newGlyphSet) { + len += 3; + } + } + activeGlyphSet = elts.getGlyphSet(0); + + if (len <= BUFFER_SIZE) { + initNextRequest(len); + + buffer.put((byte) RENDER_MAJOR_OPCODE); + buffer.put(RENDER_COMPOSITE_GLYPH32); + buffer.putShort((short) len); + + //TODO: Implement glyphset change!top + buffer.put(op); //op + + //padding + buffer.put((byte) 0); + buffer.putShort((short) 0); + + buffer.putInt(src); + buffer.putInt(dst); + buffer.putInt(0); + + buffer.putInt(activeGlyphSet); + + buffer.putShort(XRUtils.clampToShort(sx)); + buffer.putShort(XRUtils.clampToShort(sy)); + + int glyphsWritten = 0; + + for (int elt = 0; elt < elts.getSize(); elt++) { + int newGlyphSet = elts.getGlyphSet(elt); + if (activeGlyphSet != newGlyphSet) { + putGlyphSet(255, 0, 0); + buffer.putInt(newGlyphSet); + } + + putGlyphSet(elts.getCharCnt(elt), elts.getXOff(elt), elts.getYOff(elt)); + + for (int g = 0; g < elts.getCharCnt(elt); g++) { + buffer.putInt(elts.getGlyphs().getInt(glyphsWritten++)); + } + } + } else { + super.XRenderCompositeText(op, src, dst, maskFormatID, sx, sy, dx, dy, glyphset, elts); + } + } + + @Override + public void setClipRectangles(int picture, Region clip) { + if (socketTaken && clip == null) { + XRSetClipRectangle(picture, 0, 0, 32767, 32767); + } else if (socketTaken && clip.isRectangular()) { + XRSetClipRectangle(picture, clip.getLoX(), clip.getLoY(), + clip.getHiX(), clip.getHiY()); + } else { + super.setClipRectangles(picture, clip); + } + } + + private void putFractions(float[] fractions) { + buffer.putInt(fractions.length); + for (int i = 0; i < fractions.length; i++) { + buffer.putInt(XRUtils.XDoubleToFixed(fractions[i])); + } + } + + private void putPixels(int[] pixels) { + for (int i = 0; i < pixels.length; i++) { + XRColor c = new XRColor(); + c.setColorValues(pixels[i]); + buffer.putShort((short) c.red); + buffer.putShort((short) c.green); + buffer.putShort((short) c.blue); + buffer.putShort((short) c.alpha); + } + } + + private void putGlyphSet(int charCnt, int xOff, int yOff) { + buffer.put((byte) charCnt); + //padding + buffer.put((byte) 0); + buffer.putShort((short) 0); + + buffer.putShort((short) xOff); + buffer.putShort((short) yOff); + } + + private void XRSetClipRectangle(int picture, int x, int y, int x2, int y2) { + initNextRequest(5); + + // System.out.println("Set clip: "+x+"/"+y+" "+width+"/"+height); + buffer.put((byte) RENDER_MAJOR_OPCODE); + buffer.put(RENDER_SET_PICTURE_CLIP_RECTANGLES); + buffer.putShort((short) 5); + + buffer.putInt(picture); + buffer.putShort((short) 0); + buffer.putShort((short) 0); + + buffer.putShort(XRUtils.clampToShort(x)); + buffer.putShort(XRUtils.clampToShort(y)); + buffer.putShort((short) XRUtils.clampToUShort((x2 - x))); + buffer.putShort((short) XRUtils.clampToUShort((y2 - y))); + } + + private void putRectHeader(int dst, byte op, XRColor color, int reqLen) { + buffer.put((byte) RENDER_MAJOR_OPCODE); + buffer.put(RENDER_FILL_RECTANGLES); + buffer.putShort((short) reqLen); + buffer.put(op); //op + + //padding + buffer.put((byte) 0); + buffer.putShort((short) 0); + + buffer.putInt(dst); + + putXRColor(color); + } + + private void putRects(GrowableRectArray rects) { + for (int i = 0; i < rects.getSize(); i++) { + buffer.putShort((short) rects.getX(i)); + buffer.putShort((short) rects.getY(i)); + buffer.putShort((short) rects.getWidth(i)); + buffer.putShort((short) rects.getHeight(i)); + } + } + + private void putXRColor(XRColor color) { + buffer.putShort((short) color.red); + buffer.putShort((short) color.green); + buffer.putShort((short) color.blue); + buffer.putShort((short) color.alpha); + } +} diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java @@ -41,11 +41,6 @@ */ public class XRBackendNative implements XRBackend { - - static { - initIDs(); - } - private static long FMTPTR_A8; private static long FMTPTR_ARGB32; private static long MASK_XIMG; diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java @@ -81,9 +81,17 @@ } private XRCompositeManager(XRSurfaceData surface) { - con = new XRBackendNative(); - con.initResources(surface.getXid()); - + String defProp = System.getProperty("sun.java2d.xr.deferred"); + + if(defProp != null && defProp.length() > 0 + && Character.toLowerCase(defProp.charAt(0)) == 't') { + con = new XRBackendDeferred(); + } else { + con = new XRBackendNative(); + } + + con.initResources(surface.getXid()); + XRPaints.register(this); initResources(surface); diff --git a/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendDeferred.c b/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendDeferred.c new file mode 100644 --- /dev/null +++ b/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendDeferred.c @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2010, 2016, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +#include "X11SurfaceData.h" +#include + +#include +#include +#include + +#include +#include +#include + +JavaVM *jvm; +jobject backendObj; +jmethodID releaseSocketMID; + +xcb_connection_t* xcbCon; +void* protBufPtr; + +jint shmMajor; + +XImage *ximg; +XShmSegmentInfo *shminfo; + +static void returnSocketCB(void *closure) +{ + JNIEnv *env; + (*jvm)->AttachCurrentThread(jvm, (void **)&env, NULL); + (*env)->CallVoidMethod(env, backendObj, releaseSocketMID); +} + +JNIEXPORT jboolean JNICALL +Java_sun_java2d_xr_XRBackendDeferred_nativeInit + (JNIEnv *env, jobject this, jobject protoBuf) { + int status = (*env)->GetJavaVM(env, &jvm); + if(status != 0) { + return JNI_FALSE; + } + + jclass cls = (*env)->GetObjectClass(env, this); + + releaseSocketMID = (*env)->GetMethodID(env, cls, "releaseSocket", "()V"); + if (releaseSocketMID == NULL) { + return JNI_FALSE; + } + + jfieldID renderMajorID = (*env)->GetStaticFieldID(env, cls, "RENDER_MAJOR_OPCODE", "I"); + if (renderMajorID == NULL) { + return JNI_FALSE; + } + + int major_opcode, first_event, first_error; + XQueryExtension(awt_display, "RENDER", &major_opcode, &first_event, &first_error); + + xcbCon = XGetXCBConnection(awt_display); + protBufPtr = (*env)->GetDirectBufferAddress(env, protoBuf); + backendObj = (jobject) (*env)->NewGlobalRef(env, this); + (*env)->SetStaticIntField(env, cls, renderMajorID, (jint) major_opcode); + + return JNI_TRUE; +} + +JNIEXPORT void JNICALL +Java_sun_java2d_xr_XRBackendDeferred_issueSyncReq + (JNIEnv *env, jobject this) { + xcb_discard_reply(xcbCon, xcb_get_input_focus(xcbCon).sequence); +} + +JNIEXPORT jint JNICALL +Java_sun_java2d_xr_XRBackendDeferred_generateXID + (JNIEnv *env, jobject this) { + return (jint) xcb_generate_id(xcbCon); +} + +JNIEXPORT void JNICALL +Java_sun_java2d_xr_XRBackendDeferred_forceSocketReturn(JNIEnv *env, jclass cls) { + XNoOp(awt_display); +} + +JNIEXPORT jlong JNICALL +Java_sun_java2d_xr_XRBackendDeferred_takeSocketNative + (JNIEnv *env, jobject this, jboolean queueFence) { + uint32_t flags = 0; + uint64_t sent; + + // A XGetInputFocus event is used to get notified about completion + // of XShmPutImage operations, to know when the XServer has finished + // accessing a certain SHM area and we can start writing to it again. + // However, we can only use xcb's event handling when xcb has taken + // the socket, so we actually queue the event of a previous XShmPutImage + // only after we request the socket the next time. + jlong fenceSeq = -1; + if(queueFence) { + fenceSeq = xcb_get_input_focus(xcbCon).sequence; + } + + xcb_take_socket(xcbCon, &returnSocketCB, &flags, flags, &sent); + + return fenceSeq; +} + +JNIEXPORT jboolean JNICALL +Java_sun_java2d_xr_XRBackendDeferred_releaseSocketNative + (JNIEnv *env, jobject this, jint requestCnt, jint writtenBytes, jint maskPixmap, jlong maskGC, jint maskWidth, jint maskHeight, jint maskScan, jint maskYOffset, jobject directMaskBuffer, jboolean isShmBuffer) { + uint8_t getInputFocusReq[4]; + getInputFocusReq[0] = 43; + getInputFocusReq[1] = 0; + getInputFocusReq[2] = 1; + getInputFocusReq[3] = 0; + + int paddedWidth = maskWidth + (4 - (maskWidth % 4)); + + // no mask to upload + if(maskWidth == 0) { + struct iovec vects[2]; + vects[0].iov_base = getInputFocusReq; + vects[0].iov_len = 4; + vects[1].iov_base = protBufPtr; + vects[1].iov_len = writtenBytes; + xcb_writev(xcbCon, &vects[1], 1, requestCnt + 0); + } else if(maskWidth * maskHeight <= 8192 || !isShmBuffer) + { + // mask upload using XPutImage - in case the mask is not + // shm capable or there is too little data to upload to + // make the extra overhead of shm buffer handling + // (socket handoff + event) worthwhile. + + struct iovec* vects = (struct iovec*) malloc(sizeof(struct iovec) * (maskHeight + 3)); + if(vects == NULL) { + return -1; + } + + uint8_t* maskBufferAddr = (*env)->GetDirectBufferAddress(env, directMaskBuffer); + + vects[0].iov_base = getInputFocusReq; + vects[0].iov_len = 4; + + //TODO: Include some heuristic to round to buffer width if not too far away + uint8_t putImgReqHeader8[24]; + putImgReqHeader8[0] = 72; //XPutImage + putImgReqHeader8[1] = 2; //ZImage + *((uint16_t*) &putImgReqHeader8[2]) = 6 + (paddedWidth * maskHeight) / 4; //len in 32-bit words + *((uint32_t*) &putImgReqHeader8[4]) = maskPixmap; + *((uint32_t*) &putImgReqHeader8[8]) = (uint32_t) XGContextFromGC((GC) jlong_to_ptr(maskGC)); + *((uint16_t*) &putImgReqHeader8[12]) = paddedWidth; + *((uint16_t*) &putImgReqHeader8[14]) = maskHeight; + *((uint16_t*) &putImgReqHeader8[16]) = 0; //dstX + *((uint16_t*) &putImgReqHeader8[18]) = 0; //dstY + putImgReqHeader8[20] = 0; //pad + putImgReqHeader8[21] = 8; //depth + *((uint16_t*) &putImgReqHeader8[22]) = 0; //pad + + //XPutImage Request + vects[1].iov_base = putImgReqHeader8; + vects[1].iov_len = 24; + + for(int y = 0; y < maskHeight; y++) { + vects[y + 2].iov_base = maskBufferAddr + (y * maskScan); + vects[y + 2].iov_len = paddedWidth; + } + + vects[maskHeight + 2].iov_base = protBufPtr; + vects[maskHeight + 2].iov_len = writtenBytes; + + xcb_writev(xcbCon, &vects[1], maskHeight + 2, requestCnt + 1); + + free(vects); + } else { + struct iovec vects[3]; + vects[0].iov_base = getInputFocusReq; + vects[0].iov_len = 4; + + uint8_t shmPutImgReq[40]; + shmPutImgReq[0] = shmMajor; + shmPutImgReq[1] = 3; //shmPutImage + *((uint16_t*) &shmPutImgReq[2]) = 10; //req length + *((uint32_t*) &shmPutImgReq[4]) = maskPixmap; + *((uint32_t*) &shmPutImgReq[8]) = (uint32_t) XGContextFromGC((GC) jlong_to_ptr(maskGC)); + *((uint16_t*) &shmPutImgReq[12]) = ximg->width; + *((uint16_t*) &shmPutImgReq[14]) = ximg->height; + *((uint16_t*) &shmPutImgReq[16]) = 0; //srcX + *((uint16_t*) &shmPutImgReq[18]) = maskYOffset; //srcY + *((uint16_t*) &shmPutImgReq[20]) = paddedWidth; //src_width + *((uint16_t*) &shmPutImgReq[22]) = maskHeight; //src_height + *((uint16_t*) &shmPutImgReq[24]) = 0; //dstX + *((uint16_t*) &shmPutImgReq[26]) = 0; //dstY + shmPutImgReq[28] = 8; //Depth + shmPutImgReq[29] = 2; //ZImage + shmPutImgReq[30] = 0; //SendEvent + shmPutImgReq[31] = 0; //Pad + *((uint32_t*) &shmPutImgReq[32]) = shminfo->shmseg; + *((uint32_t*) &shmPutImgReq[36]) = ximg->data - shminfo->shmaddr; + + //XShmPutImage + vects[1].iov_base = shmPutImgReq; + vects[1].iov_len = 40; + + vects[2].iov_base = protBufPtr; + vects[2].iov_len = writtenBytes; + xcb_writev(xcbCon, &vects[1], 2, requestCnt + 1); + + return JNI_TRUE; + } + + + return JNI_FALSE; +} + +JNIEXPORT jboolean JNICALL +Java_sun_java2d_xr_AATileBufMan_pollForTileCompletion + (JNIEnv *env, jclass this, jlong fenceSeq) { + void* fenceReply; + + if(xcb_poll_for_reply(xcbCon, (unsigned int) fenceSeq, &fenceReply, NULL) > 0) { + free(fenceReply); + return JNI_TRUE; + } + + return JNI_FALSE; + } + +JNIEXPORT jobject JNICALL +Java_sun_java2d_xr_AATileBufMan_initShmImage + (JNIEnv *env, jobject this, jint width, jint height) { + ximg = NULL; + shminfo = NULL; + + jclass cls = (*env)->GetObjectClass(env, this); + + int first_event, first_error; + if(!XQueryExtension(awt_display, "MIT-SHM", &shmMajor, &first_event, &first_error)) { + return NULL; + } + + jfieldID bufferScanID = (*env)->GetFieldID(env, cls, "shmBufferScan", "I"); + if (bufferScanID == NULL) { + return NULL; + } + + shminfo = malloc(sizeof(XShmSegmentInfo)); + ximg = XShmCreateImage(awt_display, NULL, 8, ZPixmap, NULL, shminfo, width, height); + + if(!ximg) { + fprintf(stderr, "XShmCreateImage XShm problems\n"); + return NULL; + } + + if((shminfo->shmid = shmget(IPC_PRIVATE, ximg->bytes_per_line * ximg->height, IPC_CREAT | 0777)) == -1){ + fprintf(stderr, "shmget XShm problems\n"); + return NULL; + } + if((shminfo->shmaddr = ximg->data = shmat(shminfo->shmid, 0, 0)) == (void *)-1){ + fprintf(stderr, "shmat XShm problems\n"); + return NULL; + } + shminfo->readOnly = False; + if(!XShmAttach(awt_display, shminfo)){ + fprintf(stderr, "XShmAttach XShm problems, falling back to to XImage\n"); + return NULL; + } + + (*env)->SetIntField(env, this, bufferScanID, ximg->bytes_per_line); + + return (*env)->NewDirectByteBuffer(env, ximg->data, ximg->bytes_per_line * ximg->height); + } + + diff --git a/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c b/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c --- a/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c +++ b/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c @@ -331,7 +331,6 @@ #endif /* !HEADLESS */ } - JNIEXPORT void JNICALL Java_sun_java2d_xr_XRBackendNative_initIDs(JNIEnv *env, jclass cls) { char *maskData; # HG changeset patch # User linuxhippy@gmail.com # Date 1519202222 -3600 # Wed Feb 21 09:37:02 2018 +0100 # Node ID 83aaa0c91a6eb63dab61e6cd0848488b216983ba # Parent 27b3887567c2f7b8c9909003d4cec9aa6370c885 Xrender: move heuristics whether to upload using shm/no-shm PutImage from native to java diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/AATileBufMan.java b/src/java.desktop/unix/classes/sun/java2d/xr/AATileBufMan.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/AATileBufMan.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/AATileBufMan.java @@ -41,7 +41,7 @@ idleShmMasks = new LinkedList<>(); pendingShmMasks = new HashMap<>(); - nonShmTile = new AATileBuffer(TILE_BUF_WIDTH, TILE_BUF_HEIGHT, TILE_BUF_WIDTH, 0, 0, ByteBuffer.allocateDirect(TILE_BUF_WIDTH * TILE_BUF_HEIGHT), false); + nonShmTile = new AATileBuffer(this, TILE_BUF_WIDTH, TILE_BUF_HEIGHT, TILE_BUF_WIDTH, 0, 0, ByteBuffer.allocateDirect(TILE_BUF_WIDTH * TILE_BUF_HEIGHT), false); String shmProp = System.getProperty("sun.java2d.xr.shm"); @@ -57,7 +57,7 @@ shmBuffer.position(tileYOffset * shmBufferScan); ByteBuffer tileBuffer = shmBuffer.slice(); - AATileBuffer aaShmBuf = new AATileBuffer(TILE_BUF_WIDTH, TILE_BUF_HEIGHT, shmBufferScan, tileYOffset, i + 1, tileBuffer, true); + AATileBuffer aaShmBuf = new AATileBuffer(this, TILE_BUF_WIDTH, TILE_BUF_HEIGHT, shmBufferScan, tileYOffset, i + 1, tileBuffer, true); idleShmMasks.add(aaShmBuf); } @@ -116,7 +116,7 @@ } } - public void registerFenceSeqForActiveTile(long seq) { + public void registerFenceSeqForActiveBuffer(long seq) { assert(fenceQueuePendingTile != null); pendingShmMasks.put(seq, fenceQueuePendingTile); // System.out.println("fence queued for tile: "+fenceQueuePendingTile.getTileId()); @@ -124,7 +124,7 @@ } - public void markActiveTileFlushed(boolean shmQueued) { + public void markActiveBufferFlushed(boolean shmQueued) { if(shmQueued) { // pendingShmMasks.push(activeTile); assert (fenceQueuePendingTile == null); @@ -136,6 +136,10 @@ activeTile.reset(); activeTile = null; } + + public int getIdleShmBufferCnt() { + return idleShmMasks.size(); + } public boolean isFencePending() { return fenceQueuePendingTile != null; diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/AATileBuffer.java b/src/java.desktop/unix/classes/sun/java2d/xr/AATileBuffer.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/AATileBuffer.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/AATileBuffer.java @@ -13,14 +13,18 @@ * @author ce */ public class AATileBuffer { + private final static int SHM_THRESHOLD = 8192; + private final static int SHM_THRESHOLD2 = 16384; + final int bufferWidth; final int bufferHeight; final int bufferScan; - int yOffset; + final int yOffset; - ByteBuffer buffer; - int bufferId; - boolean shmCapable; + final AATileBufMan bufMan; + final ByteBuffer buffer; + final int bufferId; + final boolean shmCapable; int tileCount; int currY; @@ -28,8 +32,9 @@ int currentRowHeight; int maxRowWidth; - public AATileBuffer(int bufferWidth, int bufferHeight, int bufferScan, int yOffset, int bufferId, ByteBuffer buffer, boolean shmCapable) { - this.bufferWidth = bufferWidth; + public AATileBuffer(AATileBufMan bufMan, int bufferWidth, int bufferHeight, int bufferScan, int yOffset, int bufferId, ByteBuffer buffer, boolean shmCapable) { + this.bufMan = bufMan; + this.bufferWidth = bufferWidth; this.bufferHeight = bufferHeight; this.bufferScan = bufferScan; this.shmCapable = shmCapable; @@ -125,6 +130,15 @@ return shmCapable; } + public boolean isUploadWithShmProfitable() { + int pixelsOccupied = maxRowWidth * (currY + currentRowHeight); + + // in case only one shm capable buffer is left, set the treshold higher + // so we save the shm buffer for larger uploads later + return ((bufMan.getIdleShmBufferCnt() > 1 && pixelsOccupied >= SHM_THRESHOLD) + || pixelsOccupied >= SHM_THRESHOLD2) && shmCapable; + } + public int getBufferId() { return bufferId; } diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendDeferred.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendDeferred.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendDeferred.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendDeferred.java @@ -70,7 +70,7 @@ long shmFenceSeq = takeSocketNative(aaTileMan.isFencePending()); if(shmFenceSeq != -1) { - aaTileMan.registerFenceSeqForActiveTile(shmFenceSeq); + aaTileMan.registerFenceSeqForActiveBuffer(shmFenceSeq); } xcbReqSinceFlush = 0; @@ -94,12 +94,14 @@ // } Point maskBufferBounds = tileBuffer.getBufferBounds(); - boolean shmMaskUsed = releaseSocketNative(requestCounter, buffer.position(), aaTileMan.getMaskPixmapXid(), aaTileMan.getMaskGCPtr(), maskBufferBounds.x, - maskBufferBounds.y, tileBuffer.getBufferScan(), tileBuffer.getYOffset() , tileBuffer.getByteBuffer(), tileBuffer.isShmCapable()); + boolean useShmPutImg = tileBuffer.isUploadWithShmProfitable(); + + releaseSocketNative(requestCounter, buffer.position(), aaTileMan.getMaskPixmapXid(), aaTileMan.getMaskGCPtr(), maskBufferBounds.x, + maskBufferBounds.y, tileBuffer.getBufferScan(), tileBuffer.getYOffset(), useShmPutImg, tileBuffer.getByteBuffer()); // System.out.println("was shm: " + shmMaskUsed); - aaTileMan.markActiveTileFlushed(shmMaskUsed); + aaTileMan.markActiveBufferFlushed(useShmPutImg); buffer.clear(); requestCounter = 0; @@ -110,7 +112,7 @@ } } - private native boolean releaseSocketNative(int requests, int bufferSize, int maskPixmap, long maskGC, int maskWidth, int maskHeight, int maskScan, int maskYOffset, ByteBuffer buffer, boolean isSHMTile); + private native void releaseSocketNative(int requests, int bufferSize, int maskPixmap, long maskGC, int maskWidth, int maskHeight, int maskScan, int maskYOffset, boolean useShmPutImage, ByteBuffer buffer); private native long takeSocketNative(boolean queueShmFence); diff --git a/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendDeferred.c b/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendDeferred.c --- a/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendDeferred.c +++ b/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendDeferred.c @@ -123,9 +123,10 @@ return fenceSeq; } -JNIEXPORT jboolean JNICALL +JNIEXPORT void JNICALL Java_sun_java2d_xr_XRBackendDeferred_releaseSocketNative - (JNIEnv *env, jobject this, jint requestCnt, jint writtenBytes, jint maskPixmap, jlong maskGC, jint maskWidth, jint maskHeight, jint maskScan, jint maskYOffset, jobject directMaskBuffer, jboolean isShmBuffer) { + (JNIEnv *env, jobject this, jint requestCnt, jint writtenBytes, jint maskPixmap, jlong maskGC, jint maskWidth, jint maskHeight, jint maskScan, + jint maskYOffset, jboolean useShmPutImage, jobject directMaskBuffer) { uint8_t getInputFocusReq[4]; getInputFocusReq[0] = 43; getInputFocusReq[1] = 0; @@ -142,54 +143,8 @@ vects[1].iov_base = protBufPtr; vects[1].iov_len = writtenBytes; xcb_writev(xcbCon, &vects[1], 1, requestCnt + 0); - } else if(maskWidth * maskHeight <= 8192 || !isShmBuffer) + } else if(useShmPutImage) { - // mask upload using XPutImage - in case the mask is not - // shm capable or there is too little data to upload to - // make the extra overhead of shm buffer handling - // (socket handoff + event) worthwhile. - - struct iovec* vects = (struct iovec*) malloc(sizeof(struct iovec) * (maskHeight + 3)); - if(vects == NULL) { - return -1; - } - - uint8_t* maskBufferAddr = (*env)->GetDirectBufferAddress(env, directMaskBuffer); - - vects[0].iov_base = getInputFocusReq; - vects[0].iov_len = 4; - - //TODO: Include some heuristic to round to buffer width if not too far away - uint8_t putImgReqHeader8[24]; - putImgReqHeader8[0] = 72; //XPutImage - putImgReqHeader8[1] = 2; //ZImage - *((uint16_t*) &putImgReqHeader8[2]) = 6 + (paddedWidth * maskHeight) / 4; //len in 32-bit words - *((uint32_t*) &putImgReqHeader8[4]) = maskPixmap; - *((uint32_t*) &putImgReqHeader8[8]) = (uint32_t) XGContextFromGC((GC) jlong_to_ptr(maskGC)); - *((uint16_t*) &putImgReqHeader8[12]) = paddedWidth; - *((uint16_t*) &putImgReqHeader8[14]) = maskHeight; - *((uint16_t*) &putImgReqHeader8[16]) = 0; //dstX - *((uint16_t*) &putImgReqHeader8[18]) = 0; //dstY - putImgReqHeader8[20] = 0; //pad - putImgReqHeader8[21] = 8; //depth - *((uint16_t*) &putImgReqHeader8[22]) = 0; //pad - - //XPutImage Request - vects[1].iov_base = putImgReqHeader8; - vects[1].iov_len = 24; - - for(int y = 0; y < maskHeight; y++) { - vects[y + 2].iov_base = maskBufferAddr + (y * maskScan); - vects[y + 2].iov_len = paddedWidth; - } - - vects[maskHeight + 2].iov_base = protBufPtr; - vects[maskHeight + 2].iov_len = writtenBytes; - - xcb_writev(xcbCon, &vects[1], maskHeight + 2, requestCnt + 1); - - free(vects); - } else { struct iovec vects[3]; vects[0].iov_base = getInputFocusReq; vects[0].iov_len = 4; @@ -222,12 +177,54 @@ vects[2].iov_base = protBufPtr; vects[2].iov_len = writtenBytes; xcb_writev(xcbCon, &vects[1], 2, requestCnt + 1); - - return JNI_TRUE; + } else { + // mask upload using XPutImage - in case the mask is not + // shm capable or there is too little data to upload to + // make the extra overhead of shm buffer handling + // (socket handoff + event) worthwhile. + + struct iovec* vects = (struct iovec*) malloc(sizeof(struct iovec) * (maskHeight + 3)); + if(vects == NULL) { + return; + } + + uint8_t* maskBufferAddr = (*env)->GetDirectBufferAddress(env, directMaskBuffer); + + vects[0].iov_base = getInputFocusReq; + vects[0].iov_len = 4; + + //TODO: Include some heuristic to round to buffer width if not too far away + // and send the data with a single iovec in this case + uint8_t putImgReqHeader8[24]; + putImgReqHeader8[0] = 72; //XPutImage + putImgReqHeader8[1] = 2; //ZImage + *((uint16_t*) &putImgReqHeader8[2]) = 6 + (paddedWidth * maskHeight) / 4; //len in 32-bit words + *((uint32_t*) &putImgReqHeader8[4]) = maskPixmap; + *((uint32_t*) &putImgReqHeader8[8]) = (uint32_t) XGContextFromGC((GC) jlong_to_ptr(maskGC)); + *((uint16_t*) &putImgReqHeader8[12]) = paddedWidth; + *((uint16_t*) &putImgReqHeader8[14]) = maskHeight; + *((uint16_t*) &putImgReqHeader8[16]) = 0; //dstX + *((uint16_t*) &putImgReqHeader8[18]) = 0; //dstY + putImgReqHeader8[20] = 0; //pad + putImgReqHeader8[21] = 8; //depth + *((uint16_t*) &putImgReqHeader8[22]) = 0; //pad + + //XPutImage Request + vects[1].iov_base = putImgReqHeader8; + vects[1].iov_len = 24; + + for(int y = 0; y < maskHeight; y++) { + vects[y + 2].iov_base = maskBufferAddr + (y * maskScan); + vects[y + 2].iov_len = paddedWidth; + } + + vects[maskHeight + 2].iov_base = protBufPtr; + vects[maskHeight + 2].iov_len = writtenBytes; + + xcb_writev(xcbCon, &vects[1], maskHeight + 2, requestCnt + 1); + + free(vects); } - - - return JNI_FALSE; } JNIEXPORT jboolean JNICALL # HG changeset patch # User linuxhippy@gmail.com # Date 1519203374 -3600 # Wed Feb 21 09:56:14 2018 +0100 # Node ID cb67b4213039ba18514ffbbd3ce8a02d65c01197 # Parent 83aaa0c91a6eb63dab61e6cd0848488b216983ba Xrender: Perform Ximg allocation for tile upload only for non-deferred mode diff --git a/make/mapfiles/libawt/mapfile-mawt-vers b/make/mapfiles/libawt/mapfile-mawt-vers --- a/make/mapfiles/libawt/mapfile-mawt-vers +++ b/make/mapfiles/libawt/mapfile-mawt-vers @@ -176,6 +176,7 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative; Java_sun_java2d_xr_XRBackendNative_setGCMode; Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; + Java_sun_java2d_xr_XRBackendNative_initDefaultAAXImg; Java_sun_java2d_xr_XRUtils_initFormatPtrs; Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; Java_sun_java2d_xr_XRBackendDeferred_takeSocketNative; diff --git a/make/mapfiles/libawt_xawt/mapfile-vers b/make/mapfiles/libawt_xawt/mapfile-vers --- a/make/mapfiles/libawt_xawt/mapfile-vers +++ b/make/mapfiles/libawt_xawt/mapfile-vers @@ -409,6 +409,7 @@ Java_sun_java2d_xr_XRBackendNative_setGCMode; Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; + Java_sun_java2d_xr_XRBackendNative_initDefaultAAXImg; Java_sun_java2d_xr_XRBackendDeferred_takeSocketNative; Java_sun_java2d_xr_XRBackendDeferred_releaseSocketNative; Java_sun_java2d_xr_XRBackendDeferred_issueSyncReq; diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java @@ -43,7 +43,7 @@ public class XRBackendNative implements XRBackend { private static long FMTPTR_A8; private static long FMTPTR_ARGB32; - private static long MASK_XIMG; + private static long ximgPtr; private static final int AA_MASK_WIDTH = 128; private static final int AA_MASK_HEIGHT = 64; @@ -61,6 +61,11 @@ } public void initResources(int parentXID) { + ximgPtr = initDefaultAAXImg(AA_MASK_WIDTH, AA_MASK_HEIGHT); + if(ximgPtr == 0) { + throw new OutOfMemoryError("failed to allocate ximg"); + } + maskPixmap = createPixmap(parentXID, 8, AA_MASK_WIDTH, AA_MASK_HEIGHT); maskPicture = createPicture(maskPixmap, XRUtils.PictStandardA8); maskGC = createGC(maskPixmap); @@ -68,6 +73,8 @@ } private static native void initIDs(); + + private static native long initDefaultAAXImg(int maxAATileWidth, int maxAATileHeight); public native long createGC(int drawable); @@ -306,7 +313,7 @@ int width, int height, int maskOff, int maskScan, float ea) { putMaskNative(drawable, gc, imageData, sx, sy, dx, dy, - width, height, maskOff, maskScan, ea, MASK_XIMG); + width, height, maskOff, maskScan, ea, ximgPtr); } private static native void putMaskNative(int drawable, long gc, diff --git a/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c b/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c --- a/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c +++ b/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c @@ -332,10 +332,7 @@ } JNIEXPORT void JNICALL -Java_sun_java2d_xr_XRBackendNative_initIDs(JNIEnv *env, jclass cls) { - char *maskData; - XImage* defaultImg; - jfieldID maskImgID; +Java_sun_java2d_xr_XRBackendNative_initIDs(JNIEnv *env, jclass cls, jint maxAATileWidth, jint maxAATileHeight) { jlong fmt8; jlong fmt32; @@ -357,20 +354,22 @@ (*env)->SetStaticLongField(env, cls, a8ID, fmt8); (*env)->SetStaticLongField(env, cls, argb32ID, fmt32); +} - maskData = (char *) malloc(32*32); +JNIEXPORT jlong JNICALL +Java_sun_java2d_xr_XRBackendNative_initDefaultAAXImg(JNIEnv *env, jclass cls, jint maxAATileWidth, jint maxAATileHeight) { + char *maskData; + XImage* defaultImg; + + maskData = (char *) malloc(maxAATileWidth * maxAATileHeight); if (maskData == NULL) { - return; + return 0; } - defaultImg = XCreateImage(awt_display, NULL, 8, ZPixmap, 0, maskData, 32, 32, 8, 0); - defaultImg->data = maskData; //required? - maskImgID = (*env)->GetStaticFieldID(env, cls, "MASK_XIMG", "J"); - if (maskImgID == NULL) { - return; - } + defaultImg = XCreateImage(awt_display, NULL, 8, ZPixmap, 0, maskData, maxAATileWidth, maxAATileHeight, 8, 0); + defaultImg->data = maskData; - (*env)->SetStaticLongField(env, cls, maskImgID, ptr_to_jlong(defaultImg)); + return ptr_to_jlong(defaultImg); } JNIEXPORT void JNICALL # HG changeset patch # User linuxhippy@gmail.com # Date 1519203535 -3600 # Wed Feb 21 09:58:55 2018 +0100 # Node ID ed220b7e1932c90da9abcd704c12466a5832f438 # Parent cb67b4213039ba18514ffbbd3ce8a02d65c01197 Xrender: remove mapping leftovers from 8195131 diff --git a/make/mapfiles/libawt/mapfile-mawt-vers b/make/mapfiles/libawt/mapfile-mawt-vers --- a/make/mapfiles/libawt/mapfile-mawt-vers +++ b/make/mapfiles/libawt/mapfile-mawt-vers @@ -178,7 +178,6 @@ Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; Java_sun_java2d_xr_XRBackendNative_initDefaultAAXImg; Java_sun_java2d_xr_XRUtils_initFormatPtrs; - Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; Java_sun_java2d_xr_XRBackendDeferred_takeSocketNative; Java_sun_java2d_xr_XRBackendDeferred_releaseSocketNative; Java_sun_java2d_xr_XRBackendDeferred_issueSyncReq; diff --git a/make/mapfiles/libawt_xawt/mapfile-vers b/make/mapfiles/libawt_xawt/mapfile-vers --- a/make/mapfiles/libawt_xawt/mapfile-vers +++ b/make/mapfiles/libawt_xawt/mapfile-vers @@ -408,7 +408,6 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative; Java_sun_java2d_xr_XRBackendNative_setGCMode; Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; - Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; Java_sun_java2d_xr_XRBackendNative_initDefaultAAXImg; Java_sun_java2d_xr_XRBackendDeferred_takeSocketNative; Java_sun_java2d_xr_XRBackendDeferred_releaseSocketNative; # HG changeset patch # User linuxhippy@gmail.com # Date 1519284887 -3600 # Thu Feb 22 08:34:47 2018 +0100 # Node ID d5ec0afafbe9016f65854defe09dfa11fc45827a # Parent ed220b7e1932c90da9abcd704c12466a5832f438 XRender: Update+introduce copyright statements + comments + unused import removal diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/AATileBufMan.java b/src/java.desktop/unix/classes/sun/java2d/xr/AATileBufMan.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/AATileBufMan.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/AATileBufMan.java @@ -1,18 +1,40 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Copyright (c) 2017, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. */ package sun.java2d.xr; -import java.awt.Color; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.LinkedList; /** + * Manages the state of the buffers for uploading the AA tiles. + * There is always only one non-Shared-memory buffer (can be re-used immediatly + * once XPutImage is issued), and a vrious number of SHM buffers in case SHM + * is supported on the system. * - * @author ce + * @author Clemens Eisserer */ public class AATileBufMan { diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/AATileBuffer.java b/src/java.desktop/unix/classes/sun/java2d/xr/AATileBuffer.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/AATileBuffer.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/AATileBuffer.java @@ -1,7 +1,26 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Copyright (c) 2017, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. */ package sun.java2d.xr; @@ -9,8 +28,12 @@ import java.nio.ByteBuffer; /** + * Buffer for uploading AA mask tile data. + * Supports uploading multiple AA tiles within one buffer, by simply appending + * the tiles in x-direction and starting a new line once the remaining width + * is not sufficient anymore. * - * @author ce + * @author Clemens Eisserer */ public class AATileBuffer { private final static int SHM_THRESHOLD = 8192; diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/RectTile.java b/src/java.desktop/unix/classes/sun/java2d/xr/RectTile.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/RectTile.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/RectTile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/RectTileManager.java b/src/java.desktop/unix/classes/sun/java2d/xr/RectTileManager.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/RectTileManager.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/RectTileManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackend.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackend.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackend.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackend.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendDeferred.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendDeferred.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendDeferred.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendDeferred.java @@ -1,11 +1,29 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Copyright (c) 2017, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. */ package sun.java2d.xr; -import java.awt.Color; import java.awt.Point; import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; @@ -15,8 +33,9 @@ import static sun.java2d.xr.XRUtils.XDoubleToFixed; /** + * XRBackendDeferred * - * @author ce + * @author Clemens Eisserer */ public class XRBackendDeferred extends XRBackendNative { diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskBlit.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskBlit.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskBlit.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskBlit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskFill.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskFill.java --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskFill.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskFill.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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