PocketMatrix forums

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

HP 2210 & 2215 slow video buffer!!

Has anyone managed to find a way to speed up the slow video refresh problem on the HP 2215? It seems to take around 30-33ms to copy my back buffer to the video memory returned by GXBeginDraw(). This means I can't get more than 33fps max in my game although the game loop slows this down even further.

My backbuffer is in landscape mode which I used to copy to the IPAQ screen with a memcpy(). It seems that the pitch values have now changed from -2, 640 to 2, 480 so I have to do it the long way... can anyone see any ways of optimising this code.

xoff = (gx.cbxPitch >> 1);
yoff = (gx.cbyPitch >> 1);

dst += 239;

for (y = 240; y; y-- )
{
ldst = dst;

for (x = 320; x; x-- )
{
*ldst = *src++;
ldst += yoff;
}

dst -= xoff;
}

Is there a faster way to access video ram as I've seen people posting frame rates of more than 50fps on this device which seems too good to be true.
avdpro · 24 Sep 2003, 13:08 UTC — A newbie's solution
Hi
I'm Avdpro, a newbie PPC coder.
I C/C++, I think the key of optimize the screen update method is "data-alignment" and unrow the loop.

1>*ldst = *src++;
this is will cause a "strh" instruction. May be you will like to copy 2 pixels each time with 32bit pointers. I think this will brust up very much.

2>use reducing loop, that is:
for(y=240;y>=0;y--)
Some guys from intel said this will faster cuz the ARM instructions today.

3>unrow the loop

4>use ASM instead of C++, this always times faster due to the ugly M$ compiler.

I think you are lucky than me. I'm writing a palette based game. The screen 8bit->16bit update method is more complex than 16bit->16bit.
Here is my code of 8bit->16bit, hope it can help you get some idea for optimize yours. I used a re-ASMed version of this function that 2+ times faster than this.
I removed some prework. Sorry.
while(y--)//this,h,w,lpbase,lpdst,<lpfastpal,iScrpitchH,iScrpitchV>
{
lpdbyte=lpbase;
x=w;
m4=((int)lpsrc)&3;
m4=m4?4-m4:0;
x-=m4;
while(m4--)
{
*lpdst=(MAGWORD)lpFastPal[*lpsrc++];
lpdbyte+=iScrPitchH;
}
while(x>3)
{
dwcolor=*lpdwsrc++;

color=dwcolor&0xFF;
dwcolor>>=8;
*lpdst=(MAGWORD)lpFastPal[color];
lpdbyte+=iScrPitchH;

color=dwcolor&0xFF;
dwcolor>>=8;
*lpdst=(MAGWORD)lpFastPal[color];
lpdbyte+=iScrPitchH;

color=dwcolor&0xFF;
dwcolor>>=8;
*lpdst=(MAGWORD)lpFastPal[color];
lpdbyte+=iScrPitchH;

color=dwcolor&0xFF;
*lpdst=(MAGWORD)lpFastPal[color];
lpdbyte+=iScrPitchH;

x-=4;
}
while(x--)
{
*lpdst=(MAGWORD)lpFastPal[*lpsrc++];
lpdbyte+=iScrPitchH;
}
lpsrc+=ofs;
lpbase+=iScrPitchV;
}