changeset 5206:e9eb2ae5945d

Fix to RT-28138: FX crash on linux using launcher Reviewed-by: Kevin Rushforth, Felipe Heidrich
author Chien Yang <chien.yang@oracle.com>
date Sat, 28 Sep 2013 09:12:55 -0700
parents aa2b54350f69
children a903be4a8453
files modules/graphics/src/main/native-prism-es2/x11/X11GLFactory.c
diffstat 1 files changed, 37 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/native-prism-es2/x11/X11GLFactory.c	Fri Sep 27 16:47:55 2013 -0700
+++ b/modules/graphics/src/main/native-prism-es2/x11/X11GLFactory.c	Sat Sep 28 09:12:55 2013 -0700
@@ -102,6 +102,39 @@
     }
 }
 
+jboolean queryGLX13(Display *display) {
+
+    int major, minor;
+    int errorBase, eventBase;
+
+    if (!glXQueryExtension(display, &errorBase, &eventBase)) {
+        fprintf(stderr, "ES2 Prism: Error - GLX extension is not supported\n");
+        fprintf(stderr, "    GLX version 1.3 or higher is required\n");
+        return JNI_FALSE;
+    }
+
+    /* Query the GLX version number */
+    if (!glXQueryVersion(display, &major, &minor)) {
+        fprintf(stderr, "ES2 Prism: Error - Unable to query GLX version\n");
+        fprintf(stderr, "    GLX version 1.3 or higher is required\n");
+        return JNI_FALSE;
+    }
+
+    /*
+        fprintf(stderr, "Checking GLX version : %d.%d\n", major, minor);
+     */
+
+    /* Check for GLX 1.3 and higher */
+    if (!(major == 1 && minor >= 3)) {
+        fprintf(stderr, "ES2 Prism: Error - reported GLX version = %d.%d\n", major, minor);
+        fprintf(stderr, "    GLX version 1.3 or higher is required\n");
+
+        return JNI_FALSE;
+    }
+
+    return JNI_TRUE;
+}
+
 /*
  * Class:     com_sun_prism_es2_X11GLFactory
  * Method:    nInitialize
@@ -148,6 +181,10 @@
     }
 
     screen = DefaultScreen(display);
+    
+    if (!queryGLX13(display)) {
+        return 0;
+    }
 
     fbConfigList = glXChooseFBConfig(display, screen, glxAttrs, &numFBConfigs);