Bug 161

Summary: NVidia stereo driver support
Product: [JogAmp] Jogl Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: VERIFIED WORKSFORME    
Severity: normal    
Priority: P3    
Version: 1   
Hardware: All   
OS: windows   
Type: DEFECT SCM Refs:
Workaround: ---
Attachments: first hs_err.log, without noddraw=true option
second one, noddraw=true option give
Fullscreen version of Gears demo
Helper class for fullscreen Gears demo

Description Sven Gothel 2010-03-24 07:47:49 CET


---- Reported by amusi 2005-05-18 00:35:29 ----

NVidia stereo driver support

The NVidia stereo driver supports various stereo display devices and is
installed as an add-on-driver to the standard NVidia graphics driver. It can be
found here: 

  http://www.nvidia.com/object/3dstereo_71.89

When activating the stereo support in the additionally installed settings tab in
the control panel of the NVidia driver the JVM crashes with a
EXCEPTION_ACCESS_VIOLATION
(
   #
   # An unexpected error has been detected by HotSpot Virtual Machine:
   #
   #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x65422030, pid=2916, tid=2336
   #
   # Java VM: Java HotSpot(TM) Client VM (1.5.0_03-b07 mixed mode, sharing)
   # Problematic frame:
   # C  0x65422030
   #

[..]
)

as soon as the Canvas gets drawn. This problem occurs also on older JVMs like
the Java 1.4.2 and older betas of the Java 5 JVM. It also crashes on Windows
2000. It crashes in both windowed and fullscreen mode. And it also crashes if
the stereo driver is only made available to be turned on via hotkey after the
application has started( "Enabled by Hot Key"-setting).
The testcase is as simple as this: If you have an NVidia card in your system,
download this driver, it has also anaglyph support(color filter glasses) and
does not need additional hardware to activate the stereo mode. It needs the
corresponding graphics driver version in order to work, i.e. the NVidia graphics
driver version 71.89 when downloading the stereo driver mentioned in the url
above. No change of the application is neccessary for the testcase, no stereo
GLCapabilities or whatsoever. But in order to be able to have full stereo mode
on the display, fullscreen exclusive mode is vital.



---- Additional Comments From kbr 2005-05-25 12:02:52 ----

