Bug 1200

Summary: JOGL crashes on Debian8 GNU/Linux x86_64 'NVidia beta driver 355.06' @ probeSurfacelessCtx
Product: [JogAmp] Jogl Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: major CC: gouessej, sgothel, xerxes
Priority: ---    
Version: 2.4.0   
Hardware: All   
OS: all   
Type: DEFECT SCM Refs:
e88216bd03a41480b81345ed9afc45ddea5ecfcd 17af6ed1d0f60c111079ff19c4114fefbfd025fc 4fe9e1dfa67f4e5d614f48c02ad88e4cdd1ed415 bb3ee12b7aeef276a03f091333eacc68542e784b
Workaround: TRUE

Description Sven Gothel 2015-08-26 01:33:40 CEST
- Debian 8 Jessie, GNU/Linux, x86_64
- NVidia beta driver 355.06

The new beta driver claims to support OpenGL 3.0 surfaceless context,
i.e.
  'Added support to make an OpenGL 3.0 and above context current without making current to any drawable.'

However, our probe crashes JOGL.

+++

j  jogamp.opengl.x11.glx.GLX.dispatch_glXMakeContextCurrent0(JJJJJ)Z+0
j  jogamp.opengl.x11.glx.GLX.glXMakeContextCurrent(JJJJ)Z+45
j  jogamp.opengl.x11.glx.X11GLXContext.glXMakeContextCurrent(JJJJ)Z+16
j  jogamp.opengl.x11.glx.X11GLXContext.makeCurrentImpl()V+33
j  jogamp.opengl.GLContextImpl.makeCurrentWithinLock(I)I+790
j  jogamp.opengl.GLContextImpl.makeCurrent(Z)I+488
j  jogamp.opengl.GLContextImpl.setGLDrawable(Lcom/jogamp/opengl/GLDrawable;Z)Lcom/jogamp/opengl/GLDrawable;+302
j  jogamp.opengl.GLDrawableFactoryImpl.probeSurfacelessCtx(Lcom/jogamp/opengl/GLContext;Z)Z+93
j  jogamp.opengl.x11.glx.X11GLXDrawableFactory.access$300(Ljogamp/opengl/x11/glx/X11GLXDrawableFactory;Lcom/jogamp/opengl/GLContext;Z)Z+3
j  jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(Lcom/jogamp/nativewindow/AbstractGraphicsDevice;)Ljogamp/opengl/Sh

+++
Comment 1 Sven Gothel 2015-08-26 01:41:36 CEST
Thx to Xerxes for finding this issue and reporting via IIRC.
Comment 2 Sven Gothel 2015-08-26 02:04:26 CEST
- Probing passes for EGL/ES 1.1 and 3.1 context.

- Probing crashes for GLX/GL 4.5 context
  at 'context.setGLDrawable(zeroDrawable, false)'
    at 1st 'res = makeCurrent(true); // implicit: associateDrawable(true)'

  i.e. glXMakeContextCurrent does not seem to handle the zero drawable!

+++
XXX-1: X11GLXContext [Version 4.5 (Compat profile, arb, compat[ES2, ES3, ES31], FBO, hardware) - 4.5.0 NVIDIA 355.06 [GL 4.5.0, vendor 355.6.0 (NVIDIA 355.06)], options 0x3c03, this 0x222884cd, handle 0x7f51f035e270, isShared false, jogamp.opengl.gl4.GL4bcImpl@20483fa4,
         quirks: [],
        Drawable: X11OnscreenGLXDrawable[Realized true,
        Factory   jogamp.opengl.x11.glx.X11GLXDrawableFactory@83dd33,
        Handle    0x4200002,
        Surface   WrappedSurface[ displayHandle 0x7f51f00013d0
, surfaceHandle 0x4200002
, size 64x64
, UOB[ OWNS_SURFACE | WINDOW_INVISIBLE ]
, X11GLXGraphicsConfiguration[X11GraphicsScreen[X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x7f51f00013d0, owner true, ResourceToolkitLock[obj 0x

++
Comment 3 Sven Gothel 2015-08-27 20:11:44 CEST
e88216bd03a41480b81345ed9afc45ddea5ecfcd:

 Since no known NVidia driver is know properly supporting surfaceless context,
 i.e. current context w/o drawable attached, we set quirk NoSurfacelessCtx
 for all NVidia drivers until a 'good one' is known!
Comment 4 Julien Gouesse 2015-08-27 21:15:59 CEST
(In reply to comment #3)
> e88216bd03a41480b81345ed9afc45ddea5ecfcd:
> 
>  Since no known NVidia driver is know properly supporting surfaceless
> context,
>  i.e. current context w/o drawable attached, we set quirk NoSurfacelessCtx
>  for all NVidia drivers until a 'good one' is known!

I have a Nvidia GS somewhere, should I give it a try?
Comment 5 Sven Gothel 2015-08-30 02:41:48 CEST
commit 17af6ed1d0f60c111079ff19c4114fefbfd025fc

    Bug 1200: Refine fix for crash on GNU/Linux x86_64 'NVidia beta driver 355.06' @ probeSurfacelessCtx
    
    Refine commit e88216bd03a41480b81345ed9afc45ddea5ecfcd,
    i.e. restrict new 'NoSurfacelessCtx' NVidia-Vendor criteria in GLContextImpl.setRendererQuirks(..) to
      - isX11 (new)
      - isDriverNVIDIAGeForce (kept)
      - !(adevice instanceof EGLGraphicsDevice) (new)
    
    Surfaceless context seems to work on NVidia 355.06 for EGL+[ES+GL].
    It does not work for GLX+GL though!
    
    TODO: Validate changing a GLContext's GLDrawable from 'onscreen' or 'offscreen'
          to 'zero' (Surfaceless).
Comment 6 Sven Gothel 2019-11-28 02:15:17 CET
commit 4fe9e1dfa67f4e5d614f48c02ad88e4cdd1ed415

probeSurfacelessCtx works at least since NVIDIA 430.40.

Added this version as the safe version to limit GLRendererQuirks.NoSurfacelessCtx setting.
Comment 7 Sven Gothel 2019-12-08 02:50:21 CET
bb3ee12b7aeef276a03f091333eacc68542e784b
GLRendererQuirks.NoSurfacelessCtx still persists on Linux/X11 NVIDIA 440.36 using FBO
    
    Tested with com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsNewtAWT,
    which crashes in native makeCurrent of NV driver gl-core when using SurfacelessCtx.
    
    Therefor we had to revert the commit 4fe9e1dfa67f4e5d614f48c02ad88e4cdd1ed415
    enabling SurfacelessCtx with NV driver >= 430.40.