Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slow startup of OpenGL sketches with 2.0b9 on Linux #1784

Closed
monkstone opened this issue May 19, 2013 · 37 comments
Closed

slow startup of OpenGL sketches with 2.0b9 on Linux #1784

monkstone opened this issue May 19, 2013 · 37 comments
Assignees

Comments

@monkstone
Copy link
Contributor

There seem to be an absolutely huge delay in loading the NEWT canvas on linux (Kubuntu). Any sketch with P2D or or P3D, takes forever to load on Kubuntu (64bit), whilst Java2D sketches run OK. The actual performance once loaded for say esfera sketch seems OK. However the issue is even worse on ArchLinux with Fluxbox or XFCE desktops as the canvas fails to load (a frame displays but is greyed out), so no P3D or P2D sketches run. Processing-2.0b8 works fine on all above systems.
OK I've done a bit more experimenting, and curiously I seem to be getting better results launching sketches via the command line, well actually from jEdit (can't do with all that typing), except I need to 'hide' the jEdit frame to get the sketch frame to render sketches, so it seems there may some sort of "windowing issue". I actually came to this from updating ruby-processing, and I'm now beginning to doubt whether the sketches actually ran at all from the processing-ide (I tried re-running sketches from Kubuntu and no P2D, P3D sketches ran.

@kles4enko
Copy link

I have same problem. Sketches with P2D/P3D renderers are not running. OS: openSuse 12.3 x64.
All works in beta 8.

@darkwave
Copy link

Just tried Processing 2.0beta9 and I'm having the same issue on Xubuntu 12.04 (latest nvidia driver for GEFORCE 610M 2GB): no sketch run when using P2D or P3D. :-(

@monkstone
Copy link
Contributor Author

Having some sucess with ArchLinux by minimising the ide once I get greyed out sketch (esfera) then miraculously sketch runs (xfce), suggest it might work for @darkwave.
Now when sketch run get this message in console:-
libEGL warning DRI2: failed to authenticate NewtCanvasAWT attachNewChild.2 size 1024 x 768
Now since I'm using manufacturers driver (NVIDIA) I normally ignore such warnings as DRI2 is probably legacy xorg but I'm not sure might work with Nouveau driver but perfomance would be crap.

@monkstone monkstone reopened this May 19, 2013
@darkwave
Copy link

The bug seems to persist when using optirun to run processing with Bumblebee ...

@monkstone you are right: sketches run if minimized and restored.

@monkstone
Copy link
Contributor Author

@darkwave, @ii8 a sneaky fix seems to have been released, latest source from github version 0218 seems to have fixed problem for me, I haven't checked dowload yet.

@darkwave
Copy link

The downloadable version seems to have the issue. Still open?

@monkstone monkstone reopened this May 19, 2013
@monkstone
Copy link
Contributor Author

There also seem to be issues on 64bit windows version as well from the discusssion board, as well. I actually first noticed the issue following download of the Mac distro from which I extracted relevant binaries for use with ruby-processing. Could it be the build? Strange that the not much changed version on github seems to be OK!!

@kles4enko
Copy link

continue....
if I use this
size(displayWidth, displayHeight, OPENGL);
I have same problem with P3D/P2D, but with this outout:

NewtCanvasAWT.attachNewtChild.2: size 1366x768
NewtCanvasAWT.attachNewtChild.2: size 1366x768
java.lang.RuntimeException: java.lang.NullPointerException
at jogamp.newt.DefaultEDTUtil.invokeImpl(DefaultEDTUtil.java:220)
at jogamp.newt.DefaultEDTUtil.invoke(DefaultEDTUtil.java:135)
at jogamp.newt.DisplayImpl.runOnEDTIfAvail(DisplayImpl.java:207)
at jogamp.newt.WindowImpl.runOnEDTIfAvail(WindowImpl.java:1635)
at jogamp.newt.WindowImpl.reparentWindow(WindowImpl.java:1296)
at jogamp.newt.WindowImpl.reparentWindow(WindowImpl.java:1291)
at com.jogamp.newt.opengl.GLWindow.reparentWindow(GLWindow.java:363)
at com.jogamp.newt.awt.NewtCanvasAWT.attachNewtChild(NewtCanvasAWT.java:582)
at com.jogamp.newt.awt.NewtCanvasAWT.validateComponent(NewtCanvasAWT.java:505)
at com.jogamp.newt.awt.NewtCanvasAWT.paint(NewtCanvasAWT.java:426)
at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
at sun.awt.X11.XRepaintArea.paintComponent(XRepaintArea.java:56)
at sun.awt.RepaintArea.paint(RepaintArea.java:224)
at sun.awt.X11.XComponentPeer.handleEvent(XComponentPeer.java:677)
at java.awt.Component.dispatchEventImpl(Component.java:4736)
at java.awt.Component.dispatchEvent(Component.java:4488)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:668)
at java.awt.EventQueue.access$400(EventQueue.java:81)
at java.awt.EventQueue$2.run(EventQueue.java:627)
at java.awt.EventQueue$2.run(EventQueue.java:625)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:641)
at java.awt.EventQueue$3.run(EventQueue.java:639)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:638)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.NullPointerException
at com.jogamp.nativewindow.awt.JAWTWindow.lockSurface(JAWTWindow.java:368)
at jogamp.newt.WindowImpl$ReparentAction.reparent(WindowImpl.java:1192)
at jogamp.newt.WindowImpl$ReparentAction.run(WindowImpl.java:1019)
at com.jogamp.common.util.RunnableTask.run(RunnableTask.java:112)
at jogamp.newt.DefaultEDTUtil$EventDispatchThread.run(DefaultEDTUtil.java:331)

