Ubuntu 11.10 64bit and AWT vs. NEWT

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Ubuntu 11.10 64bit and AWT vs. NEWT

Martin Hegedus
Just recently installed Ubuntu 11.10 64bit and am having problems running jogl applications.  When I try to run a jogl code all I get is a frozen window and the GLCanvas is white.  So it hasn't repainted itself to black yet.  I installed gluegen and jogl according to the build instructions.  I did run junit.run and things seemed resonable, well until the windowing system froze, but that may be because of Ubuntu's Unity windowing system.

So then I grabbed the TestGears programs.  Strangely, TestGearsAWT does not work but TestGearsNEWT does work.  I did not go through ant when running the TestGears programs since I'm not familiar with how that is done.  I just copied the TestGearsAWT.java, TestGearsNEWT.java and Gears.java files and got them to compile.

At the top level, the only difference is with using GLCanvas or GLWindow.  I dug into GLWindow.java but can't figure out the magic which makes TestGearsNEWT work.  Anyone have any ideas?  Both programs work under SUSE 10.1 (32 and 64).  The machine which now has Ubuntu was configured with SUSE 10.1 64, and jogl worked with that too.

Here is the source code for TestGearsAWT
import java.awt.Frame;
import javax.media.opengl.awt.GLCanvas;
import com.jogamp.opengl.util.Animator;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
import java.lang.reflect.InvocationTargetException;

public class TestGearsAWT {
    static long duration = 500; // ms
   
    public static void main(String args[]) {
        try {
            (new TestGearsAWT()).runTestGL();
        } catch (Exception e) {
        }
    }
   
    protected void runTestGL() throws InterruptedException, InvocationTargetException {
        final Frame glWindow = new Frame();
        glWindow.setTitle("Gears AWT Test");
       
        final GLCanvas glCanvas = new GLCanvas(new GLCapabilities(GLProfile.getDefault()));
        glWindow.add(glCanvas);
       
        glCanvas.addGLEventListener(new Gears());
       
        Animator animator = new Animator(glCanvas);
       
        glWindow.setSize(512,512);
        javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
                public void run() {
                    glWindow.setVisible(true);
                }});
        animator.setUpdateFPSFrames(60, System.err);
        animator.start();
       
        while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
            Thread.sleep(100);
        }
       
        animator.stop();
        glWindow.setVisible(false);
        javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
                public void run() {
                    glWindow.remove(glCanvas);
                    glWindow.dispose();
                }});
    }
}

Here is the source code for TestGearsNEWT.java
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.Animator;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;

public class TestGearsNEWT {
    static long duration = 500; // ms
   
    public static void main(String args[]) {
        try {
            (new TestGearsNEWT()).runTestGL();
        } catch (Exception e) {
        }
    }
   
    protected void runTestGL() throws InterruptedException {
        GLWindow glWindow = GLWindow.create(new GLCapabilities(GLProfile.getDefault()));
        glWindow.setTitle("Gears NEWT Test");
       
        glWindow.addGLEventListener(new Gears());
       
        Animator animator = new Animator(glWindow);
       
        glWindow.setSize(512,512);
        glWindow.setVisible(true);
        animator.setUpdateFPSFrames(60, System.err);
        animator.start();
       
        while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
            Thread.sleep(100);
        }
       
        animator.stop();
        glWindow.destroy();
    }
}
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

gouessej
Administrator
NEWT and AWT are very different. For example, the full screen mode is still  broken in AWT whereas it works with NEWT.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Martin Hegedus
Thanks for your reply, but that did not help to debug my problem.  Yes, looking at GLWindow.java I see that there is a lot going on.  When you looking at the Gears AWT program, did you notice if something was wrong with it?  Unfortunately I'm in the position where I need to figure out what is going on.  Is it Ubunto?  Is it the program?  Is it JOGL?  Is it hardware?  I don't mind helping to debug this, if I can, but I hope people help out.  I'm by no means an expert with JOGL.
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Martin Hegedus
After diving into this some, it seems that the program freezes within the native routines when calling glXMakeContextCurrent.

So if I use AWT it doesn't work and if I use NEWT it does work.

I'm not really positive what Ubuntu OpenGL library it uses, but I did down load Mesa and the header files belong to version 7.6 of Mesa.
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Sven Gothel
Administrator
On Friday, January 13, 2012 05:26:24 AM Martin Hegedus [via jogamp] wrote:
>
> After diving into this some, it seems that the program freezes within the
> native routines when calling glXMakeContextCurrent.
>
> So if I use AWT it doesn't work and if I use NEWT it does work.
>
> I'm not really positive what Ubuntu OpenGL library it uses, but I did down
> load Mesa and the header files belong to version 7.6 of Mesa.

Yes, I also experienced some freezes @ glXMakeContextCurrent a long time ago,
but not w/ latest JOGL and latest drivers though.

Wiki -> Bugreport: http://forum.jogamp.org/Problem-with-GLProfile-and-jogl2-rc2-td3447491.html#a3447546

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Martin Hegedus
Platform:
OS: Ubuntu 11.10

Architecture:
Dual Intel Xeon Quad Core E5462 2.8Ghz 1600Mhz FSB
E-GEFORCE PCIE 256MB VGA 450MHZ 8400GS DX10 HDCP 64BIT LOW PROFILE

Software:
gcc: version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
java: compiled with 1.6.0_06 which was installed separately by me
         version which comes with Ubunto is 1.6.0_23
opengl:  2.1 Mesa 7.11 (I got info from test_dbg.log)
gluegen and jogl:  latest with git
ant: 1.8.2
git: 1.7.5.4
various required libraries (mesa, etc.) were downloaded with Ubuntu Software Center
driver:  Whatever comes with Ubunto

From the test_dbg file there are some Exceptions, but I think those are just to get stack traces.  Also, there are some Lookup-Native ... ** FAILED **, but not sure if that is a bad thing.

I've included links to the following files:
http://www.hegedusaero.com/jogl/test_dbg.log.txt
http://www.hegedusaero.com/jogl/JOGL_test.java.txt (my simple test program which freezes)
http://www.hegedusaero.com/jogl/JOGL_test.out.txt (output from the file)
I used the following command to execute the program
/usr/local/java/bin/java -Dnewt.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Djogamp.debug=all JOGL_test > & ! JOGL_test.out

I'll keep working on this.  Please let me know if you see anything odd in the files.
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Martin Hegedus
OK, the reason the program "locks up" is that the cpu goes wild.  So possibly an infinite loop in glXMakeContextCurrent.

How do I determine what driver I'm using and what is the recommend one for my card?
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

gouessej
Administrator
Why not using glxinfo in command line? Please use a more recent version of Java (Oracle Java 1.6 update 30, Oracle Java 1.7 update 2 or OpenJDK).

There is no animator in your example, please use the one I put on Wikipedia.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Martin Hegedus
Sorry, I'm new to this Ubuntu Unity thing.  And it's been a while since I've dug into system admin.  My core skills are aerodynamics, computational fluid dynamics (CFD), and user interface programing using java.  I'm happy when I can go a year without really touching my machines.  :)

Ubuntu's System Info tells me I'm using Gallium 0.4 on NV86 and glxinfo (which was installed from Ubuntu Software Center) tells me "OpenGL render string: Gallium 0.4 on NV86"  So I guess that's my driver.  Here is the output from glxinfo  http://www.hegedusaero.com/jogl/glxinfo.out.txt

The JOGL_test.java program I attached exhibits the same problem as the TestGears one.  So I'm focusing on that since it is easier for me to wrap my head around.

At the moment I'm focusing on the following as my issues because of the runaway cpu in glXMakeContextCurrent
1)  Driver
2)  Mesa

This is not to say that some unexpected feedback between JOGL, Java, Mesa, and Drivers is not causing the problem.  But, I would like to build confidence in the driver first.
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Sven Gothel
Administrator
On Saturday, January 14, 2012 12:12:46 AM Martin Hegedus [via jogamp] wrote:

>
> Sorry, I'm new to this Ubuntu Unity thing.  And it's been a while since I've
> dug into system admin.  My core skills are aerodynamics, computational fluid
> dynamics (CFD), and user interface programing using java.  I'm happy when I
> can go a year without really touching my machines.  :)
>
> Ubuntu's System Info tells me I'm using Gallium 0.4 on NV86 and glxinfo
> (which was installed from Ubuntu Software Center) tells me "OpenGL render
> string: Gallium 0.4 on NV86"  So I guess that's my driver.  Here is the
> output from glxinfo  http://www.hegedusaero.com/jogl/glxinfo.out.txt
>
> The JOGL_test.java program I attached exhibits the same problem as the
> TestGears one.  So I'm focusing on that since it is easier for me to wrap my
> head around.
>
> At the moment I'm focusing on the following as my issues because of the
> runaway cpu in glXMakeContextCurrent
> 1)  Driver
> 2)  Mesa
>
> This is not to say that some unexpected feedback between JOGL, Java, Mesa,
> and Drivers is not causing the problem.  But, I would like to build
> confidence in the driver first.

I will test your test-app tomorrow.

Most likely it's a driver bug .. confused w/ our multithreading context use,
at least this was always the case in the past.

You can verify it by just using Mesa3D's pure software driver w/o gallium.
BTW .. 'Gallium on NV86' means NVidia ? In this case we may talk about the
reengineered Novum (?) driver (sorry, not sure about the name).
If so .. you really should avoid it for a stable development platform
and use NVidia's proprietory closed source driver.
With the latter - it will just work.

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Martin Hegedus
In reply to this post by Martin Hegedus
Wow, what a can of worms.

Under System Settings, Additional Drivers I've go four choices
1) NVIDIA accelerated graphics driver (version 173)
2) NVIDIA accelerated graphics driver (post-release updates) (version 173-updates)
3) NVIDIA accelerated graphics driver (version current) [Recommended]
4) NVIDIA accelerated graphics driver (post-release updates) (version current-updates)

And I've got five programs
A) JOGL_test
B) TestGearsAWT
C) TestGearsNEWT
D) glxgears (from the mesa demo I downloaded and compiled)
E) Aero_Troll (thats my code which is a big bowl of spaghetti)

When I use driver 1 and 2 JOGL_test, TestGearsAWT, TestGearsNEWT, and glxgears work.  Aero_Troll is locked up.  But that could be for any number of reasons at this point.

When I use driver 3 and 4 all five programs cause the screen to go black and then the screen comes back.  JOGL_test runs but if I move it or resize it, the screen goes black and comes back.  TestGearsAWT and NEWT seem to have come and gone during the blackout period.  At least TestGearsAWT doesn't suffer from runaway cpu.  glxgears keeps running since it does not have a timeout.  It too suffers from the blackouts whenever it is resized.  Aero_Troll is locked up.   The black in and out may be some sort of Ubuntu thing.  Under Ubuntu, the windows, in general, faze in when they are started.  Gives it a nice warm fuzzy feeling.  :p

Gallium =>  http://en.wikipedia.org/wiki/Gallium3D 

"'Gallium on NV86' means NVidia ? In this case we may talk about the reengineered Novum (?) driver"  Correct.

Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Martin Hegedus
Oh, glxgears works under Gallium but glxgears.c uses XCreateWindow and glXCreateContext.  So I guess it interfaces with Xlib directly.  Is that similar to NEWT?  Maybe the widget class used by Motif (Xt layer) or GTK+, Qt, etc. would be different.  That may be more similar to AWT?  I'm not sure if Java interfaces directly with Xlib or goes through Xt.
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Sven Gothel
Administrator
On Saturday, January 14, 2012 02:25:16 AM Martin Hegedus [via jogamp] wrote:
>
> Oh, glxgears works under Gallium but glxgears.c uses XCreateWindow and
> glXCreateContext.  So I guess it interfaces with Xlib directly.  Is that
> similar to NEWT?  
Yes. NEWT uses plain ole and 'simple' Xlib :)

> Maybe the widget class used by Motif (Xt layer) or GTK+,
> Qt, etc. would be different.  That may be more similar to AWT?  
Yes.

