SDL in windowed mode: performance poor

Started by
11 comments, last by Nightbird1225 19 years ago
Hello all, My app runs at ~50-60 fps in fullscreen mode and only ~15-20 in windowed mode. Anyone have any ideas as to why this might be happening? I am using software surfaces and I notice the performance is the same on my friends' laptops.
Advertisement
Try hardware surfaces and see what happens.

I'm thinking maybe SDL is having a problem with software rendering with windowing using DirectDraw, so it falls back on GDI (as far as i know)..so yeah it would be molasses slow.

Try hardware surfaces in full and windowed mode and post your framerates.
gib.son
Already tried (sorry should have mentioned it). I started with the textures in HWSURFACES and my frame rate was about 10% higher in Full and 2%(maybe) in windowed. I switched over to software thinking that somehow I had too much GDI in the video card frame buffer to allow effective Hardware surfaces. It turns out not to make much difference. Thanks for the hint though, it is exactly what I would have thought too. I am trying to nail this down before I put in any more of the complex systems, and I am trying to run it with Software surfaces now to target the low end systems.

-Nightbird
I'm 99.99999% sure that SDL cannot create a hardware surface in windowed mode.
- A momentary maniac with casual delusions.
That definitely explains why the performance for HW and SW are soo similar in Windowed mode. THanks

-Nightbird
If you're running in windowed mode and use a different display mode (bit depth, etc) than your desktop, every time the screen is updated, the data on your window has to be converted to the same format as your desktop. That is a very time consuming.

If you want windowed mode to run fast too, then you have to set it to the same bit depth as your desktop.
screen = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE);
does it for you (note the bpp=0). Then do SDL_DisplayFormat for all your surfaces that are going to be blitted.

That should give you a small speed increase.

-Richardo
I don't have a problem with hardware surfaces in window mode. I'll try again and see if I can re-create the problem.
Rob Loach [Website] [Projects] [Contact]
I guess that's why I didn't say 100% :)

Check out this article where it says:
Quote:The options tell SDL that I want a full screen (SDL_FULLSCREEN), double buffered (SDL_DOUBLEBUF), hardware surface (SDL_HWSURFACE). The part that isn't obvious is that on my desktop system if I want a hardware surface, it has to be full screen. I can't get a hardware surface for a window. This is one of those things that is operating system and device driver specific. Some systems let you have a hardware surface for a window. Even if you can get a hardware surface for a window, you may not be able to get a double buffered hardware surface for a window.


The article is for Linux but I have the problem in Windows XP Pro, Radeon 9600 256 (not XT, not PRO). I cannot get a hardware surface in a window. Googling gives pages of results where people are having the same issue. I think it's safe to assume that it's a bad idea to do hardware/double buffering with SDL in a Window if you plan on distributing your game.
- A momentary maniac with casual delusions.
Well thanks for the reply and the article. Now I can prove to the boss-man that a windowed game won't work. I originally spec'ed the game out to be fullscreen as default anyhow. I just wish I knew why even with software textures the windowed and fullscreen modes have such a different frame rate. I guess that could be attributed to the (likely) lack of getting Double Buffering in a window, but I wish I knew for sure.

Thanks
-Nightbird
You could still give the user a choice. If the user wants to play in Windowed mode then use software surfaces.
- A momentary maniac with casual delusions.

This topic is closed to new replies.

Advertisement