Friday, November 27, 2009

on GfxLib and alpha-blending

GfxLib has seen some new code added to it. This is the general graphics library for the OS, providing basic drawing (like lines and rectangles), as well as advanced drawing (alpha-blended images). The alpha-blending code exists in multiple versions ,to take advantage of different processors. The "generic C" version can pull off 15 frames per second on alpha-blending a fullscreen image on 324x484 resolution. This version will run on any ARM processor ever used in Palm devices. The "fast" version requires a ARMv5 processor (like one in iQue, Zodiac) and can pull off 21 frames per second on the same fullscreen alpha-blended image. The "WMMX" version requires an XScale CPU (like one in LifeDrive, TX) and uses Intel's WMMX (their MMX for mobile) and is twice as fast as the "genereic C" version, managing a whopping 30 frames per second on fullscreen alpha-blending test.

These FPS numbers may seem low, but remember that (1) it is rare to redraw the fullscreen, generally only the changed area needs redrawing, (2) these might become faster as I optimize them more (3) comparing to more modern hardware is pointless, since almost all modern hardware has graphics acceleration chips and PalmOS devices do not (with the exception of the Zodiac, but I am not supporting it anyways for now)



For the technically curious: C version processes one pixel at a time. ARMv5 version processes two pixels at a time, using the "Enhanced DSP instructions" that this architecture provides (SMUL<x><y> and SMLA<x><y>) to do the parallel multiplication. The WMMX version processes four pixels at a time and makes heavy use of WMMX instructions (TBCST, WLDR, WSTR, WUNPACKEL, WSUB, WAND, WOR, WSLL, WSLR, WMUL, WMAC) to do parallel processing of al four pixels.

Also a rather large (9%) speedup was attained by strategically placed "PLD" instructions, that instruct the D-cache to pre-load data into the cache.

4 comments:

Thireus said...

Your knowledge is very impressive.

Keep up the good work ;)

Jacob101980 said...

Does this mean DGOS will use the whole 324x484 on screen for the Os and not have a border?

Dmitry Grinberg said...

Jacob, yes, on my LD that is the case

Coffee-Turtle said...

I used to take my LD screen for granted. Thanks for the explanation!

On a separate topic, is there any improvement in the physical touch characteristics of the screen. LD's get notoriously inaccurate over time.