This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Rotated Blit Optimization Tips?


Rotated Blit Optimization Tips?

Postby Ludimate » Jun 5, 2007 @ 3:51pm

Ludimate
pm Member
 
Posts: 21
Joined: Jun 29, 2006 @ 8:40pm


Postby Dan East » Jun 6, 2007 @ 2:16am

Is your app running at 240x320 or 480x640? You will experience a major performance hit with the lower resolution, because it requires real-time backwards compatibility to convert to the native VGA device.

Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby Ludimate » Jun 6, 2007 @ 10:54am

The game is using DirectDraw and with the HI_RES_AWARE flag set, therefore running in 640x480.

After further research it seems the video memory is indeed doing some kind of caching! A test that sets all pixels in the video memory to a certain value (so that no read cache is involved) runs at double speed if writes are sequential, as in a memset.
So the solution seems to be tile blitting: rotate-copy 16x16 pixels blocks one at the time, so that the involved read/write cache misses are minimized. And it works very well: frame rate jumped to about 20 FPS (from 11.7) which is much more acceptable.

It is weird that video memory is being cached: maybe it's not the real video memory and DirectDraw is doing some magic mapping(?) there...

The only improvement I can think of is reading 2 pixels/32 bits at the time, maybe that's a little faster...

Thanks and Best Regards,

Jorge Diogo
http://Ludimate.com
Ludimate
pm Member
 
Posts: 21
Joined: Jun 29, 2006 @ 8:40pm


Postby drgoldie » Jun 6, 2007 @ 9:51pm

drgoldie
pm Member
 
Posts: 330
Joined: Jan 10, 2003 @ 10:46am
Location: Vienna


Postby Ludimate » Jun 6, 2007 @ 10:36pm

Ludimate
pm Member
 
Posts: 21
Joined: Jun 29, 2006 @ 8:40pm


Postby drgoldie » Jun 7, 2007 @ 8:47am

drgoldie
pm Member
 
Posts: 330
Joined: Jan 10, 2003 @ 10:46am
Location: Vienna


Postby pappaxray » Jul 6, 2007 @ 10:30am

Does it help to preload the next macro block? Do you know how much cache these devices tend to have?
pappaxray
pm Member
 
Posts: 23
Joined: Jul 28, 2004 @ 4:57pm
Location: UK


Postby Ludimate » Jul 6, 2007 @ 3:09pm

Could not find any improvement in preloading pixels/blocks. But doing rotated block blits certainly improves performance *a lot* due to its cache-friendliness.

Best Regards,

Jorge Diogo
Ludimate
pm Member
 
Posts: 21
Joined: Jun 29, 2006 @ 8:40pm


Postby pappaxray » Jul 6, 2007 @ 5:48pm

pappaxray
pm Member
 
Posts: 23
Joined: Jul 28, 2004 @ 4:57pm
Location: UK


Postby drgoldie » Jul 6, 2007 @ 5:54pm

drgoldie
pm Member
 
Posts: 330
Joined: Jan 10, 2003 @ 10:46am
Location: Vienna


Postby pappaxray » Jul 8, 2007 @ 11:49am

You'd have to preload the destination block as well tho else you'd still get a stall. (I meant 32x32 byte blocks rather than pixels btw :) ).
pappaxray
pm Member
 
Posts: 23
Joined: Jul 28, 2004 @ 4:57pm
Location: UK


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron