From 1b5e56cb709f2c24b58723c54cd1dd0d2784f7c9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 16 Dec 2001 04:03:13 +0000 Subject: added a temporaery workaround for the Linux X11 NVidia Driver 2314 Bug .. _some_ offscreen renderer features still does not work .. --- CNativeCode/OpenGL_X11.c | 11 +++++++---- CNativeCode/OpenGL_X11_jawt.c | 10 ++++++---- gl4java/GLContext.java.skel | 40 ++++++++++++++++++++++++++++++++-------- makefile | 2 +- 4 files changed, 46 insertions(+), 17 deletions(-) diff --git a/CNativeCode/OpenGL_X11.c b/CNativeCode/OpenGL_X11.c index 6d0dec5..30276f7 100644 --- a/CNativeCode/OpenGL_X11.c +++ b/CNativeCode/OpenGL_X11.c @@ -514,7 +514,10 @@ Java_gl4java_GLContext_gljMakeCurrentNative( JNIEnv *env, jobject obj, return JNI_FALSE; } - ctx = disp__glXGetCurrentContext(); + /** JAU NVidia 2314 Bug workaround .. + ctx = disp__glXGetCurrentContext(); + */ + if(ctx==(GLXContext)((PointerHolder)glContext)) return JNI_TRUE; @@ -638,7 +641,8 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj, else jownwind =(*env)->GetBooleanField(env, obj, fownwind); } - disp__glXWaitGL(); + if(gc!=0) + disp__glXWaitGL(); if(ret==JNI_TRUE) { @@ -649,8 +653,7 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj, fprintf(stderr, "GL4Java: gljDestroy failed, GL context is 0\n"); fflush(stderr); } - } - disp__glXMakeCurrent( disp, None, NULL ); + } else disp__glXMakeCurrent( disp, None, NULL ); if(ret==JNI_TRUE) { diff --git a/CNativeCode/OpenGL_X11_jawt.c b/CNativeCode/OpenGL_X11_jawt.c index 28f3f44..d7bd481 100644 --- a/CNativeCode/OpenGL_X11_jawt.c +++ b/CNativeCode/OpenGL_X11_jawt.c @@ -713,7 +713,9 @@ Java_gl4java_GLContext_gljMakeCurrentNative( JNIEnv *env, jobject obj, return ret; } - ctx = disp__glXGetCurrentContext(); + /** JAU NVidia 2314 Bug workaround .. + ctx = disp__glXGetCurrentContext(); + */ if(ret==JNI_TRUE && ctx!=(GLXContext)((PointerHolder)glContext) ) { @@ -866,7 +868,8 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj, win = GET_USED_WINDOW(pData); disp = GET_USED_DISPLAY(pData); - disp__glXWaitGL(); + if(gc!=0) + disp__glXWaitGL(); if(ret==JNI_TRUE) { @@ -877,8 +880,7 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj, fprintf(stderr, "GL4Java: gljDestroy failed, GL context is 0\n"); fflush(stderr); } - } - disp__glXMakeCurrent( disp, None, NULL ); + } else disp__glXMakeCurrent( disp, None, NULL ); if(ret==JNI_TRUE) { diff --git a/gl4java/GLContext.java.skel b/gl4java/GLContext.java.skel index e825218..1298f1c 100644 --- a/gl4java/GLContext.java.skel +++ b/gl4java/GLContext.java.skel @@ -2368,7 +2368,10 @@ public class GLContext extends Object if(gljThreadDebug && !dbgPrinted) { System.out.println("wait-switch: "+thisThread); - System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + /** JAU NVidia 2314 Bug workaround + * System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + */ + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext); } if(ctxThread==thisThread) @@ -2412,7 +2415,10 @@ public class GLContext extends Object if(gljThreadDebug && !dbgPrinted) { System.out.println("wait-earmarked: "+thisThread); - System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + /** JAU NVidia 2314 Bug workaround + * System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + */ + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext); dbgPrinted=true; } if( _comp instanceof GLRunnable ) @@ -2446,7 +2452,10 @@ public class GLContext extends Object return result; } else if( ctxThread!=null && ctxThread!=thisThread ) { System.out.println("MakeCurrent: ctxThread ain't zero, funny failure"); - System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + /** JAU NVidia 2314 Bug workaround + * System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + */ + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext); return result; } @@ -2460,7 +2469,10 @@ public class GLContext extends Object } else { System.out.println("MakeCurrent: "+thisThread+" "); } - System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + /** JAU NVidia 2314 Bug workaround + * System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + */ + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext); } /** @@ -2480,7 +2492,10 @@ public class GLContext extends Object if(gljThreadDebug) { System.out.println("Native MakeCurrent failed"); - System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + /** JAU NVidia 2314 Bug workaround + * System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + */ + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext); Exception e = new Exception(); e.printStackTrace(); } @@ -2690,7 +2705,10 @@ public class GLContext extends Object if(gljThreadDebug) { System.out.println("gljFree: denied, not holding context ! "); - System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + /** JAU NVidia 2314 Bug workaround + * System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + */ + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext); Exception e = new Exception(); e.printStackTrace(); } @@ -2718,14 +2736,20 @@ public class GLContext extends Object if(gljThreadDebug) { System.out.println("gljFree: gljFreeNative result: "+result); - System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + /** JAU NVidia 2314 Bug workaround + * System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + */ + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext); } } else { result = unlockJAWT(windowHandle, false); if(gljThreadDebug) { System.out.println("gljFree: no CTX change, no requests, unlockJAWT: "+result); - System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + /** JAU NVidia 2314 Bug workaround + * System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + */ + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext); } } notifyAll(); diff --git a/makefile b/makefile index d97a592..0f2bbbd 100644 --- a/makefile +++ b/makefile @@ -105,7 +105,7 @@ CNATIVEDIR = CNativeCode LIBMAJOR = 2 LIBMINOR = 8 LIBBUGFIX = 2 -RELEASE = 0 +RELEASE = 1 # # The demo release number -- cgit v1.2.3