> I'm not sure
> if Java interfaces directly with Xlib or goes through Xt.
Hmm .. don't remember. No more motif for sure, AFAIK plain Xlib too
or it has gtk dependencies.

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Sven Gothel
Administrator
In reply to this post by Martin Hegedus
On Saturday, January 14, 2012 02:04:09 AM Martin Hegedus [via jogamp] wrote:

>
> Wow, what a can of worms.
>
> Under System Settings, Additional Drivers I've go four choices
> 1) NVIDIA accelerated graphics driver (version 173)
> 2) NVIDIA accelerated graphics driver (post-release updates) (version
> 173-updates)
> 3) NVIDIA accelerated graphics driver (version current) [Recommended]
> 4) NVIDIA accelerated graphics driver (post-release updates) (version
> current-updates)
>

173 ?

Don't know I currently use:
  NVIDIA-Linux-x86_64-285.05.09: 4.2.0 NVIDIA 290.10

AFAIK ubuntu uses the latest  NV driver .. hmm

> And I've got five programs
> A) JOGL_test
> B) TestGearsAWT
> C) TestGearsNEWT
> D) glxgears (from the mesa demo I downloaded and compiled)
> E) Aero_Troll (thats my code which is a big bowl of spaghetti)
>
> When I use driver 1 and 2 JOGL_test, TestGearsAWT, TestGearsNEWT, and
> glxgears work.  Aero_Troll is locked up.  But that could be for any number
> of reasons at this point.
ok.

>
> When I use driver 3 and 4 all five programs cause the screen to go black and
> then the screen comes back.  JOGL_test runs but if I move it or resize it,
> the screen goes black and comes back.  TestGearsAWT and NEWT seem to have
> come and gone during the blackout period.  At least TestGearsAWT doesn't
> suffer from runaway cpu.  glxgears keeps running since it does not have a
> timeout.  It too suffers from the blackouts whenever it is resized.
> Aero_Troll is locked up.   The black in and out may be some sort of Ubuntu
> thing.  Under Ubuntu, the windows, in general, faze in when they are
> started.  Gives it a nice warm fuzzy feeling.  :p

I use kubuntu 11.10 and 10.* w/o problems .. hmm.
With and w/o compositor (effects, transparency).

Sure, could be some gnome thing and it's compositor,
but last test on CentOS (a while back) and Debian test went ok.

Never had this black in/out 'experience'.
NV 8400GS ? Hmm .. tests on an old MBP w/ an NV 8xxx worked fine as well.

>
> Gallium =>  http://en.wikipedia.org/wiki/Gallium3D 
>
> "'Gallium on NV86' means NVidia ? In this case we may talk about the
> reengineered Novum (?) driver"  Correct.

Don't know the state of those drivers .. well.

Just know that Mesa also lacks of pbuffer support,
last time I checked (2 weeks?).

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Martin Hegedus
I installed the drivers using the System Settings->Additional Drivers window.

By means of glxinfo,
(version 173-updates) is 2.1.2 NVIDIA 173.14.30
(version current-updates) is 3.3.0 NVIDIA 280.13

I guess Ubuntu's "current" is not the latest driver and Ubuntu needs to do more OpenGL testing.  They sure don't make supporting an application easy.

I guess at the moment I'll stick with 173.  It would be nice to get it working on the the other drivers.  But, I do think it is now out of JOGL's hands.

Thanks for your help!
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Martin Hegedus
For a bit of closure, I installed 3.3.0 NVIDIA 290.0 and still get the same black flash.  I also ran glxinfo to confirm and it does return 3.3.0 NVIDIA 290.10 as the version string.  Oh well.

Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

gouessej
Administrator
Is it the "Nouveau" driver?

@Sven You mean "Nouveau", not "Novum". I don't know why Nvidia gave it a French name.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Ubuntu 11.10 64bit and AWT vs. NEWT

Sven Gothel
Administrator
On Saturday, January 14, 2012 12:14:30 PM gouessej [via jogamp] wrote:
>
> Is it the "Nouveau" driver?
>
> @Sven You mean "Nouveau", not "Novum". I don't know why Nvidia gave it a
> French name.

Yup, it's not from NVidia, but some folks re-engineering driver to create
an open source one out of a black box. This is in contrast to the open source
AMD driver using official specs and provided source samples.

~Sven