< prev index next >
src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c
Print this page
@@ -37,14 +37,10 @@
#include "awt_GraphicsEnv.h"
#include <dlfcn.h>
#ifndef HEADLESS
-static JDgaLibInfo DgaLibInfoStub;
-static JDgaLibInfo theJDgaInfo;
-static JDgaLibInfo *pJDgaInfo = &DgaLibInfoStub;
-
/**
* This file contains support code for loops using the SurfaceData
* interface to talk to an X11 drawable from native code.
*/
@@ -80,12 +76,10 @@
jint lockFlags);
extern jfieldID validID;
static int nativeByteOrder;
-static jboolean dgaAvailable = JNI_FALSE;
-static jboolean useDGAWithPixmaps = JNI_FALSE;
static jclass xorCompClass;
jint useMitShmExt = CANT_USE_MITSHM;
jint useMitShmPixmaps = CANT_USE_MITSHM;
jint forceSharedPixmaps = JNI_FALSE;
@@ -105,12 +99,10 @@
} endian;
endian.i = 0xff000000;
nativeByteOrder = (endian.c[0]) ? MSBFirst : LSBFirst;
- dgaAvailable = JNI_FALSE;
-
cachedXImage = NULL;
if (sizeof(X11RIPrivate) > SD_RASINFO_PRIVATE_SIZE) {
JNU_ThrowInternalError(env, "Private RasInfo structure too large!");
return JNI_FALSE;
@@ -156,42 +148,16 @@
* Method: initIDs
* Signature: (Ljava/lang/Class;Z)V
*/
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 */
}
/*
@@ -232,25 +198,10 @@
#endif /* HEADLESS, MITSHM */
}
/*
* 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
*/
JNIEXPORT void JNICALL
Java_sun_java2d_x11_XSurfaceData_initOps(JNIEnv *env, jobject xsd,
@@ -277,11 +228,10 @@
}
} else {
xsdo->drawable = 0;
}
xsdo->depth = depth;
- xsdo->dgaAvailable = dgaAvailable;
xsdo->isPixmap = JNI_FALSE;
xsdo->bitmask = 0;
xsdo->bgPixel = 0;
xsdo->isBgInitialized = JNI_FALSE;
#ifdef MITSHM
@@ -445,14 +395,10 @@
JNU_ThrowOutOfMemoryError(env,
"Can't create offscreen surface");
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;
#ifdef MITSHM
@@ -845,33 +791,10 @@
{
JNU_ThrowNullPointerException(env, "inverse gray lookup table");
}
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;
}
xpriv->lockType = X11SD_LOCK_BY_XIMAGE;
@@ -913,47 +836,13 @@
X11RIPrivate *xpriv = (X11RIPrivate *) &(pRasInfo->priv);
jint lockFlags = xpriv->lockFlags;
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 */
XSync(awt_display, False);
xsdo->shmPMData.xRequestSent = JNI_FALSE;
@@ -962,12 +851,13 @@
xpriv->y = pRasInfo->bounds.y1;
pRasInfo->rasBase = xsdo->shmPMData.shmSegInfo->shmaddr;
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;
w = pRasInfo->bounds.x2 - x;
h = pRasInfo->bounds.y2 - y;
@@ -1024,13 +914,11 @@
SurfaceDataRasInfo *pRasInfo)
{
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) {
int x = xpriv->x;
int y = xpriv->y;
@@ -1067,11 +955,10 @@
#else
XPutImage(awt_display, drawable, xgc,
xpriv->img, 0, 0, x, y, w, h);
#endif /* MITSHM */
- (*pJDgaInfo->pXRequestSent)(env, xsdo->dgaDev, drawable);
}
X11SD_DisposeOrCacheXImage(xpriv->img);
xpriv->img = (XImage *)NULL;
}
/* the background pixel is not valid anymore */
@@ -1390,60 +1277,18 @@
#endif /* MITSHM */
XDestroyImage(image);
}
}
-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)
{
#ifdef MITSHM
if (xsdo->shmPMData.usingShmPixmap) {
xsdo->shmPMData.xRequestSent = JNI_TRUE;
}
#endif /* MITSHM */
- (*pJDgaInfo->pXRequestSent)(env, xsdo->dgaDev, xsdo->drawable);
awt_output_flush();
}
/*
* Sets transparent pixels in the pixmap to
< prev index next >