PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

iPaq h38xx blitting?

Gregory Torres · 15 Sep 2002, 00:42 UTC
Hi,

I seem to be having some serious trouble blitting to the screen of the iPaq H3800 series. Performance is just not what I expected it to be compared to the older series and other SA1110 PocketPC's. Does anyone have any idea what the problem is?

I'm new to PocketPC Programming, so excuse me if I don't know much.

Thanks,
Greg
It's the GAPI bug in the 38XX series. I think theres a way around it but I don't know the details.
Ugh. It's not a GAPI bug! This is entirely Compaq's boneheaded move in their display driver.

The screen on the 38xx series of devices is oriented differently from the previous iPaqs. Rather than expose this new orientation through GAPI, they used a feature of GAPI called "gxdma" to expose an intermediate buffer to applications that is oriented the same as previous iPaqs. This intermediate buffer is copied to actual display memory each frame when your app calls GXEndDraw. This extra full-screen copy operation is causing the performance hit you're experiencing.

This was done for compatibility reasons because some popular games didn't test the GAPI caps bits and just assumed that if they were running on a iPaq the screen layout/config was the same. Rather than having these existing games not run on the new iPaqs, they decided to take the perf hit in the name of compatibility.

The good news is that if you want to write your app to the actual video memory address and not pay the perf hit, you can read this thread for how to do it.

http://forums.pocketmatrix.com/viewtopic.php?t=3420
Yeah I know it's not an actual bug in GAPI but it happens with GAPI stuff.
Gregory Torres · 15 Sep 2002, 03:22 UTC
Wow!

Thank you for the amazingly quick replies. I'm glad to know it's easy to fix this problem, although I like using GAPI returns just so it works universally. I guess that won't help me, though :P

-Greg
Well if you're a GAPI "purist" then you should be calling GXIsDisplayDRAMBuffer and if it returns TRUE, then don't use your own back buffer created in system memory. Instead, use the buffer returned by GXBeginDraw as your back buffer and compose your frame to that. This avoids a full-screen copy operation that you would be doing if you created and managed your own back buffer.
My code for the workaround/hack. Think it's okay. Feedback more than welcome.


// See if the device is an iPAQ 3800
memset(&DevName;,0,sizeof(DevName));
SystemParametersInfo(SPI_GETOEMINFO,sizeof(DevName)>>1,DevName,0);
if (_wcsicmp(DevName,L"compaq ipaq h3800")==0) Draw3800=1;

// Find out about the primary surface (the screen)
GXDisp=GXGetDisplayProperties();
memset(&Prim;,0,sizeof(Prim));
Prim.w=GXDisp.cxWidth;
Prim.h=GXDisp.cyHeight;
Prim.xp=GXDisp.cbxPitch;
Prim.yp=GXDisp.cbyPitch;
if (Draw3800) { Prim.xp=-640; Prim.yp=2; }

...
// Get access to the real screen
if (Draw3800) Scr=(unsigned char *)0xac0755a0;
else Scr=(unsigned char *)GXBeginDraw();

...
if (Draw3800==0) GXEndDraw();
That should work just fine. It's essentially the same thing as in EasyCE 1.x / 2.0 and the Overloaded libraries. You may want to check out the EasyCE blitting code to get it completely right.
(begin shameless plug)

... code as used in our spectacular new game <a href="http://www.handango.com/PlatformProductDetail.jsp?productId=43741">"Repton"</a>, a license of the 1980's puzzle smash which spawned 3 sequels ... available now from all good PDA portals ...!

(end shameless plug)

By the way, we're also after some MIPS and SH3 beta testers...
drop a line to
mips@masabi.com and
sh3@masabi.com