[SDL] refreshing my knowledge

José Luis Sánchez wizord at mi.madritel.es
Sat Jan 11 16:54:01 PST 2003


"Roger D. Vargas" <roger at eht.scu.tur.cu> escribió:

> I would like to confirm some things about blits:
> 
> video ram to video ram blits are faster
> writing directly to vram (ie. modifying pixels) is very slow.
> system ram to video ram blits are a bit slower
> 
> There is some difference if there is support for accelerated blits?

The scenario is actually somewhat more complex.

Speaking on 2D only, you can optimize for a variety of tasks but generally
speaking, the goal is to use the least CPU for drawing.

With this goal in mind, you'll see video-to-video blits are better, IF they can
be accomplished by the GPU (i.e.: if there are accelerated hardware-to-hardware
blit available).  Video-to-video blits via software is a very time-consuming
task and might be avoided.

On any AGP video card, you can also use the graphics processor (GPU) for
transfers between system RAM and video RAM.  The GPU has direct access to the
AGP aperture frame, usually mapped at the very end of the address space. 
DirectX calls this space "local vram" or the like.

Note that the GPU might be actually SLOWER than the main CPU.  In fact, the
FASTEST blits are from system RAM to system RAM.  Just remember: the goal is to
use CPU cycles as little as possible.

Loudly, those cycles are wasted if you simply keep your CPU waiting for the
blit to be completed.  So you might design your program so that it does
actually something useful while the GPU is busy.

My point here is:  don't think only on plain blit speed, but overall
performance.

Regards,
Wizord.




More information about the SDL mailing list