--- old/make/lib/Awt2dLibraries.gmk 2017-08-15 12:13:56.932964509 -0700 +++ new/make/lib/Awt2dLibraries.gmk 2017-08-15 12:13:56.656964517 -0700 @@ -311,7 +311,6 @@ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \ $(LIBJAVA_HEADER_FLAGS) # @@ -536,7 +535,6 @@ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \ $(LIBJAVA_HEADER_FLAGS) \ # --- old/make/mapfiles/libawt/mapfile-mawt-vers 2017-08-15 12:13:58.252964473 -0700 +++ new/make/mapfiles/libawt/mapfile-mawt-vers 2017-08-15 12:13:57.952964481 -0700 @@ -132,7 +132,6 @@ Java_sun_java2d_x11_X11SurfaceData_initIDs; Java_sun_java2d_x11_X11SurfaceData_initOps; Java_sun_java2d_x11_X11SurfaceData_initSurface; - Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable; Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable; Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; Java_sun_java2d_x11_X11SurfaceData_XSetXorMode; --- old/make/mapfiles/libawt/mapfile-vers-linux 2017-08-15 12:13:59.372964442 -0700 +++ new/make/mapfiles/libawt/mapfile-vers-linux 2017-08-15 12:13:59.036964451 -0700 @@ -252,7 +252,6 @@ Java_sun_awt_X11SurfaceData_initIDs; Java_sun_awt_X11SurfaceData_initOps; Java_sun_awt_X11SurfaceData_initSurface; - Java_sun_awt_X11SurfaceData_isDgaAvailable; Java_sun_awt_X11SurfaceData_setInvalid; Java_sun_awt_X11SurfaceData_flushNativeSurface; awt_display; --- old/make/mapfiles/libawt_xawt/mapfile-vers 2017-08-15 12:14:00.636964408 -0700 +++ new/make/mapfiles/libawt_xawt/mapfile-vers 2017-08-15 12:14:00.368964415 -0700 @@ -364,7 +364,6 @@ Java_sun_java2d_x11_X11Renderer_XFillRoundRect; Java_sun_java2d_x11_X11Renderer_devCopyArea; Java_sun_java2d_x11_X11SurfaceData_initIDs; - Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable; Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable; Java_sun_java2d_x11_X11SurfaceData_initSurface; Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; --- old/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java 2017-08-15 12:14:01.520964383 -0700 +++ new/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java 2017-08-15 12:14:01.296964389 -0700 @@ -2174,7 +2174,6 @@ /** * Returns one of XConstants: NotUseful, WhenMapped or Always. * If backing store is not available on at least one screen, or - * java2d uses DGA(which conflicts with backing store) on at least one screen, * or the string system property "sun.awt.backingStore" is neither "Always" * nor "WhenMapped", then the method returns XConstants.NotUseful. * Otherwise, if the system property "sun.awt.backingStore" is "WhenMapped", @@ -2218,16 +2217,6 @@ "WhenMapped" : "Always") ); } - if (sun.java2d.x11.X11SurfaceData.isDgaAvailable()) { - backingStoreType = XConstants.NotUseful; - - if (backingStoreLog.isLoggable(PlatformLogger.Level.CONFIG)) { - backingStoreLog.config("DGA is available, backingStore=NotUseful"); - } - - return; - } - awtLock(); try { int screenCount = XlibWrapper.ScreenCount(getDisplay()); --- old/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceData.java 2017-08-15 12:14:02.816964348 -0700 +++ new/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceData.java 2017-08-15 12:14:02.488964357 -0700 @@ -72,7 +72,7 @@ protected int depth; - private static native void initIDs(Class xorComp, boolean tryDGA); + private static native void initIDs(Class xorComp); protected native void initSurface(int depth, int width, int height, long drawable); @@ -213,12 +213,8 @@ static { if (!isX11SurfaceDataInitialized() && !GraphicsEnvironment.isHeadless()) { - // If a screen magnifier is present, don't attempt to use DGA - String magPresent = java.security.AccessController.doPrivileged - (new sun.security.action.GetPropertyAction("javax.accessibility.screen_magnifier_present")); - boolean tryDGA = magPresent == null || !"true".equals(magPresent); - initIDs(XORComposite.class, tryDGA); + initIDs(XORComposite.class); String xtextpipe = java.security.AccessController.doPrivileged (new sun.security.action.GetPropertyAction("sun.java2d.xtextpipe")); @@ -239,8 +235,6 @@ x11textpipe = solidTextRenderer; } - dgaAvailable = isDgaAvailable(); - if (isAccelerationEnabled()) { X11PMBlitLoops.register(); X11PMBlitBgLoops.register(); @@ -249,11 +243,6 @@ } /** - * Returns true if we can use DGA on any of the screens - */ - public static native boolean isDgaAvailable(); - - /** * Returns true if shared memory pixmaps are available */ private static native boolean isShmPMAvailable(); @@ -277,10 +266,9 @@ } // EXA based drivers tend to place pixmaps in VRAM, slowing down readbacks. - // Don't use pixmaps if dga is available, - // or we are local and shared memory Pixmaps are not available. - accelerationEnabled = - !(isDgaAvailable() || (isDisplayLocal && !isShmPMAvailable())); + // Don't use pixmaps if we are local and shared memory Pixmaps + // are not available. + accelerationEnabled = !(isDisplayLocal && !isShmPMAvailable()); } } } --- old/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c 2017-08-15 12:14:04.152964311 -0700 +++ new/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c 2017-08-15 12:14:03.816964320 -0700 @@ -39,10 +39,6 @@ #include #ifndef HEADLESS -static JDgaLibInfo DgaLibInfoStub; -static JDgaLibInfo theJDgaInfo; -static JDgaLibInfo *pJDgaInfo = &DgaLibInfoStub; - /** * This file contains support code for loops using the SurfaceData @@ -82,8 +78,6 @@ extern jfieldID validID; static int nativeByteOrder; -static jboolean dgaAvailable = JNI_FALSE; -static jboolean useDGAWithPixmaps = JNI_FALSE; static jclass xorCompClass; jint useMitShmExt = CANT_USE_MITSHM; @@ -107,8 +101,6 @@ endian.i = 0xff000000; nativeByteOrder = (endian.c[0]) ? MSBFirst : LSBFirst; - dgaAvailable = JNI_FALSE; - cachedXImage = NULL; if (sizeof(X11RIPrivate) > SD_RASINFO_PRIVATE_SIZE) { @@ -158,38 +150,12 @@ */ JNIEXPORT void JNICALL Java_sun_java2d_x11_X11SurfaceData_initIDs(JNIEnv *env, jclass xsd, - jclass XORComp, jboolean tryDGA) + jclass XORComp) { #ifndef HEADLESS if(XShared_initIDs(env, JNI_TRUE)) { - void *lib = 0; - xorCompClass = (*env)->NewGlobalRef(env, XORComp); - - if (tryDGA && (getenv("NO_J2D_DGA") == NULL)) { - /* we use RTLD_NOW because of bug 4032715 */ - lib = dlopen(JNI_LIB_NAME("sunwjdga"), RTLD_NOW); - } - - if (lib != NULL) { - JDgaStatus ret = JDGA_FAILED; - void *sym = dlsym(lib, "JDgaLibInit"); - if (sym != NULL) { - theJDgaInfo.display = awt_display; - AWT_LOCK(); - ret = (*(JDgaLibInitFunc *)sym)(env, &theJDgaInfo); - AWT_UNLOCK(); - } - if (ret == JDGA_SUCCESS) { - pJDgaInfo = &theJDgaInfo; - dgaAvailable = JNI_TRUE; - useDGAWithPixmaps = (getenv("USE_DGA_PIXMAPS") != NULL); - } else { - dlclose(lib); - lib = NULL; - } - } } #endif /* !HEADLESS */ } @@ -234,21 +200,6 @@ /* * Class: sun_java2d_x11_X11SurfaceData - * Method: isDgaAvailable - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL -Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable(JNIEnv *env, jobject this) -{ -#if defined(HEADLESS) || defined(__linux__) - return JNI_FALSE; -#else - return dgaAvailable; -#endif /* HEADLESS */ -} - -/* - * Class: sun_java2d_x11_X11SurfaceData * Method: initOps * Signature: (Ljava/lang/Object;I)V */ @@ -279,7 +230,6 @@ xsdo->drawable = 0; } xsdo->depth = depth; - xsdo->dgaAvailable = dgaAvailable; xsdo->isPixmap = JNI_FALSE; xsdo->bitmask = 0; xsdo->bgPixel = 0; @@ -447,10 +397,6 @@ return JNI_FALSE; } xsdo->isPixmap = JNI_TRUE; - /* REMIND: workaround for bug 4420220 on pgx32 boards: - don't use DGA with pixmaps unless USE_DGA_PIXMAPS is set. - */ - xsdo->dgaAvailable = useDGAWithPixmaps; xsdo->pmWidth = width; xsdo->pmHeight = height; @@ -847,29 +793,6 @@ } return SD_FAILURE; } - if (xsdo->dgaAvailable && (lockflags & (SD_LOCK_RD_WR))) { - int dgaret; - - dgaret = (*pJDgaInfo->pGetLock)(env, awt_display, &xsdo->dgaDev, - xsdo->drawable, &xsdo->surfInfo, - pRasInfo->bounds.x1, - pRasInfo->bounds.y1, - pRasInfo->bounds.x2, - pRasInfo->bounds.y2); - if (dgaret == JDGA_SUCCESS) { - int wx = xsdo->surfInfo.window.lox; - int wy = xsdo->surfInfo.window.loy; - pRasInfo->bounds.x1 = xsdo->surfInfo.visible.lox - wx; - pRasInfo->bounds.y1 = xsdo->surfInfo.visible.loy - wy; - pRasInfo->bounds.x2 = xsdo->surfInfo.visible.hix - wx; - pRasInfo->bounds.y2 = xsdo->surfInfo.visible.hiy - wy; - xpriv->lockType = X11SD_LOCK_BY_DGA; - xpriv->lockFlags = lockflags; - return SD_SUCCESS; - } else if (dgaret == JDGA_UNAVAILABLE) { - xsdo->dgaAvailable = JNI_FALSE; - } - } if (lockflags & SD_LOCK_RD_WR) { if (lockflags & SD_LOCK_FASTEST) { ret = SD_SLOWLOCK; @@ -915,43 +838,9 @@ jint depth = xsdo->depth; int mult = xsdo->configData->pixelStride; - if (xsdo->dgaAvailable && - xpriv->lockType == X11SD_LOCK_BY_XIMAGE && - (lockFlags & SD_LOCK_FASTEST)) - { - /* Try one more time to use DGA (now with smaller bounds)... */ - int dgaret; - - dgaret = (*pJDgaInfo->pGetLock)(env, awt_display, &xsdo->dgaDev, - xsdo->drawable, &xsdo->surfInfo, - pRasInfo->bounds.x1, - pRasInfo->bounds.y1, - pRasInfo->bounds.x2, - pRasInfo->bounds.y2); - if (dgaret == JDGA_SUCCESS) { - int wx = xsdo->surfInfo.window.lox; - int wy = xsdo->surfInfo.window.loy; - pRasInfo->bounds.x1 = xsdo->surfInfo.visible.lox - wx; - pRasInfo->bounds.y1 = xsdo->surfInfo.visible.loy - wy; - pRasInfo->bounds.x2 = xsdo->surfInfo.visible.hix - wx; - pRasInfo->bounds.y2 = xsdo->surfInfo.visible.hiy - wy; - xpriv->lockType = X11SD_LOCK_BY_DGA; - } else if (dgaret == JDGA_UNAVAILABLE) { - xsdo->dgaAvailable = JNI_FALSE; - } - } - if (xpriv->lockType == X11SD_LOCK_BY_DGA) { - int scan = xsdo->surfInfo.surfaceScan; - int wx = xsdo->surfInfo.window.lox; - int wy = xsdo->surfInfo.window.loy; - pRasInfo->rasBase = - (void *)(((uintptr_t) xsdo->surfInfo.basePtr) + (scan*wy + wx) * mult); - pRasInfo->pixelStride = mult; - pRasInfo->pixelBitOffset = 0; - pRasInfo->scanStride = scan * mult; #ifdef MITSHM - } else if (xpriv->lockType == X11SD_LOCK_BY_SHMEM) { + if (xpriv->lockType == X11SD_LOCK_BY_SHMEM) { if (xsdo->shmPMData.xRequestSent == JNI_TRUE) { /* need to sync before using shared mem pixmap if any x calls were issued for this pixmap */ @@ -964,8 +853,9 @@ pRasInfo->pixelStride = mult; pRasInfo->pixelBitOffset = 0; pRasInfo->scanStride = xsdo->shmPMData.bytesPerLine; + } else #endif /* MITSHM */ - } else if (xpriv->lockType == X11SD_LOCK_BY_XIMAGE) { + if (xpriv->lockType == X11SD_LOCK_BY_XIMAGE) { int x, y, w, h; x = pRasInfo->bounds.x1; y = pRasInfo->bounds.y1; @@ -1026,9 +916,7 @@ X11SDOps *xsdo = (X11SDOps *) ops; X11RIPrivate *xpriv = (X11RIPrivate *) &(pRasInfo->priv); - if (xpriv->lockType == X11SD_LOCK_BY_DGA) { - (*pJDgaInfo->pReleaseLock)(env, xsdo->dgaDev, xsdo->drawable); - } else if (xpriv->lockType == X11SD_LOCK_BY_XIMAGE && + if (xpriv->lockType == X11SD_LOCK_BY_XIMAGE && xpriv->img != NULL) { if (xpriv->lockFlags & SD_LOCK_WRITE) { @@ -1069,7 +957,6 @@ xpriv->img, 0, 0, x, y, w, h); #endif /* MITSHM */ - (*pJDgaInfo->pXRequestSent)(env, xsdo->dgaDev, drawable); } X11SD_DisposeOrCacheXImage(xpriv->img); xpriv->img = (XImage *)NULL; @@ -1392,47 +1279,6 @@ } } -static JDgaStatus - GetLockStub(JNIEnv *env, Display *display, void **dgaDev, - Drawable d, JDgaSurfaceInfo *pSurface, - jint lox, jint loy, jint hix, jint hiy) -{ - return JDGA_UNAVAILABLE; -} - -static JDgaStatus - ReleaseLockStub(JNIEnv *env, void *dgaDev, Drawable d) -{ - return JDGA_FAILED; -} - -static void - XRequestSentStub(JNIEnv *env, void *dgaDev, Drawable d) -{ -} - -static void - LibDisposeStub(JNIEnv *env) -{ -} - -static JDgaLibInfo DgaLibInfoStub = { - NULL, - GetLockStub, - ReleaseLockStub, - XRequestSentStub, - LibDisposeStub, -}; - -void X11SD_LibDispose(JNIEnv *env) { - AWT_LOCK(); - if (pJDgaInfo != NULL) { - pJDgaInfo->pLibDispose(env); - pJDgaInfo = &DgaLibInfoStub; - } - AWT_UNLOCK(); -} - void X11SD_DirectRenderNotify(JNIEnv *env, X11SDOps *xsdo) { @@ -1441,7 +1287,6 @@ xsdo->shmPMData.xRequestSent = JNI_TRUE; } #endif /* MITSHM */ - (*pJDgaInfo->pXRequestSent)(env, xsdo->dgaDev, xsdo->drawable); awt_output_flush(); } --- old/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h 2017-08-15 12:14:05.368964278 -0700 +++ new/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h 2017-08-15 12:14:05.092964286 -0700 @@ -28,8 +28,6 @@ #include "awt_p.h" #include "awt_GraphicsEnv.h" -#include - #ifdef HEADLESS #include "GLXGraphicsConfig.h" #endif @@ -105,11 +103,8 @@ GC cachedGC; /* cached for use in X11SD_Unlock() */ jint depth; jint pixelmask; - JDgaSurfaceInfo surfInfo; AwtGraphicsConfigData *configData; ColorData *cData; - jboolean dgaAvailable; - void *dgaDev; Pixmap bitmask; jint bgPixel; /* bg pixel for the pixmap */ jboolean isBgInitialized; /* whether the bg pixel is valid */ @@ -124,7 +119,6 @@ #define X11SD_LOCK_UNLOCKED 0 /* surface is not locked */ #define X11SD_LOCK_BY_NULL 1 /* surface locked for NOP */ #define X11SD_LOCK_BY_XIMAGE 2 /* surface locked by Get/PutImage */ -#define X11SD_LOCK_BY_DGA 3 /* surface locked by DGA */ #define X11SD_LOCK_BY_SHMEM 4 /* surface locked by ShMemExt */ #ifdef MITSHM --- old/src/java.desktop/unix/native/libsunwjdga/dgalock.c 2017-08-15 12:14:06.096964258 -0700 +++ /dev/null 2017-08-10 09:28:49.381064065 -0700 @@ -1,533 +0,0 @@ -/* - * Copyright (c) 1998, 2012, 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. - */ - -#if sparc - -/* #define DGA_DEBUG */ - -#ifdef DGA_DEBUG -#define DEBUG_PRINT(x) printf x -#else -#define DEBUG_PRINT(x) -#endif - -#include -#include /* ioctl */ -#include -#include /* mmap */ -#include -#include - -/* X11 */ -#include - -#include "jni.h" -#include "jvm_md.h" -#include "jdga.h" -#include "jdgadevice.h" - -#include - -#define min(x, y) ((x) < (y) ? (x) : (y)) -#define max(x, y) ((x) > (y) ? (x) : (y)) - -typedef struct _SolarisDgaLibInfo SolarisDgaLibInfo; - -struct _SolarisDgaLibInfo { - /* The general (non-device specific) information */ - unsigned long count; - Drawable drawable; - Drawable virtual_drawable; - - /* The device specific memory mapping information */ - SolarisJDgaDevInfo *devInfo; - SolarisJDgaWinInfo winInfo; -}; - -typedef Bool IsXineramaOnFunc(Display *display); -typedef Drawable GetVirtualDrawableFunc(Display *display, Drawable drawable); - -#define MAX_CACHED_INFO 16 -static SolarisDgaLibInfo cachedInfo[MAX_CACHED_INFO]; -static jboolean needsSync = JNI_FALSE; - -#define MAX_FB_TYPES 16 -static SolarisJDgaDevInfo devicesInfo[MAX_FB_TYPES]; - -static IsXineramaOnFunc *IsXineramaOn = NULL; -static GetVirtualDrawableFunc GetVirtualDrawableStub; - -Drawable GetVirtualDrawableStub(Display *display, Drawable drawable) { - return drawable; -} -static GetVirtualDrawableFunc * GetVirtualDrawable = GetVirtualDrawableStub; - -static void Solaris_DGA_XineramaInit(Display *display) { - void * handle = NULL; - if (IsXineramaOn == NULL) { - handle = dlopen(JNI_LIB_NAME("xinerama"), RTLD_NOW); - if (handle != NULL) { - void *sym = dlsym(handle, "IsXineramaOn"); - IsXineramaOn = (IsXineramaOnFunc *)sym; - if (IsXineramaOn != 0 && (*IsXineramaOn)(display)) { - sym = dlsym(handle, "GetVirtualDrawable"); - if (sym != 0) { - GetVirtualDrawable = (GetVirtualDrawableFunc *)sym; - } - } else { - dlclose(handle); - } - } - } -} - -static SolarisJDgaDevInfo * getDevInfo(Dga_drawable dgadraw) { - void *handle = 0; - struct vis_identifier visid; - int fd; - char libName[64]; - int i; - SolarisJDgaDevInfo *curDevInfo = devicesInfo; - - fd = dga_draw_devfd(dgadraw); - if (ioctl(fd, VIS_GETIDENTIFIER, &visid) != 1) { - /* check in the devices list */ - for (i = 0; (i < MAX_FB_TYPES) && (curDevInfo->visidName); - i++, curDevInfo++) { - if (strcmp(visid.name, curDevInfo->visidName) == 0) { - /* we already have such a device, return it */ - return curDevInfo; - } - } - if (i == MAX_FB_TYPES) { - /* we're out of slots, return NULL */ - return NULL; - } - - strcpy(libName, "libjdga"); - strcat(libName, visid.name); - strcat(libName,".so"); - /* we use RTLD_NOW because of bug 4032715 */ - handle = dlopen(libName, RTLD_NOW); - if (handle != 0) { - JDgaStatus ret = JDGA_FAILED; - void *sym = dlsym(handle, "SolarisJDgaDevOpen"); - if (sym != 0) { - curDevInfo->majorVersion = JDGALIB_MAJOR_VERSION; - curDevInfo->minorVersion = JDGALIB_MINOR_VERSION; - ret = (*(SolarisJDgaDevOpenFunc *)sym)(curDevInfo); - } - if (ret == JDGA_SUCCESS) { - curDevInfo->visidName = strdup(visid.name); - return curDevInfo; - } - dlclose(handle); - } - } - return NULL; -} -static int -mmap_dgaDev(SolarisDgaLibInfo *libInfo, Dga_drawable dgadraw) -{ - - if (!libInfo->devInfo) { - libInfo->devInfo = getDevInfo(dgadraw); - if (!libInfo->devInfo) { - return JDGA_FAILED; - } - } - return (*libInfo->devInfo->function->winopen)(&(libInfo->winInfo)); -} - -static void -unmap_dgaDev(SolarisDgaLibInfo *pDevInfo) -{ - DEBUG_PRINT(("winclose() called\n")); - (*pDevInfo->devInfo->function->winclose)(&(pDevInfo->winInfo)); -} - -static jboolean -Solaris_DGA_Available(Display *display) -{ - Window root; - int screen; - Dga_drawable dgaDrawable; - SolarisJDgaDevInfo * devinfo; - - /* return true if any screen supports DGA and we - have a library for this type of framebuffer */ - for (screen = 0; screen < XScreenCount(display); screen++) { - root = RootWindow(display, screen); - - dgaDrawable = XDgaGrabDrawable(display, root); - if (dgaDrawable != 0) { - devinfo = getDevInfo(dgaDrawable); - XDgaUnGrabDrawable(dgaDrawable); - if (devinfo != NULL) { - return JNI_TRUE; - } - } - } - return JNI_FALSE; -} - -static JDgaLibInitFunc Solaris_DGA_LibInit; -static JDgaGetLockFunc Solaris_DGA_GetLock; -static JDgaReleaseLockFunc Solaris_DGA_ReleaseLock; -static JDgaXRequestSentFunc Solaris_DGA_XRequestSent; -static JDgaLibDisposeFunc Solaris_DGA_LibDispose; -static int firstInitDone = 0; - -#pragma weak JDgaLibInit = Solaris_DGA_LibInit - -static JDgaStatus -Solaris_DGA_LibInit(JNIEnv *env, JDgaLibInfo *ppInfo) -{ - /* Note: DGA_INIT can be called multiple times according to docs */ - DEBUG_PRINT(("DGA_INIT called\n")); - DGA_INIT(); - - if (!Solaris_DGA_Available(ppInfo->display)) { - return JDGA_FAILED; - } - Solaris_DGA_XineramaInit(ppInfo->display); - - ppInfo->pGetLock = Solaris_DGA_GetLock; - ppInfo->pReleaseLock = Solaris_DGA_ReleaseLock; - ppInfo->pXRequestSent = Solaris_DGA_XRequestSent; - ppInfo->pLibDispose = Solaris_DGA_LibDispose; - - return JDGA_SUCCESS; -} - -static JDgaStatus -Solaris_DGA_GetLock(JNIEnv *env, Display *display, void **dgaDev, - Drawable drawable, JDgaSurfaceInfo *pSurface, - jint lox, jint loy, jint hix, jint hiy) -{ - SolarisDgaLibInfo *pDevInfo; - SolarisDgaLibInfo *pCachedInfo = cachedInfo; - int vis; - int dlox, dloy, dhix, dhiy; - int i; - int type, site; - unsigned long k; - Drawable prev_virtual_drawable = 0; - Dga_drawable dgaDrawable; - - if (*dgaDev) { - if (((SolarisDgaLibInfo *)(*dgaDev))->drawable != drawable) { - *dgaDev = 0; - } - } - - if (*dgaDev == 0) { - pCachedInfo = cachedInfo; - for (i = 0 ; (i < MAX_CACHED_INFO) && (pCachedInfo->drawable) ; - i++, pCachedInfo++) { - if (pCachedInfo->drawable == drawable) { - *dgaDev = pCachedInfo; - break; - } - } - if (*dgaDev == 0) { - if (i < MAX_CACHED_INFO) { /* slot can be used for new info */ - *dgaDev = pCachedInfo; - } else { - pCachedInfo = cachedInfo; - /* find the least used slot but does not handle an overflow of - the counter */ - for (i = 0, k = 0xffffffff; i < MAX_CACHED_INFO ; - i++, pCachedInfo++) { - if (k > pCachedInfo->count) { - k = pCachedInfo->count; - *dgaDev = pCachedInfo; - } - pCachedInfo->count = 0; /* reset all counters */ - } - pCachedInfo = *dgaDev; - if (pCachedInfo->winInfo.dgaDraw != 0) { - XDgaUnGrabDrawable(pCachedInfo->winInfo.dgaDraw); - } - pCachedInfo->winInfo.dgaDraw = 0; - /* the slot might be used for another device */ - pCachedInfo->devInfo = 0; - } - } - } - - pDevInfo = *dgaDev; - pDevInfo->drawable = drawable; - - prev_virtual_drawable = pDevInfo->virtual_drawable; - pDevInfo->virtual_drawable = GetVirtualDrawable(display, drawable); - if (pDevInfo->virtual_drawable == NULL) { - /* this usually means that the drawable is spanned across - screens in xinerama mode - we can't handle this for now */ - return JDGA_FAILED; - } else { - /* check if the drawable has been moved to another screen - since last time */ - if (pDevInfo->winInfo.dgaDraw != 0 && - pDevInfo->virtual_drawable != prev_virtual_drawable) { - XDgaUnGrabDrawable(pDevInfo->winInfo.dgaDraw); - pDevInfo->winInfo.dgaDraw = 0; - } - } - - pDevInfo->count++; - - if (pDevInfo->winInfo.dgaDraw == 0) { - pDevInfo->winInfo.dgaDraw = XDgaGrabDrawable(display, pDevInfo->virtual_drawable); - if (pDevInfo->winInfo.dgaDraw == 0) { - DEBUG_PRINT(("DgaGrabDrawable failed for 0x%08x\n", drawable)); - return JDGA_UNAVAILABLE; - } - type = dga_draw_type(pDevInfo->winInfo.dgaDraw); - if (type != DGA_DRAW_PIXMAP && - mmap_dgaDev(pDevInfo, pDevInfo->winInfo.dgaDraw) != JDGA_SUCCESS) { - DEBUG_PRINT(("memory map failed for 0x%08x (depth = %d)\n", - drawable, dga_draw_depth(pDevInfo->winInfo.dgaDraw))); - XDgaUnGrabDrawable(pDevInfo->winInfo.dgaDraw); - pDevInfo->winInfo.dgaDraw = 0; - return JDGA_UNAVAILABLE; - } - } else { - type = dga_draw_type(pDevInfo->winInfo.dgaDraw); - } - - if (needsSync) { - XSync(display, False); - needsSync = JNI_FALSE; - } - - dgaDrawable = pDevInfo->winInfo.dgaDraw; - - DGA_DRAW_LOCK(dgaDrawable, -1); - - site = dga_draw_site(dgaDrawable); - if (type == DGA_DRAW_PIXMAP) { - if (site == DGA_SITE_SYSTEM) { - pDevInfo->winInfo.mapDepth = dga_draw_depth(dgaDrawable); - pDevInfo->winInfo.mapAddr = dga_draw_address(dgaDrawable); - dga_draw_bbox(dgaDrawable, &dlox, &dloy, &dhix, &dhiy); - pDevInfo->winInfo.mapWidth = dhix; - pDevInfo->winInfo.mapHeight = dhiy; - if (pDevInfo->winInfo.mapDepth == 8) { - pDevInfo->winInfo.mapLineStride = dga_draw_linebytes(dgaDrawable); - pDevInfo->winInfo.mapPixelStride = 1; - } else { - pDevInfo->winInfo.mapLineStride = dga_draw_linebytes(dgaDrawable)/4; - pDevInfo->winInfo.mapPixelStride = 4; - } - } else { - XDgaUnGrabDrawable(dgaDrawable); - pDevInfo->winInfo.dgaDraw = 0; - return JDGA_UNAVAILABLE; - } - } else { - if (site == DGA_SITE_NULL) { - DEBUG_PRINT(("zombie drawable = 0x%08x\n", dgaDrawable)); - DGA_DRAW_UNLOCK(dgaDrawable); - unmap_dgaDev(pDevInfo); - XDgaUnGrabDrawable(dgaDrawable); - pDevInfo->winInfo.dgaDraw = 0; - return JDGA_UNAVAILABLE; - } - dga_draw_bbox(dgaDrawable, &dlox, &dloy, &dhix, &dhiy); - } - - /* get the screen address of the drawable */ - dhix += dlox; - dhiy += dloy; - DEBUG_PRINT(("window at (%d, %d) => (%d, %d)\n", dlox, dloy, dhix, dhiy)); - pSurface->window.lox = dlox; - pSurface->window.loy = dloy; - pSurface->window.hix = dhix; - pSurface->window.hiy = dhiy; - - /* translate rendering coordinates relative to device bbox */ - lox += dlox; - loy += dloy; - hix += dlox; - hiy += dloy; - DEBUG_PRINT(("render at (%d, %d) => (%d, %d)\n", lox, loy, hix, hiy)); - - vis = dga_draw_visibility(dgaDrawable); - switch (vis) { - case DGA_VIS_UNOBSCURED: - pSurface->visible.lox = max(dlox, lox); - pSurface->visible.loy = max(dloy, loy); - pSurface->visible.hix = min(dhix, hix); - pSurface->visible.hiy = min(dhiy, hiy); - DEBUG_PRINT(("unobscured vis at (%d, %d) => (%d, %d)\n", - pSurface->visible.lox, - pSurface->visible.loy, - pSurface->visible.hix, - pSurface->visible.hiy)); - break; - case DGA_VIS_PARTIALLY_OBSCURED: { - /* - * fix for #4305271 - * the dga_draw_clipinfo call returns the clipping bounds - * in short ints, but use only full size ints for all comparisons. - */ - short *ptr; - int x0, y0, x1, y1; - int cliplox, cliploy, cliphix, cliphiy; - - /* - * iterate to find out whether the clipped blit draws to a - * single clipping rectangle - */ - cliplox = cliphix = lox; - cliploy = cliphiy = loy; - ptr = dga_draw_clipinfo(dgaDrawable); - while (*ptr != DGA_Y_EOL) { - y0 = *ptr++; - y1 = *ptr++; - DEBUG_PRINT(("DGA y range loy=%d hiy=%d\n", y0, y1)); - if (y0 < loy) { - y0 = loy; - } - if (y1 > hiy) { - y1 = hiy; - } - while (*ptr != DGA_X_EOL) { - x0 = *ptr++; - x1 = *ptr++; - DEBUG_PRINT((" DGA x range lox=%d hix=%d\n", x0, x1)); - if (x0 < lox) { - x0 = lox; - } - if (x1 > hix) { - x1 = hix; - } - if (x0 < x1 && y0 < y1) { - if (cliploy == cliphiy) { - /* First rectangle intersection */ - cliplox = x0; - cliploy = y0; - cliphix = x1; - cliphiy = y1; - } else { - /* Can we merge this rect with previous? */ - if (cliplox == x0 && cliphix == x1 && - cliploy <= y1 && cliphiy >= y0) - { - /* X ranges match, Y ranges touch */ - /* => absorb the Y ranges together */ - cliploy = min(cliploy, y0); - cliphiy = max(cliphiy, y1); - } else if (cliploy == y0 && cliphiy == y1 && - cliplox <= x1 && cliphix >= x0) - { - /* Y ranges match, X ranges touch */ - /* => Absorb the X ranges together */ - cliplox = min(cliplox, x0); - cliphix = max(cliphix, x1); - } else { - /* Assertion: any other combination */ - /* means non-rectangular intersect */ - DGA_DRAW_UNLOCK(dgaDrawable); - return JDGA_FAILED; - } - } - } - } - ptr++; /* advance past DGA_X_EOL */ - } - DEBUG_PRINT(("DGA drawable fits\n")); - pSurface->visible.lox = cliplox; - pSurface->visible.loy = cliploy; - pSurface->visible.hix = cliphix; - pSurface->visible.hiy = cliphiy; - break; - } - case DGA_VIS_FULLY_OBSCURED: - pSurface->visible.lox = - pSurface->visible.hix = lox; - pSurface->visible.loy = - pSurface->visible.hiy = loy; - DEBUG_PRINT(("fully obscured vis\n")); - break; - default: - DEBUG_PRINT(("unknown visibility = %d!\n", vis)); - DGA_DRAW_UNLOCK(dgaDrawable); - return JDGA_FAILED; - } - - pSurface->basePtr = pDevInfo->winInfo.mapAddr; - pSurface->surfaceScan = pDevInfo->winInfo.mapLineStride; - pSurface->surfaceWidth = pDevInfo->winInfo.mapWidth; - pSurface->surfaceHeight = pDevInfo->winInfo.mapHeight; - pSurface->surfaceDepth = pDevInfo->winInfo.mapDepth; - - return JDGA_SUCCESS; -} - -static JDgaStatus -Solaris_DGA_ReleaseLock(JNIEnv *env, void *dgaDev, Drawable drawable) -{ - SolarisDgaLibInfo *pDevInfo = (SolarisDgaLibInfo *) dgaDev; - - if (pDevInfo != 0 && pDevInfo->drawable == drawable && - pDevInfo->winInfo.dgaDraw != 0) { - DGA_DRAW_UNLOCK(pDevInfo->winInfo.dgaDraw); - } - return JDGA_SUCCESS; -} - -static void -Solaris_DGA_XRequestSent(JNIEnv *env, void *dgaDev, Drawable drawable) -{ - needsSync = JNI_TRUE; -} - -static void -Solaris_DGA_LibDispose(JNIEnv *env) -{ - SolarisDgaLibInfo *pCachedInfo = cachedInfo; - SolarisJDgaDevInfo *curDevInfo = devicesInfo; - int i; - - for (i = 0 ; (i < MAX_CACHED_INFO) && (pCachedInfo->drawable) ; - i++, pCachedInfo++) { - if (pCachedInfo->winInfo.dgaDraw != 0) { - if (dga_draw_type(pCachedInfo->winInfo.dgaDraw) == DGA_DRAW_WINDOW && - pCachedInfo->winInfo.mapDepth != 0) { - unmap_dgaDev(pCachedInfo); - } - XDgaUnGrabDrawable(pCachedInfo->winInfo.dgaDraw); - pCachedInfo->winInfo.dgaDraw = 0; - } - } - for (i = 0; (i < MAX_FB_TYPES) && (curDevInfo->visidName); - i++, curDevInfo++) { - curDevInfo->function->devclose(curDevInfo); - free(curDevInfo->visidName); - } -} -#endif --- old/src/java.desktop/unix/native/libsunwjdga/jdga.h 2017-08-15 12:14:06.932964235 -0700 +++ /dev/null 2017-08-10 09:28:49.381064065 -0700 @@ -1,255 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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. - */ - -/* - * The JDGA interface enables "Direct Graphics Access" to the pixels - * of X11 drawables for the Java runtime graphics implementation. - * - * This include file defines the external interface that the - * Solaris X11 port of the Java(tm) 2D API uses to communicate - * with a dynamically loadable object library to obtain information - * for rendering directly to the memory mapped surfaces that store - * the pixel information for an X11 Window (or technically any X11 - * Drawable). - * - * The 2D graphics library will link to an object file, either - * through direct linking at compile time or through dynamic - * loading at runtime, and use an entry point defined as - * - * JDgaLibInitFunc JDgaLibInit; - * - * to initialize the library and obtain a copy of a JDgaLibInfo - * structure that will be used to communicate with the library - * to obtain information about X11 Drawable IDs and the memory - * used to store their pixels. - * - * Some parts of this interface use interfaces and structures - * defined by the JNI native interface technology. - */ - -#ifndef HEADLESS -/* - * - */ -#define JDGALIB_MAJOR_VERSION 1 -#define JDGALIB_MINOR_VERSION 0 - -/* - * Definitions for the return status codes for most of the JDGA - * access functions. - */ -#ifndef _DEFINE_JDGASTATUS_ -#define _DEFINE_JDGASTATUS_ -typedef enum { - JDGA_SUCCESS = 0, /* operation succeeded */ - JDGA_FAILED = 1, /* unable to complete operation */ - JDGA_UNAVAILABLE = 2 /* DGA not available on attached devices */ -} JDgaStatus; -#endif - -/* - * This structure defines the location and size of a rectangular - * region of a drawing surface. - * - * lox, loy - coordinates that point to the pixel just inside - * the top left-hand corner of the region. - * hix, hiy - coordinates that point to the pixel just beyond - * the bottom right-hand corner of the region. - * - * Thus, the region is a rectangle containing (hiy-loy) rows of - * (hix-lox) columns of pixels. - */ -typedef struct { - jint lox; - jint loy; - jint hix; - jint hiy; -} JDgaBounds; - -typedef struct { - /* - * Information describing the global memory partition containing - * the pixel information for the window. - */ - void *basePtr; /* Base address of memory partition. */ - jint surfaceScan; /* Number of pixels from one row to the next */ - jint surfaceWidth; /* Total accessible pixels across */ - jint surfaceHeight; /* Total accessible pixels down */ - jint surfaceDepth; /* Mapped depth */ - - /* - * Location and size information of the entire window (may include - * portions outside of the memory partition). - * - * The coordinates are relative to the "basePtr" origin of the screen. - */ - JDgaBounds window; - - /* - * Location and size information of the visible portion of the - * window (includes only portions that are inside the writable - * portion of the memory partition and not covered by other windows) - * - * This rectangle may represent a subset of the rendering - * rectangle supplied in the JDgaGetLock function if that - * rectangle is partially clipped and the remaining visible - * portion is exactly rectangular. - * - * The coordinates are relative to the "basePtr" origin of the screen. - */ - JDgaBounds visible; - -} JDgaSurfaceInfo; - -typedef struct _JDgaLibInfo JDgaLibInfo; - -/* - * This function is called to initialize the JDGA implementation - * library for access to the given X11 Display. - * This function stores a pointer to a structure that holds function - * pointers for the rest of the requests as well as any additinoal - * data that that library needs to track the indicated display. - * - * @return - * JDGA_SUCCESS if library was successfully initialized - * JDGA_FAILED if library is unable to perform operations - * on the given X11 Display. - */ -typedef JDgaStatus -JDgaLibInitFunc(JNIEnv *env, JDgaLibInfo *ppInfo); - -/* - * This function is called to lock the given X11 Drawable into - * a locally addressable memory location and to return specific - * rendering information about the location and geometry of the - * display memory that the Drawable occupies. - * - * Information provided to this function includes: - * - * lox, loy - the X and Y coordinates of the pixel just inside - * the upper left corner of the region to be rendered - * hix, hiy - the X and Y coordinates of the pixel just beyond - * the lower right corner of the region to be rendered - * - * Information obtained via this function includes: - * - * *pSurface - A pointer to a JDgaSurfaceInfo structure which is - * filled in with information about the drawing area for - * the specified Drawable. - * - * The return value indicates whether or not the library was able - * to successfully lock the drawable into memory and obtain the - * specific geometry information required to render to the Drawable's - * pixel memory. Failure indicates only a temporary inability to - * lock down the memory for this Drawable and does not imply a general - * inability to lock this or other Drawable's at a later time. - * - * If the indicated rendering region is not visible at all then this - * function should indicate JDGA_SUCCESS and return an empty - * "visible" rectangle. - * If the indicated rendering region has a visible portion that cannot - * be expressed as a single rectangle in the JDgaSurfaceInfo structure - * then JDGA_FAILED should be indicated so that the rendering library - * can back off to another rendering mechanism. - * - * @return - * JDGA_SUCCESS memory successfully locked and described - * JDGA_FAILED temporary failure to lock the specified Drawable - */ -typedef JDgaStatus -JDgaGetLockFunc(JNIEnv *env, Display *display, void **dgaDev, - Drawable d, JDgaSurfaceInfo *pSurface, - jint lox, jint loy, jint hix, jint hiy); - -/* - * This function is called to unlock the locally addressable memory - * associated with the given X11 Drawable until the next rendering - * operation. The JDgaSurfaceInfo structure supplied is the same - * structure that was supplied in the dga_get_lock function and - * can be used to determine implementation specific data needed to - * manage the access lock for the indicated drawable. - * - * The return value indicates whether or not the library was able - * to successfully remove its lock. Typically failure indicates - * only that the lock had been invalidated through external means - * before the rendering library completed its work and is for - * informational purposes only, though it could also mean that - * the rendering library asked to unlock a Drawable that it had - * never locked. - * - * @return - * JDGA_SUCCESS lock successfully released - * JDGA_FAILED unable to release lock for some reason, - * typically the lock was already invalid - */ -typedef JDgaStatus -JDgaReleaseLockFunc(JNIEnv *env, void *dgaDev, Drawable d); - -/* - * This function is called to inform the JDGA library that the - * AWT rendering library has enqueued an X11 request for the - * indicated Drawable. The JDGA library will have to synchronize - * the X11 output buffer with the server before this drawable - * is again locked in order to prevent race conditions between - * the rendering operations in the X11 queue and the rendering - * operations performed directly between calls to the GetLockFunc - * and the ReleaseLockFunc. - */ -typedef void -JDgaXRequestSentFunc(JNIEnv *env, void *dgaDev, Drawable d); - -/* - * This function is called to shut down a JDGA library implementation - * and dispose of any resources that it is using for a given display. - * - */ - -typedef void -JDgaLibDisposeFunc(JNIEnv *env); - -struct _JDgaLibInfo { - /* - * The X11 display structure that this instance of JDgaLibInfo - * structure is tracking. - */ - Display *display; - - /* - * Pointers to the utility functions to query information about - * X11 drawables and perform synchronization on them. - */ - JDgaGetLockFunc *pGetLock; - JDgaReleaseLockFunc *pReleaseLock; - JDgaXRequestSentFunc *pXRequestSent; - JDgaLibDisposeFunc *pLibDispose; - - /* - * Since the JDGA library is responsible for allocating this - * structure, implementation specific information can be tracked - * by the library by declaring its own structure that contains - * data following the above members. - */ -}; -#endif /* !HEADLESS */ --- old/src/java.desktop/unix/native/libsunwjdga/jdgadevice.h 2017-08-15 12:14:07.616964216 -0700 +++ /dev/null 2017-08-10 09:28:49.381064065 -0700 @@ -1,218 +0,0 @@ -/* - * Copyright (c) 1998, 2000, 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. - */ - -#ifndef _JDGADEVICE_H_ -#define _JDGADEVICE_H_ - -/* - * Interface for Supporting DGA to Framebuffers under Java - * ------------------------------------------------------- - * - * This interface will allow third party (and Sun) framebuffers which - * support the Direct Graphics Access (DGA) interface to be accessed with - * DGA in Java applications. - * - * It coexists with the existing device-independent interfaces provided in - * libsunwjdga.so. - * - * Framebuffers desiring access to Java DGA must supply a dynamically - * loaded library named "libjdga.so", where is the name - * returned by the VIS_GETIDENTIFIER ioctl as defined in the Solaris - * VISUAL environment (visual_io(7i)). For example, the Java DGA library - * for Sun's cg6 framebuffer will be named libjdgaSUNWcg6.so. - * - * Because multiple instances of a framebuffer type may exist on a system, - * the device-dependent library must avoid the use of static or global - * variables for any framebuffer-related variables. In other words it - * must be reentrant. - * - * The device-independent function Solaris_JDga_LibInit() is called in the - * static initializer for X11Graphics.java. Solaris_JDga_LibInit() will be - * modified to seek out a device-dependent DGA library as follows. - * - * - DGA grab the DefaultRootWindow to get a Dga_drawable. - * - * - Use the Dga_drawable ID to get the device file descriptor - * fd = dga_win_devfd(dga_draw_id) - * - * - Use the VIS_GETIDENTIFIER ioctl to get the device name string. - * - * - Construct the library path name using the device name string. - * The device-dependent library must be located in a location specified - * in the LD_LIBRARY_PATH. - * - * - The device-dependent library will be dlopen'ed and then a dlsym will - * be performed for the function "SolarisJDgaDevOpen", which must - * be implemented by the device-dependent library writer. - * - * - The function SolarisJDgaDevOpen() will then be called with a - * pointer to a SolarisJDgaDevInfo structure. This structure will - * have its major and minor version numbers filled in with their - * current values by the device-independent calling code. The - * device-dependent library must examine these version numbers and - * act as follows: - * - * - In all cases, the device-dependent code should reset the - * supplied major and minor version numbers to those of the - * device-dependent library. - * - * - If the supplied major version number is not the same as that - * of the device library, the open must fail and return JDGA_FAILED. - * - * - If the supplied minor version number is less than or equal to - * the device minor version number, then backward compatibility - * is assumed and the open should return JDGA_SUCCESS. - * - * - If the supplied minor version number is greater than the - * device minor version number, the open should also return - * JDGA_SUCCESS. The returned device minor version number will - * indicate to the device-independent code what features are - * supported in the device library. - * - * - The function SolarisJDgaDevOpen() must also return a structure - * containing function pointers as given in the SolarisJDgaDevFunc - * structure below. The winlock and winunlock functions are - * required only if there is some device-specific locking to be done - * in addition to the DGA lock. If this is not required for the device - * these function pointers may be specified as NULL pointers. - * - */ - -#include -#include /* ioctl */ -#include -#include /* mmap */ -#include -#include - -/* - * Status return codes - */ -#ifndef _DEFINE_JDGASTATUS_ -#define _DEFINE_JDGASTATUS_ -typedef enum { - JDGA_SUCCESS = 0, /* operation succeeded */ - JDGA_FAILED = 1 /* unable to complete operation */ -} JDgaStatus; -#endif - -/* - * Structure to be filled in by device-dependent library's - * SolarisJDgaDevOpen() function - */ -typedef struct { - char * visidName; /* device name from ioctl */ - int majorVersion; - int minorVersion; - struct _SolarisJDgaDevFuncList* function; /* Device function pointers */ -} SolarisJDgaDevInfo; - -/* - * Structure returned by device-dependent library for a window - */ -typedef struct { - SolarisJDgaDevInfo* devInfo; /* Supplied by caller */ - Dga_drawable dgaDraw; /* Supplied by caller */ - caddr_t mapAddr; /* FB mapping for this window */ - int mapDepth; /* Depth in bits */ - int mapWidth; /* Width in pixels */ - int mapHeight; /* Height in lines */ - int mapLineStride; /* Byte stride line-to-line */ - int mapPixelStride; /* Byte stride pixel-to-pixel */ - void* privateData; /* Handle for device-dependent library */ -} SolarisJDgaWinInfo; - -typedef JDgaStatus (*SolarisJDgaDevFunction)(SolarisJDgaDevInfo*); -typedef JDgaStatus (*SolarisJDgaWinFunction)(SolarisJDgaWinInfo*); - -/* - * Structure for device-dependent functions - */ -typedef struct _SolarisJDgaDevFuncList { - SolarisJDgaDevFunction devclose; - SolarisJDgaWinFunction winopen; - SolarisJDgaWinFunction winclose; - SolarisJDgaWinFunction winlock; - SolarisJDgaWinFunction winunlock; -} SolarisJDgaDevFuncList; - -/* - * Function to be supplied by the device-dependent library implementor. - * It will accept a SolarisJDgaDevInfo structure with a filled-in - * major and minor version number and will return updated version - * numbers and the function pointers described below. - */ -typedef JDgaStatus SolarisJDgaDevOpenFunc(SolarisJDgaDevInfo* devInfo); - -JDgaStatus SolarisJDgaDevOpen(SolarisJDgaDevInfo* devInfo); - -/* - * Functions supplied by the device-dependent library. - * These function pointers will be returned to the - * device-independent code in the SolarisJDgaDevFunc structure. - */ - -JDgaStatus (*winopen)(SolarisJDgaWinInfo* info); - -/* - * Fills in window-specific information in the supplied SolarisJDgaWinInfo - * structure. Because multiple windows may be open concurrently, - * implementations should avoid the use of static structures. - */ - -JDgaStatus (*winclose)(SolarisJDgaWinInfo* info); - -/* - * Frees any resources allocated by the device-dependent library for - * this window. It may also perform an unmap if this is the last - * window using this particular memory map. Devices, such as the FFB, - * which support multiple depths, can have different device memory - * mappings for different depths. - */ - -JDgaStatus (*winlock)(SolarisJDgaWinInfo* info); - -/* - * Performs any device-specific locking needed for the framebuffer. - * In most cases it will be unnecessary. In those cases, the - * device-dependent library can supply NULL for this function pointer. - */ - -JDgaStatus (*winunlock)(SolarisJDgaWinInfo* info); - -/* - * Performs any device-specific unlocking needed for the framebuffer. - * In most cases it will be unnecessary. In those cases, the - * device-dependent library can supply NULL for this function pointer. - */ - -JDgaStatus (*devclose)(SolarisJDgaDevInfo* info); - -/* - * This function will be called at the last usage of the framebuffer - * device to allow the library to clean up any remaining resources. - */ - -#endif /* _JDGADEVICE_H_ */ --- old/test/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh 2017-08-15 12:14:08.192964201 -0700 +++ new/test/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh 2017-08-15 12:14:07.964964207 -0700 @@ -38,9 +38,8 @@ ${TESTJAVA}/bin/javac -d ${TESTCLASSES} SharedMemoryPixmapsTest.java cd ${TESTCLASSES} -NO_J2D_DGA=true J2D_PIXMAPS=shared -export NO_J2D_DGA J2D_PIXMAPS +export J2D_PIXMAPS ${TESTJAVA}/bin/java ${TESTVMOPTS} SharedMemoryPixmapsTest