[Scummvm-devel] Improvements to blitting code.

Max Horn max at quendi.de
Sat Aug 16 13:46:31 CEST 2008


Hi Carlo,

thanks for your mail!

First of, you uncovered indeed a big nasty bug: We globally define  
USE_ARM_GFX_ASM, but in engines/scumm/gfx.cpp, we then check  
ARM_USE_GFX_ASM -- oops! Only the Symbian port seems to #define both.  
Bad bad bad.

I just commited a fix for this to trunk (see rev 33934), and we *may*  
want to commit it to tbe 0.12 branch. However, I dare not do this,  
because essentially the ARM blitting code obviously was not tested for  
quite some time, so I don't want to blindly enable this. Somebody  
who's actually able to test the ARM blitting code should do that.


Next, you proposed how to generally speed up that code, by blitting  
multiple pixels at a time -- which is indeed a well-proven way to  
speed up blitting. And then you avoid expensive branches by using bit  
arithmetics in a clever way. Finally, since we know that we are 4  
(even 8) aligned, the beauty is that no extra cost for dealing with  
unaligned data is incurred. Wonderful :)

It's clear that MMX / AltiVec etc. can do this even faster, but in  
general, machines which support such SIMD instructions do not have a  
bottleneck in ScummEngine::drawStripToScreen, so to be frank, I don't  
think it would be worth the effort to provide hand coded ASM versions  
for those. Small devices are the ones which benefit most, and those  
run on something like ARM or MIPS or SH4 (the ones we support, at  
least). All of these probably could benefit from your idea, though,  
which is nice!

Now, if you could just provide a patch with your changes, that would  
be the quickest way to get that integrated... ;)

Cheers,
Max




More information about the Scummvm-devel mailing list