PocketMatrix forums

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

The major bottleneck for Graphics Rendering on PocketPC?

Hi All

Ive been implmenting a 3D image warper on the PocketPC. In case anyone is not familiar this is where the scene is treated as an image where every pixel has depth information. When the viewpoint changes the pixel is reprojected to a new position.

Anyway the results I get are quite strange. When I warp 240*320 pixels I get a frame rate of about 10 fps. When I try sub-sampling the reference image and warp 120 * 160 pixels (one quarter the number) I get a frame-rate of about 15fps. This is only a 50% speed up. Normally the speed up would be at least 100%.

Im using GAPI. I was thinking perhaps writing to the screen is the main bottleneck in this case, not the number of pixels that are warped. I have a HP3800s.

Any comments? cheers.
I don't know it very well but I did some simple calculation.

Assumption:
1. Rendering 320*240 is about four times of 160*120. If rendering 160x120 needs Xs, then 320x240 would need 4Xs.

2. Some fix overhead may need Ys.

Frame rate for 320x240 will be 1/(Y+4X) =10FPS.
Frame rate for 160x240 will be 1/(Y+X) =15FPS.

We will get 2 equations.
10(Y+4X)=1
15(Y+X)=1

Solving it you will get X=1/90 and Y=1/18.

I guess your program has a fix overhead which consume 1/18s per frame.
Writing to the "screen" is certainly a nasty bottle-neck on most PocketPC devices. The "problem" is that the screen buffer that GAPI passes you is generally unbuffered and uncached (so when the DMA reads it to plot to the screen there aren't "written" pixels waiting in the cache to be plotted/missed).

We've been over all this before - try searching the (entire) forum for "unbuffered" or "uncached".
Ya, the iPaq H3800 series has a serious problem with GAPI.
Oh yeah, now I remember (reminded by Moose's post).

IIRC the 3800 series iPaq's actual LCD is "rotated" from the "old" iPaqs. So, to maintain compatability, the 3800's GAPI layer exposes an intermediary buffer and then *rotates* it into screen memory. Again, I'm sure you'll find lots about it by searching the forum.
The solution with the 38xx devices is to not use the display pointer returned by GAPI, but access the DRAM directly. Its address is 0xac0755a0. Use the following display properties with that address:

cxWidth = 240
cyHeight = 320
cBPP = 16
ffFormat = 168
cbyPitch = 2
cbxPitch = -640

Dan East
People, Thanks for all the really useful feedback.

Ive tried the following to write my image to the screen but it doesn't work (nothing happens!). Im using the 0xac0755a0 address as suggested and removed the begindraw() and enddraw()

my code is as follows (please dont laugh)

g_gxdp.cxWidth = 240;
g_gxdp.cyHeight = 320;
g_gxdp.cBPP = 16;
g_gxdp.ffFormat = 168;
g_gxdp.cbyPitch = 2;
g_gxdp.cbxPitch = -640;

unsigned short * pusLine = (unsigned short *) 0xac0755a0;

if (pusLine == NULL) return false; // NOT OK

for (unsigned int y = 0; y < g_gxdp.cyHeight; y++) {
unsigned short * pusDest = pusLine;
for (unsigned int x = 0; x < g_gxdp.cxWidth; x++) {
PixelCol = WarpedImage[y*imagewidth+x];
*pusDest = PixelCol;
pusDest += g_gxdp.cbxPitch >> 1;
}
pusLine += g_gxdp.cbyPitch >> 1;
}
Have you tried setting PixelCol to some constant color just to make sure you've got the loops correct?
yes tried that. Stumped frankly. Is there any urls with source code examples on this topic anywhere?
What happens if you try to do a memset to video memory?

The starting address of display memory on the iPaq 3800 is 0xAC050020 (pixel location 239, 0). Try setting 153600 bytes, starting at that address, to 0xFF.

Is the resulting screen filled with white?