Newbie question about blitting

Hi there…

i’m new to SDL and spent a weekend so far figuring out how everything
is working. I’ve started with some speed-tests today and ran across
some strange behaviors (ok, i didn’t went through the complete SDK
sources, maybe it’s already explained there :slight_smile: )

Each frame I do a simple fullscreen blit from a backbuffer to the
double-buffered main-surface, calculate the frame rate, draw a short
string (~20 blits, no Alpha or ColorKey), doing a flip.

In fullscreen, everything is working fine, framerate is up to 85fps
and profiler shows a cpu-load which is equivalent to DirectX.

When testing in windowed-mode, framerate drops to 14-18fps?? Profiler
shows that all cpu-time is used by the SDL_Flip function.

All surfaces are converted to displayFormat, so there shouldn’t be any
trouble blitting the data.

I did the same test on different computers, different
resolutions, different OS’s, with the same result.
I’ve also thrown away the doublebuffer/flip structure and used
singlebuffer with SDL_UpdateRect().

So my question is…what is SDL doing when flipping in windowed mode?
Or did i miss something and this is normal for SDL?

Thanks in advance :slight_smile:

/hendrik

Hi there…

i’m new to SDL and spent a weekend so far figuring out how everything
is working. I’ve started with some speed-tests today and ran across
some strange behaviors (ok, i didn’t went through the complete SDK
sources, maybe it’s already explained there :slight_smile: )

Each frame I do a simple fullscreen blit from a backbuffer to the
double-buffered main-surface, calculate the frame rate, draw a short
string (~20 blits, no Alpha or ColorKey), doing a flip.

In fullscreen, everything is working fine, framerate is up to 85fps
and profiler shows a cpu-load which is equivalent to DirectX.

When testing in windowed-mode, framerate drops to 14-18fps?? Profiler
shows that all cpu-time is used by the SDL_Flip function.

All surfaces are converted to displayFormat, so there shouldn’t be any
trouble blitting the data.

Actually, make sure you’re using 0 as the bit depth in windowed mode,
as it will pick the depth used by the windowing system, if you don’t
care what pixel format you’ll get. I’m guessing you’re specifying a
depth of 24, which is actually a 3-byte pixel format and is the slowest
to convert to the screen depth.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment