Gp2x Dreadfully Slow ?


erwam.bancal

Still Fresh
Joined
Jun 7, 2007
Messages
7
Hi I am new to gp2x development and yesterday I tried to make a rotate sprite routine.
I didn't work and at first I fought it just crashed. But after a while I worked out that it was just dreadfully slow.

So I made a test to see how slow it was, it looked like that :
CODE


unsigned tick1 = SDL_GetTicks ();
for (unsigned i=0; i<420; ++i)
{
for (unsigned j=0; j<280; ++j)
{
float result = 10.12564f * i + 11.256544f*j;
}
}
unsigned tick2 = SDL_GetTicks ();
fprintf(stderr, "It took %i milisecondes", tick2 - tick1);



And this took a little les that 5 seconds !
I am aware that the gp2x has no fpu so I made a test with integers.

CODE

unsigned tick1 = SDL_GetTicks ();
for (unsigned i=0; i<420; ++i)
{
for (unsigned j=0; j<280; ++j)
{
// for a rotate sprite function I need at least 10 integer mult and div :
// ten multiplication and division (integers)
...
..
.
}
}

unsigned tick2 = SDL_GetTicks ();
fprintf(stderr, "It took %i milisecondes", tick2 - tick1);



This took 300 milisec, I am aware that this is not optmised at all etc. But how are you supposed to make a decent 2d game with that power ? Is sprite rotation out of the question ?
Or is my unit bust ? I don't think so because I managed to run a 3d game demo.

All in all I am wondering : Is software sprite rotation possible ?

Thanks for your answers, I am really lost here.


PS: I am using the default gcc compiler optimisations.
--
Al'
 
Hi. I just ran your first test and I get a result of tick2 - tick1 = 3.

Edit: The result varies - sometimes it is 2, sometimes 3. If I clock the GP2X to run at 50 it returns 11 or 12.
 
Thanks a lot, I am relieved.. so it must be something on my side or my hardware is dead.
What does that mean " I clock the GP2X to run at 50 " is that 50 MHz instead of 200 MHz ?

--
Al'
 
I use Ryo's menu replacement which allows you set the speed before running an app. So I just set it to 50MHz to see if it would make that much difference. The 2/3 ms result was at the default speed which I guess is 200MHz.
 
AlKatar, are you by any chance starting your app from the terminal without setting the cpu speed before?
Cause the menu clocks down to 50-or-something mhz until you select a app from it.

Also make sure you are using a decent devkit and not gphs one, thats outdated as hell.
And make sure to set -o3 -msoft-float and -static in your compile options
 
If your running from telnet, make sure to kill the menu first (killall gp2xmenu) before running your app. This ensures the cpu speed is set to normal and your program runs as fast as possible.
 
I am starting without setting the cpu speed indeed but that does't explain the 5 secondes : ), I didnt know it was setting it at 50 Mhz by default.

By devkit do you mean the hardware or the software ? If it is sofware can you give me a link to the one you would recommand ?
I think I used the files from that tutorial to set up my dev env. I am on windows.
I will try the compile options tonight. Thanks or your quick answers !

[edit]
I am killing the menu ideed so that is not the problem...
Probably my devkit..

--
Al'
 
yaustar recently put together an environment that includes codeblocks in this thread.
yaustar's preconfigured environment
Just unpack it to your C drive and it installs devkit and codeblocks and an SDL test folder all configured for you. Three cheers for yaustar!
 
Last edited by a moderator:
Could the fact that I am running the programm from /mnt/sd/test.gpe make it slow ? Does it have to be in the NAND memory ?

--
Al'
 
Vimacs said:
Are you sure the menu restores the default speed when killed?
In the 2.1 firmware, definitely, as I never set the cpu speed myself, yet it runs at normal speed.

QUOTE
Could the fact that I am running the programm from /mnt/sd/test.gpe make it slow ? Does it have to be in the NAND memory ?


Not at all.

What firmware are you using?
 
Last edited by a moderator:
Wait, doesn't gp2xmenu run at 200Mhz by default? I think in pre-2.1.* the menu ran at 100Mhz, then GPH removed that to get rid of the flickering?
 
I think I have firmware 2.0. I will have another go this evening. I'll keep you posted.
Thanks guys, very much apreciated

--
Al'
 
I thought they increased the speed for the menu, but I don't think they increased it to 200mhz
 
Mr.Jabberwocky said:
yaustar recently put together an environment that includes codeblocks in this thread.
yaustar's preconfigured environment
Just unpack it to your C drive and it installs devkit and codeblocks and an SDL test folder all configured for you. Three cheers for yaustar!


Holy crap, last time I setup the dev enviroment it took me forever to setup. I'm really glad to hear that as I was going to attempt programming the gp2x again. This is sweet. yaustar's my hero I'm going to set it up when I get home from work today.
 
Last edited by a moderator:
Hi Guys,
Thanks for your advices, I am running yaustar's dev kit now and the thing runs normaly.
But I tried to run sdltest.gpe from the pc and it says "sdl parachute deployed" I think its because it cannot load the font (the pointer is NULL)
More suprisigly it runs fine when I run it from the gp2x.

Any ideas ?
--
Al'
 
Hello,
I fixed everything now, and it seems that when running form telnet one has to give the absolute path to files.
Sorry for the hassle.

The performances are decent now but still really bad. I am now looking into fixed point maths and by the look of the ARM I'll have to do it with 16 bits.


--
Al'
 
Back
Top