Why is sdl so slow on my machine

Hi

I have an 400er amd k2, 230mb ram, 16mb nvidia riva tnt agp
xfree4.1.0 (debian testing ).
I run the programm from the book "programming linux games"
and i wrote some code myself.

I used doublebuf, hwscreen etcetc.

But i only get 13fps.
With glxgears i get 190 fps.

Can it be that sdl is so slow. I mean it’s 15 times slower than
the test with glxgears.

Where is the lack ???

Mirko

glxgears uses OpenGL. The program you wrote uses software rendering through SDL.
Big difference. If you’re running under X11. You don’t have a hardware surface,
unless you’re using the DGA driver.

-EvilTypeGuyOn Tue, May 21, 2002 at 01:50:51PM +0200, Mirko Koenig wrote:

Hi

I have an 400er amd k2, 230mb ram, 16mb nvidia riva tnt agp
xfree4.1.0 (debian testing ).
I run the programm from the book "programming linux games"
and i wrote some code myself.

I used doublebuf, hwscreen etcetc.

But i only get 13fps.
With glxgears i get 190 fps.

Can it be that sdl is so slow. I mean it’s 15 times slower than
the test with glxgears.

Where is the lack ???

But i only get 13fps.
With glxgears i get 190 fps.

Can it be that sdl is so slow. I mean it’s 15 times slower than the
test with glxgears.

Where is the lack ???

glxgears uses OpenGL. The program you wrote uses software rendering
through SDL. Big difference. If you’re running under X11. You don’t have
a hardware surface, unless you’re using the DGA driver.

I read about so many problems with the framerate using SDL.
How is it possible to get a good framerate like 30-50 fps.
How did loki manage to get a good framerate?

mirkoOn Tue, 21 May 2002 16:02:02 +0200, EvilTypeGuy wrote:

On Tue, May 21, 2002 at 01:50:51PM +0200, Mirko Koenig wrote:

At 05:03 PM 5/21/02 +0200, you wrote:

glxgears uses OpenGL. The program you wrote uses software rendering
through SDL. Big difference. If you’re running under X11. You don’t have
a hardware surface, unless you’re using the DGA driver.
I read about so many problems with the framerate using SDL.
How is it possible to get a good framerate like 30-50 fps.
How did loki manage to get a good framerate?

Maybe you have some problems with your GL installation and SDL use only the
software version, so it’s obviously slower than GL/GLUT.

You don’t need DGA if you use HW accelerated GL, DGA is for 2d stuff.

BTW I had similar problems with a wrong libGL, if you use DRI accel you
should use libGL.1.2, not 1.3 (check /usr/X11R6/lib).

Use glxinfo to see if you have a correct setup or not, if you have a
correct setup you should see something like:

name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
[…]

Bye,
Gabry (gabrielegreco at tin.it)

But i only get 13fps.
With glxgears i get 190 fps.

Can it be that sdl is so slow. I mean it’s 15 times slower than the
test with glxgears.

Where is the lack ???

glxgears uses OpenGL. The program you wrote uses software rendering
through SDL. Big difference. If you’re running under X11. You don’t have
a hardware surface, unless you’re using the DGA driver.

I read about so many problems with the framerate using SDL.
How is it possible to get a good framerate like 30-50 fps.
How did loki manage to get a good framerate?

Without seeing your actual code, it’s impossible to see why you may/may not be
getting a good framerate. The problem is not SDL.

However, if you want extremely good framerates, try David Olofson’s OpenGL
backend for SDL here:

http://olofson.net/mixed.html

it’s called glSDL…

-EvilTypeGuyOn Tue, May 21, 2002 at 05:03:12PM +0200, Mirko Koenig wrote:

On Tue, 21 May 2002 16:02:02 +0200, EvilTypeGuy wrote:

On Tue, May 21, 2002 at 01:50:51PM +0200, Mirko Koenig wrote:

At 05:03 PM 5/21/02 +0200, you wrote:

glxgears uses OpenGL. The program you wrote uses software rendering
through SDL. Big difference. If you’re running under X11. You don’t
have a hardware surface, unless you’re using the DGA driver.
I read about so many problems with the framerate using SDL. How is it
possible to get a good framerate like 30-50 fps. How did loki manage to
get a good framerate?

Maybe you have some problems with your GL installation and SDL use only
the software version, so it’s obviously slower than GL/GLUT.

I’m not using GL.
I just tested my framerate with glxgears.

I used the code on :
http://www.nostarch.com/plg.htm

And the first example pw-ch4. say i have 13 fps.
Other sdl apps, like effekttv (http://effectv.sourceforge.net/), say,
that i have got ~30fps.

And why is SDL always using the whole cpu?

MirkoOn Tue, 21 May 2002 17:32:12 +0200, Gabriele Greco wrote:

At 05:03 PM 5/21/02 +0200, you wrote:

glxgears uses OpenGL. The program you wrote uses software
rendering through SDL. Big difference. If you’re running under
X11. You don’t have a hardware surface, unless you’re using the
DGA driver.

I read about so many problems with the framerate using SDL. How is it
possible to get a good framerate like 30-50 fps. How did loki manage
to get a good framerate?

Maybe you have some problems with your GL installation and SDL use
only the software version, so it’s obviously slower than GL/GLUT.

I’m not using GL.
I just tested my framerate with glxgears.

Well, then you’ve been testing two almost separate subsystems. :slight_smile:

I used the code on :
http://www.nostarch.com/plg.htm

And the first example pw-ch4. say i have 13 fps.
Other sdl apps, like effekttv (http://effectv.sourceforge.net/), say,
that i have got ~30fps.

Depends on the resolution, depth, emulation and so on.

Make sure that you use a video mode that’s actually available. (Note that
XFree86 cannot change pixel format without restarting!) Pass 0 for the
bpp argument, to be on the safe side. (If the user is on a 256 color
display, it’s his/her problem, and the only thing you could do about it
would be to try fbdev or svgalib.)

Also make sure all surfaces are converted into the format of the screen
before you start blitting. SDL can convert on-the-fly, but it can be
pretty expensive. See SDL_DisplayFormat() and SDL_DisplayFormatAlpha().

If you can’t get an “acceptable” frame rate at the resolution you need,
you could try glSDL, as suggested. It’s still a wrapper, and not entirely
finished, but seems to do the job for some people already. Frame rates of
300+ fps have been reported with real code on decent 3D cards.

http://olofson.net/mixed.html

And why is SDL always using the whole cpu?

Because you’re doing software rendering without retrace synchronized
pageflipping. That is, as soon as one frame is ready, your application
will start rendering the next one.

Retrace sync is not available on Linux, expept with a few drivers. Also
note that h/w pageflipping and/or retrace sync is often broken or missing
in windowed modes, regardless of platform.

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Tuesday 21 May 2002 19:39, Mirko Koenig wrote:

On Tue, 21 May 2002 17:32:12 +0200, Gabriele Greco wrote: