[SDL] Optimal mode from SDL_GetVideoMode

benang at cs.its.ac.id benang at cs.its.ac.id
Thu Oct 5 22:57:02 PDT 2006


>
>> So it doesn't matter either way? Well, I'm currently developping in a
>> Pentium 4. But the intended machine for my game is an embedded system
>> with
>> a clock of 400 MHz. And it's A LOT slower than in my PC. Maybe it's
>> because I used 1024X768 with 32 bpp mode. Is it possible for me to add
>> the
>> performance while retaining my curent video mode?
>
> Well, okay, embedded stuff is a different story.   :)
>
> (The rest assumes that OpenGL is out of the question, and there isn't a
> 3D accelerator in the system at all...)
>
> Are you really going to run an X server on that? If it's an embedded
> device, you could probably save some resources and overhead by using SDL
> with the fbcon target. The system may be dramatically different, but
> your SDL-based code shouldn't have to change at all.
>
> 32-bit graphics means a lot of memory bandwidth on an embedded system;
> if you can get by with 16-bit color, that'll speed things up quite a
> bit. If you can turn off the alpha blending, that'll save both memory
> bandwidth and CPU time for blits. This is really expensive, and in many
> cases a colorkey blit will be much faster if that's all you actually need.
>
> If you convert the surfaces to the display format, non-alpha blits
> basically become memcpy() calls instead of complicated efforts to
> convert them to the correct format pixel-by-pixel every time. If you can
> isolate parts of the screen that need updating every frame (say, an
> object that moved and its previous position need redrawing instead of
> the whole screen), then you should try using a "dirty rectangle"
> approach with SDL_UpdateRects() instead of SDL_Flip(), which reduces the
> amount of blitting to do in the first place.
>
> Generally speaking, those are the biggest optimization wins with 2D
> graphics.
>
> --ryan.
>

Thanks for the feedback. It's very enlightening. Just as I thought, using
X will make the game runs slower. The truth is, I'm just getting to know
Linux only recently. Well, I've used Linux before in practicums in my
college days few years ago (although only the basics). So I'm pretty much
a not-so-newbie-but-not-so-seasoned Linux user. I've tried running my
application in pure console (without using Win Manager at all) and it
returned some error. So at that time I assumed SDL can't be used in
console. Can you point me to some resources to make SDL in fbcon?

Maybe I'll use the "dirty rectangle" first, the only one I'm capable of
doing right now.

Thanks.





More information about the SDL mailing list