PocketMatrix forums

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

The Ipaq 38xx and GX.DLL

Regarding the problems with slowdown on the Ipaq 38xx, my understanding of the problem is this:

- The gx.dll shipped with Ipaq 38xx units doesn't expose the true Video memory but instead a buffer, which is memcpyed to the real Video memory

- The gx.dll was apparently written by a confused programmer (at Microsoft? Compaq?) who didn't realise that the pixel Pitch values could simply be reversed to cater for the screen being installed the opposite way round, and was within the original spec of the gx.dll library.

- The slowdown could be fixed in two ways:
1) A hack: detecting the Ipaq 38xx and directly accessing the video memory buffer (a bit worrying - what if a new 38xx series has a different buffer address and data is corrupted?)
2) Updating the copy of gx.dll with a fixed version which returns:
240x320 -640 2 0xac0755a0 as values for the iPaq 38xx

It seems to me that (1) isn't really in the spirit of using the gx.dll library, which is meant to abstract the hardware, and allow current games to run on any current and future machines.

So I'm curious as to whether (2) has happened? Has Microsoft released a bug-fix of gx.dll?
If not, do Microsoft know about the problem?
Would they be willing to release the source code to gx.dll in order for one of us to fix it?
It would be pretty trivial to write a replacement gx.dll. Basically you would handle the display buffer routines yourself, and thunk down to the real gx.dll for the rest (hardware buttons, etc).

So you would place your custom gx.dll in the same dir as your app (thus the OS will load it for your app instead of any version found in \windows). Placing your custom gx.dll in \windows is pretty much out of the question because any other game that is installed will overwrite the custom gx.dll, in addition to it possibly breaking other games.


Dan East
the implementation of gx.dll is done by the manufacturer (Compaq in this case). From what was said this was done to allow for backwards compatibility with games on the market that weren't written to the GX spec and assumed that all ARM devices would have the same screen layout.
...but all ARM devices never did have the same layout... the Jornada layout is at 90 degrees!

Surely if a game supports the Jornada, it must support the correct pitch values.

The only games which iPAQ could have possibly been targetting with the hack would be games which ONLY run on iPAQs 36xx/37xx, not Jornadas... How many are there of those?

Surely it's not worth frigging up the entire system for a small group of games which:
a) Weren't programmed to support the Jornada
b) Weren't programmed to the gx spec
c) Can be updated

Has anyone contacted Compaq to ask them if they will fix gx.dll/release the source code yet?

Also, I'm a little bit confused. How many different versions of gx.dll are there, because Microsoft seem to have one on their site, whereas you just said it's provided by the manuafacturer?

Is it both?
You're forgetting that the PPC 2000 platform only had one device that was ARM initially and that was the iPAQs. I believe the @migo and a few others that came out later and had ARM procs used the same memory layout for their display as iPAQ.

The PPC 2000 platform based Jornadas (54x, etc) used Shx processors.

Main point was there's a slew of games that came out that didn't use GAPI correctly and Compaq decided to do that ludicrous double buffer rotation crap to provide backwards compatibility.

My understanding is the DLL just references a manufacturer's driver and it's the driver that I was referring to as it's not the DLL causing problems with rotated buffers.
Would be cool to have GX as a statically linked library which is compiled into your sourcecode, so one doesn't need the dll.
Microsoft and Compaq are well aware of the problem. The GX.DLL is distributed by MS and is the same on every platform. The OEM's display driver is what actually exposes the hardware capabilities and screen address. Microsoft has no control over this.

The iPAQ 38xx devices use a new 16-bpp display. The connector on this display made it such that the display had to be oriented 180 degrees from the display on the 36xx devices. In an attempt to be backwards compatible with some poorly written apps, Compaq decided to emulate the orientation of the 36xx devices by using a GXDMA buffer under the hood. To add insult to injury, their routine for rotating the buffer 180 degrees each time the app calls GXEndDraw takes almost 20 ms. I don't know what they are doing in that loop, but I've written some simple C code to do this and it measures around 5 ms.

All of this just goes to show you how much Compaq cares about the game development community. Perhaps things will improve with the HP merger.
Ah - gotcha. So it's the device driver to blame, not gx.dll.
Is it possible to talk directly to the device driver in the same way gx.dll does?
The typical work around is just to write directly to the primary surface's memory since it's well known. There's some threads on here from a few months ago that cover how to do this.
Thanks - I did a search and found a lot of talk along the same lines as I'm doing right now (damn you Compaq etc! ;)

However I did notice that people have reported the Compaq driver *does* return IsDRamBuffer as TRUE if called correctly (after Init), so it seems Compaq didn't do too bad.

So the best algorithm would probably be:
1) If DRamBuffer is false, use the screen pointer returned by GAPI because it's not a buffer, it's direct.

2) Else, check you are certain it's an iPAQ 38xx. If it's an iPAQ 38xx, use 0xac0755a0,-640,2

3) If you aren't certain it's an iPAQ 38xx, use the GAPI information.

Would you agree?
(By the way, is there a risk of deleting data on the disk if 0xac0755a0 is used, and it isn't the screen address? Is the 32Meg directly mapped to the processor all the time?)
BTW, it appears that writing to that address on an E-200 can cause a Hard Reset. Yesterday Matt Keys downloaded the latest 38xx version of Pocket Genesis for his E-200 (which is what the website said to use for all PPC 2002 devices), which caused a hard reset on initialization. The 36xx version worked fine.

Dan East