I just upgraded to the 71.89 drivers and installed the stereo package. There
were some bugs during the installation including the screen going blank when
stereo mode was enabled. Once I got past that I tried running the JOGL gears
demo from the command line which promptly crashed the machine. After it rebooted
everything is miraculously working on a GeForce FX 5800 Ultra. I enabled
anaglyph stereo (because I don't have a pair of stereo glasses) and found that
windowed JOGL demos don't appear in stereo mode, but full-screen ones do; the
Grand Canyon demo ran successfully in full-screen mode with anaglyph stereo with
1.4.2_06.

Could you please attach the full hs_err log from the process when it crashes?
Also, do you have a small C program which works properly and the Java analog
which doesn't? For example, the GLUT version of the Gears demo in comparison to
the JOGL demos.gears.Gears. Could you please attach a test case? Are you running
with stereo glasses or in anaglyph mode? Are you running with the command line
option -Dsun.java2d.noddraw=true ? This is required for correct operation of
JOGL programs.




---- Additional Comments From amusi 2005-05-26 01:48:07 ----

Created an attachment
first hs_err.log, without noddraw=true option




---- Additional Comments From amusi 2005-05-26 01:48:59 ----

Created an attachment
second one, noddraw=true option give




---- Additional Comments From amusi 2005-05-26 01:52:16 ----

The option -Dsun.java2d.noddraw=true didn't solve the problem, the crash still
occurs. I am using shutter glasses, but changing the nvidia stereo settings to
anaglyph mode also leads to a crash. Unfortunately I don't write C programs so I
cannot provide you with one. The only thing I could provide you is the working
and not crashing Java3d Gears demo, which I modified to run in fullscreenmode. I
am using a GeForce 4200Ti with 128 MB and it appears that some applications seem
to crash more often on my system than on others, especially firefox though I
know that in this particular case on other machine firefox does not crash that
often or at all. 
I attached two different hs_err.logS below: the first is without the noddraw
option, the second is with noddraw option. The second one shows that a nvidia
dll seems to contain the problematic code. My conclusion so far is, that the
developers of Java3d seem to have found a workaround for a bug in the nvidia
driver. But there could also be a problem on my particular system. And yes,
stereo mode only works in fullscreen. 
I also tried to turn off the stereo driver and starting the java app afterwards,
then there is no crash until I switch from windowed to fullscreen mode or vice
versa. As you can see this is the HWShadowmapsSimple demo from JOGL examples,
one of the view examples that my gfx card can still run. I also tried the Gears
example, but unfortunately the JVM simply terminates without any error. As soon
as I turn off stereo, the Gears demo works fine. 

So this would propably be the testcase then. The JOGL Gears demo compared to the
Java3D Gears demo which runs fine in stereo. It also might be sufficient to
leave those two demos as they are without modifying them to run in fullscreen
mode, as the crash occurs also in windowed mode. I assume that as soon as the
crash problem is fixed JOGL applications will run with stereo mode enabled on my
system.





---- Additional Comments From kbr 2005-05-26 02:18:32 ----

It's surprising that the crash is occurring on the main thread in the NVidia
drivers because JOGL is supposed to do most or all of its work on the AWT event
queue thread. It's possible that the creation of the so-called "dummy GL" used
for pixel format selection is occurring on the main thread. I wish the stack
traces weren't truncated. What JOGL version are you running? What is the output
of jogl -Djogl.verbose demos.gears.Gears? If you aren't running the latest
version (reported probably as 1.1 b11 or incorrectly as 1.1 b12) could you
please upgrade? Is it possible for you to modify the Gears demo and insert
Thread.dumpStack() calls to narrow down where the crash is occurring?




---- Additional Comments From amusi 2005-05-26 03:00:13 ----

Well, I am sooo sorry. I just realized that in Eclipse, I mistakenly had still
some old jogl library bound to the JOGL application though I thought the new one
was already set. With the b11 jogl library, everything runs fine without crash
and stereo enabled. But still I couldn't enable the stereo mode with just the
-Dsun.java2d.noddraw=true option set. It had to be -Dsun.java2d.opengl=True
instead which seems to force opengl rendering wherever possible. Then I get
stereo enable in fullscreen. Ken, did it work for you with the noddraw option alone?



---- Additional Comments From kbr 2005-05-26 15:06:34 ----

Yes, it works for me with just the sun.java2d.noddraw=true option. I'm attaching
a modified version of the Gears demo plus a utility class which works for me in
stereo.




---- Additional Comments From kbr 2005-05-26 15:07:57 ----

Created an attachment
Fullscreen version of Gears demo




---- Additional Comments From kbr 2005-05-26 15:08:23 ----

Created an attachment
Helper class for fullscreen Gears demo




---- Additional Comments From kbr 2005-05-26 15:08:41 ----

Closing bug as "works for me".




--- Bug imported by sgothel@jausoft.com 2010-03-24 07:47 EDT  ---

This bug was previously known as _bug_ 161 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=161
Imported an attachment (id=52)
Imported an attachment (id=53)
Imported an attachment (id=54)
Imported an attachment (id=55)

The original submitter of attachment 52 [details] is unknown.
   Reassigning to the person who moved it here: sgothel@jausoft.com.
The original submitter of attachment 53 [details] is unknown.
   Reassigning to the person who moved it here: sgothel@jausoft.com.
The original submitter of attachment 54 [details] is unknown.
   Reassigning to the person who moved it here: sgothel@jausoft.com.
The original submitter of attachment 55 [details] is unknown.
   Reassigning to the person who moved it here: sgothel@jausoft.com.