[SDL] Optimal mode from SDL_GetVideoMode

Ryan C. Gordon icculus at icculus.org
Thu Oct 5 23:16:53 PDT 2006


> Thanks for the feedback. It's very enlightening. Just as I thought, using
> X will make the game runs slower.

Not necessarily: if there's an X driver for the video chip (verses the 
fbcon "vesa" driver, for example) it may be quite a bit faster...but on 
an embedded system it'll take a lot more memory to run an X server. 
There may be a little more overhead involved in X11, but I wouldn't 
imagine it to be significant beyond memory requirements. It's all a 
matter of what you have and what you need, so I wanted to throw the idea 
out there.

Generally using fbcon requires the kernel to support it, and SDL to be 
built with support for it. Do this last, since all the other details of 
your program that you can do in X will apply to it when using fbcon. In 
fact, you shouldn't even need to recompile the program to switch video 
targets.

The biggest optimization win will probably be a dirty rectangle 
algorithm, if you don't have to paint the whole screen every frame. The 
easiest win is to preconvert all your surfaces to the screen format with 
SDL_DisplayFormat() and disabling alpha blending in favor of colorkey 
blits, if you aren't already.

--ryan.





More information about the SDL mailing list