Reply
Thread Tools
Posts: 6 | Thanked: 12 times | Joined on Dec 2009
#1
Hi.

I have played around with getting a simple GLES app running on my N900 last weekend through the combination of Xlib and EGL, and I got it running ok, although only using an ugly hack.

The thing is, if I simply render as fast as I can, I am rendering about 30 frames per second, of which only 10 or so actually end up being displayed. My assumption is that the window manager simply doesn't get enough time on the GPU to display all my rendered frames.
I was able to improve this situation by putting a usleep() into my mainloop, but that is hardly a satisfying solution.

Does anyone have any pointers on how to wait for the window manager to catch up more cleanly? (I had some hope for eglWaitNative(), but it didn't seem to help when I tried it.)

(For those interested, the source can be found at http://exoticorn.de/simplegl.tgz)

Another question comes up when comparing the output of 'top' when running my test app to the output when running bounce: While my app is running, I get about 10% CPU usage from Xorg and 4% from hildon-desktop (even in fullscreen mode), while bounce is running, I only see about 4% Xorg and no hildon-desktop at all.
Could this mean that bounce is somehow bypassing the window manager (at least in fullscreen mode) and rendering to the screen directly? Any chance of getting some information on how to do this myself?

As soon as I can get the basics figured out, I would like to port my game 'spidr' (http://pouet.net/prod.php?which=53019) to the N900.

Cheers,
Dennis
 

The Following 6 Users Say Thank You to exoticorn For This Useful Post:
hhedberg's Avatar
Posts: 84 | Thanked: 212 times | Joined on Nov 2007 @ Oulu, Finland
#2
Originally Posted by exoticorn View Post

Another question comes up when comparing the output of 'top' when running my test app to the output when running bounce: While my app is running, I get about 10% CPU usage from Xorg and 4% from hildon-desktop (even in fullscreen mode), while bounce is running, I only see about 4% Xorg and no hildon-desktop at all.
Could this mean that bounce is somehow bypassing the window manager (at least in fullscreen mode) and rendering to the screen directly? Any chance of getting some information on how to do this myself?
Most probably. See this post in Maemo Developers mailing list:

http://lists.maemo.org/pipermail/mae...ch/018645.html

Unfortunately I have not seen any public information about the issue, but I would look at the XAtoms of the Bounce's game window.
 
Posts: 236 | Thanked: 223 times | Joined on Oct 2009 @ NE UK
#3
Hi, I don't know too much about this! But after a quick look at the code, just wondering why you're calling XGetWindowAttributes() inside your render function? I'd have assumed it's better to do this in setup or when you get some notification event? (Asking as much for my benefit as for yours )
 
Posts: 6 | Thanked: 12 times | Joined on Dec 2009
#4
@hhedberg:

Thanks, I will look into that as soon as I get a chance. If I find something that works along those lines, it might make the first question obsolete, although I'd still like to find an answer for that for when I'm not running fullscreen.

@kwotski:

You are right, in a real application you would probably just read out the window size when you get a resize event, but I consider this test app as just a hacky playground to learn about Xlib and EGL, both of which I haven't used before.
 
Posts: 236 | Thanked: 223 times | Joined on Oct 2009 @ NE UK
#5
exoticorn: Right, but have you tried doing this once in main() instead, and the glViewport(), etc., to see if this is the source of your performance hit?

(or if you want to stay hacky just leave them where they are, but put them in something like: )
Code:
static int donesetup=0;

if(!donesetup) {

         XGetWindowAttributes(dpy, win, &gwa);
         glViewport(0, 0, gwa.width, gwa.height);
         glClearColor(0, 1, 0, 1);
         glClear(GL_COLOR_BUFFER_BIT);
         donesetup = 1;
}

Last edited by kwotski; 2009-12-16 at 11:57.
 
Posts: 6 | Thanked: 12 times | Joined on Dec 2009
#6
@kwotski:

No, I haven't tried it, but will do that at the next opportunity. I doubt that this is the cause of the problem, though, as my problem is not CPU related (my app uses about 1.5% CPU time) and in fact the problem is that I am rendering too fast and not too slowly.

Btw: While mose GL tutorials tell you to call glViewport in the resize event handler, you can be pretty sure (as long as the GL(ES) implementation isn't completely broken) that a glViewport call per frame isn't the cause for any performance issues. In fact, there are very valid reasons to call glViewport multiple times per frame - think of split screen games or rendering to textures.
 

The Following User Says Thank You to exoticorn For This Useful Post:
Posts: 236 | Thanked: 223 times | Joined on Oct 2009 @ NE UK
#7
See, I learned something
 
javispedro's Avatar
Posts: 2,355 | Thanked: 5,249 times | Joined on Jan 2009 @ Barcelona
#8
Originally Posted by exoticorn View Post
Could this mean that bounce is somehow bypassing the window manager (at least in fullscreen mode) and rendering to the screen directly? Any chance of getting some information on how to do this myself?
Either wait for next firmware release or see this post.
 

The Following 2 Users Say Thank You to javispedro For This Useful Post:
javispedro's Avatar
Posts: 2,355 | Thanked: 5,249 times | Joined on Jan 2009 @ Barcelona
#9
Originally Posted by exoticorn View Post
Btw: While mose GL tutorials tell you to call glViewport in the resize event handler, you can be pretty sure (as long as the GL(ES) implementation isn't completely broken) that a glViewport call per frame isn't the cause for any performance issues. In fact, there are very valid reasons to call glViewport multiple times per frame - think of split screen games or rendering to textures.
The Xlib call, on the other side, is a roundtrip to the X server. Removing it (along with all the another unneeded "finish" calls) wins a few fps.

With that and the above I get around 43fps.
 
Posts: 6 | Thanked: 12 times | Joined on Dec 2009
#10
@javispedro: Aha! That looks just like what I was hoping for, thanks!

And you are right about the roundtrip time, of course - I didn't give much thought to that as I felt I had some bigger problem to solve first.
 
Reply


 
Forum Jump


All times are GMT. The time now is 08:02.