--- a/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c Mon Sep 30 12:50:52 2013 +0400
+++ b/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c Tue Oct 01 15:36:53 2013 -0700
@@ -31,6 +31,10 @@
#include <X11/extensions/Xrender.h>
+#ifdef __linux__
+ #include <sys/utsname.h>
+#endif
+
/* On Solaris 10 updates 8, 9, the render.h file defines these
* protocol values but does not define the structs in Xrender.h.
* Thus in order to get these always defined on Solaris 10
@@ -131,7 +135,7 @@
#define MAX_PAYLOAD (262140u - 36u)
#define MAXUINT (0xffffffffu)
-static jboolean IsXRenderAvailable(jboolean verbose) {
+static jboolean IsXRenderAvailable(jboolean verbose, jboolean ignoreLinuxVersion) {
void *xrenderlib;
@@ -253,6 +257,31 @@
}
#endif
+#ifdef __linux__
+ /*
+ * Check for Linux >= 3.5 (Ubuntu 12.04.02 LTS) to avoid hitting
+ * https://bugs.freedesktop.org/show_bug.cgi?id=48045
+ */
+ struct utsname utsbuf;
+ if(uname(&utsbuf) >= 0) {
+ int major, minor, revision;
+ if(sscanf(utsbuf.release, "%i.%i.%i", &major, &minor, &revision) == 3) {
+ if(major < 3 || (major == 3 && minor < 5)) {
+ if(!ignoreLinuxVersion) {
+ available = JNI_FALSE;
+ }
+ else if(verbose) {
+ printf("WARNING: Linux < 3.5 detected.\n"
+ "The pipeline will be enabled, but graphical "
+ "artifacts can occur with old graphic drivers.\n"
+ "See the release notes for more details.\n");
+ fflush(stdout);
+ }
+ }
+ }
+ }
+#endif // __linux__
+
return available;
}
/*
@@ -262,7 +291,7 @@
*/
JNIEXPORT jboolean JNICALL
Java_sun_awt_X11GraphicsEnvironment_initXRender
-(JNIEnv *env, jclass x11ge, jboolean verbose)
+(JNIEnv *env, jclass x11ge, jboolean verbose, jboolean ignoreLinuxVersion)
{
#ifndef HEADLESS
static jboolean xrenderAvailable = JNI_FALSE;
@@ -277,7 +306,7 @@
}
#endif
AWT_LOCK();
- xrenderAvailable = IsXRenderAvailable(verbose);
+ xrenderAvailable = IsXRenderAvailable(verbose, ignoreLinuxVersion);
AWT_UNLOCK();
firstTime = JNI_FALSE;
}
@@ -294,9 +323,11 @@
XImage* defaultImg;
jfieldID maskImgID;
jlong fmt8;
+ jlong fmt24;
jlong fmt32;
jfieldID a8ID = (*env)->GetStaticFieldID(env, cls, "FMTPTR_A8", "J");
+ jfieldID rgb24ID = (*env)->GetStaticFieldID(env, cls, "FMTPTR_ARGB24", "J");
jfieldID argb32ID = (*env)->GetStaticFieldID(env, cls, "FMTPTR_ARGB32", "J");
if (awt_display == (Display *)NULL) {
@@ -304,9 +335,11 @@
}
fmt8 = ptr_to_jlong(XRenderFindStandardFormat(awt_display, PictStandardA8));
+ fmt24 = ptr_to_jlong(XRenderFindStandardFormat(awt_display, PictStandardRGB24));
fmt32 = ptr_to_jlong(XRenderFindStandardFormat(awt_display, PictStandardARGB32));
(*env)->SetStaticLongField(env, cls, a8ID, fmt8);
+ (*env)->SetStaticLongField(env, cls, rgb24ID, fmt24);
(*env)->SetStaticLongField(env, cls, argb32ID, fmt32);
maskData = (char *) malloc(32*32);