@fukuchi
Copy link

fukuchi commented May 20, 2013

I tested some versions between b8 and b9, and found that 17a2117 breaks P2D/P3D.

@monkstone
Copy link
Contributor Author

Yet the weird thing is that the current source (version 0218) includes the same binaries, and yet I can build and run that on Archlinux with none of the above issues. However I have issues when I tried to build and run the same under Kubuntu.
Actually this is spooky get original problem with build from latest source on another Archlinux, however I found an even cooler temporary fix "drag sketch to new desktop and it runs".

@kles4enko
Copy link

Look, from 17a2117 :
removed this: toolkit = NEWT;
added this: toolkit = AWT;

But this is present:
if (events == NEWT) {
NEWTMouseListener mouseListener = new NEWTMouseListener();

@fukuchi
Copy link

fukuchi commented May 21, 2013

Hi, it's a good hint for me, @kles4enko.

I tried AWT instead of NEWT in Linux and it worked well. There must be some issues in NEWT.

--- a/core/src/processing/opengl/PGL.java
+++ b/core/src/processing/opengl/PGL.java
@@ -148,8 +148,8 @@ public class PGL {
       toolkit = AWT;
       events = AWT;
     } else if (PApplet.platform == PConstants.LINUX) {
-      toolkit = NEWT; // AWT extremely broken on Linux?
-      events = NEWT;
+      toolkit = AWT; // AWT extremely broken on Linux?
+      events = AWT;
     } else if (PApplet.platform == PConstants.OTHER) {
       toolkit = NEWT; // NEWT should work on the Raspberry pi
       events = NEWT;

@fukuchi
Copy link

fukuchi commented May 21, 2013

toolkit = AWT; events = NEWT; also worked well.

@kles4enko
Copy link

@fukuchi great!

@monkstone
Copy link
Contributor Author

May'be @fukuchi could issue a pull request whilst we are at I'd like to point out the possibility of requesting different look and feels via preferences.txt
checkout this:-

editor.laf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
editor.laf.linux=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel

or even metal which on my system looks better than the default gtk L&F
This feature is apparently uniquley only available to linux users.

@ghost ghost assigned codeanticode May 22, 2013
@monkstone
Copy link
Contributor Author

I just checked the included gluegen and jogl jars (processing-2.0b9), both were compiled with jdk-1.6 (Created-By: 1.6.0_37-b06-434-11M3909 (Apple Inc.)).
Whereas the working versions (processing-2.0b8 and latest github version) Created-By: 1.7.0_13-b20 (Oracle Corporation).
I suppose it will only be a matter of time before processing is compiled with jdk-1.7 (works ok for me custom build just remove the source and target flags).

@aib
Copy link

aib commented May 23, 2013

Same error (never patient enough to wait for canvas creation, don't know whether it takes long or forever), bisected to 17a2117.

Linux vivaldi 3.5.0-27-generic #46-Ubuntu SMP Mon Mar 25 19:58:17 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01, mixed mode)

@interstar
Copy link

I have same problem on Ubuntu 12.04 (All versions of Processing 2.X that I've tried so far)

@monkstone
Copy link
Contributor Author

You should find processing-2.0b8 and earlier work OK, otherwise your issue may be related to your video-card and or driver (check the discussion board).

@interstar
Copy link

No. None of the 2.Xs work. I've tried 2.0b7, 2.0b8, 2.0b9

1.5 still works though so at some level the drivers are presumably working on my machine. Do you have any idea what layer I should be looking at with the 2.0s?

For example in 2.08 in a sketch in P3D I get this :

libEGL warning: failed to create a pipe screen for i965
Framebuffer error (incomplete attachment), rendering will probably not work as expected
OpenGL error 1280 at bot beginDraw(): invalid enumerant
OpenGL error 1286 at bot endDraw(): invalid framebuffer operation
OpenGL error 1286 at bot beginDraw(): invalid framebuffer operation
OpenGL error 1286 at top endDraw(): invalid framebuffer operation

Same code works fine in 1.5.

@monkstone
Copy link
Contributor Author

Yeah but can you run OPENGL sketches on processing-1.5.1 (since processing-2.0 P3D is OPENGL2)

@interstar
Copy link

Yes, I can do

import processing.opengl.*;

and then

create my window with : size(1024,768,OPENGL);

@monkstone
Copy link
Contributor Author

As I suggested earlier your issue is not a bug, you should look to the processing forum, perhaps starting here:-
https://forum.processing.org/topic/if-your-pc-doesn-t-support-opengl-2-you-are-out-of-processing-development

@monkstone
Copy link
Contributor Author

Returning to processing-2.0b9 issue, here is the console output when trying to run frequenceModulation example sketch (which for some mysterious reason [integrated graphics and sound?] uses P3D)
NewtCanvasAWT.attachNewtChild.2: size 512x200
X11Util.Display: Shutdown (JVM shutdown: false, open (no close attempt): 3/3, reusable (open, marked uncloseable): 0, pending (open in creation order): 3)
X11Util: Open X11 Display Connections: 3
X11Util: Open[0]: NamedX11Display[:0.0, 0x7f4090331ee0, refCount 1, unCloseable false]
X11Util: Open[1]: NamedX11Display[:0.0, 0x7f409806fe00, refCount 1, unCloseable false]
X11Util: Open[2]: NamedX11Display[:0.0, 0x7f409807e330, refCount 1, unCloseable false]
X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 3/3, reusable (open, marked uncloseable): 0, pending (open in creation order): 3)
X11Util: Open X11 Display Connections: 3
X11Util: Open[0]: NamedX11Display[:0.0, 0x7f4090331ee0, refCount 1, unCloseable false]
X11Util: Open[1]: NamedX11Display[:0.0, 0x7f409806fe00, refCount 1, unCloseable false]

Sketch failed to run with latest compiled source, until I drag it to a new desktop (ArchLinux). Change the sketch to default from P3D and it runs OK

@codeanticode
Copy link
Member

hello guys, thanks for the detailed report and discussion. I'm able to reproduce the initialization freezes, at least with an ubuntu 12.10 64bit machine with a radeon card and latest fglrx drivers, when using NEWT... I updated to the latest jogl builds and switched to AWT as the window and event toolkit (commits 894d657 and 7f174e8) and the problem seems to go away. Please give it a try and let me know if you still find problems and under what specific hardware/software. Thanks!

(one issue I'm already noticing though is that the fps seems to be capped at 30, even if I set a higher value with the frameRate function)

@monkstone
Copy link
Contributor Author

@codeanticode having issues compiling on kubuntu for some reason (complains missing javascript mode?), anyway I did distro compile on archlinux and tested on kubuntu and archlinux. Now both now working OK (shader sketches and esefera), but the lwgl example (RestartTest) that did previously work after a fashion no longer works.
I have no issues with frame rate being capped at 30, mine is usually set by default at 60 (NVIDIA driver) and that's about what the retained cubic grid sketch runs at once it gets going. There is a different issue that persists with sketches that call the 'mouse', the sketch does not fill panel window, default renderer (Java2D).

@monkstone
Copy link
Contributor Author

PS: for other testers I found I needed to stash the original jogl binaries as these were being seen as locally modified for some reason.

@codeanticode
Copy link
Member

In relation to compilation issues, I'd recommend running "ant clean" first to make sure that no left-overs are kept. For example, the android and javascript modes are no longer bundled with processing-code, they have to be compiled and installed separately.

I did several changes in the PGL interface, but didn't have the time to update the LWJGL renderer accordingly. Right now, only the default OpenGL renderer (JOGL-based) is guaranteed to work.

@monkstone
Copy link
Contributor Author

I always run ant clean before building so it is all a bit peculiar... I mentioned LWGL in passing, the other example failed to run previously.

@codeanticode
Copy link
Member

Forgot to mention, regarding the problem involving Java2D, please open a separate issue.

@monkstone
Copy link
Contributor Author

Not sure I can be bothered since I raised it ages ago and it got closed by casey with no fix see #1625

@aib
Copy link

aib commented May 30, 2013

Fixed for me

@codeanticode
Copy link
Member

Testing on a Ubuntu 12.10 64bit system, with a Radeon HD 6670 video card and latest version of fglrx drivers. Using most recent revision from the repo where I switched to AWT as the windowing toolkit, I don't observe any significant delay in the startup of P2D/P3D sketches. I will leave this issue open for now, but I imagine that certain window manager + opengl driver configurations might be problematic and not possible to fix properly.

@fukuchi
Copy link

fukuchi commented Jun 3, 2013

I confirmed that the current revision from the repository works very well on my Ubuntu notebook (i915).

@monkstone
Copy link
Contributor Author

I think this can be closed regarding my java2D issue which I re-reported I can confirm that this is "fixed" when replacing provided jre and tools with a symbolic link to either openjdk or oracle jdk1.7.0_21 (the issue happens for me whether kde, fluxbox or xfce desktop) so it is fixable #1833.

@codeanticode
Copy link
Member

Thanks for reporting back!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants