dflemstr said:
It does not have a FPU in the core IIRC, but I think that you get access to floats anyways through the DSP or some related chip, and I was told that the float performance you get out of using it is only slightly worse compared to i686.
If that's not the case, then just replace all floats by fixed point values or even ints with manual scaling; I don't care as long as you have the ability to store fractional values somehow. I still believe that your jump issues are caused by an inaccurate timer and stacking rounding errors, and using averages and fractions respectively are the only solutions to those problems that I'm aware of.
No...
Cortex-A8 on Pandora has an FPU called VFPlite, but it's not pipelined so most useful operations take a minimum of several cycles, somewhere around 7. That's throughput, not just latency. VFPlite can handle both single and double precision and can conform to IEEE754 standards for formats and operations.
It also has a vector FPU called NEON, that can start a two-wide single precision operation per cycle. It's not IEEE754 compliant, and the compiler right now won't generate scalar code (mis)using it, as far as I know. It can vectorize code to use it, but not everything is vectorizable and I doubt GCC is that amazing at it anyway.
The DSP is purely fixed point.
I'm certain his problem has nothing to do with accumulated roundoff error from moving things, because he's moving at one pixel per interval. Making a 2D game time based instead of frame based is a waste
if you can guarantee that the framerate will be acceptably high. Consoles have had fixed framerate and frame based timing for years. Since 2D doesn't have that dynamic a load it's not that hard to do it, and if it really does become a problem you can use frameskip to alleviate it, which will have similar results. The main thing is that you want to time to vsync and you want to have a consistent framerate as much as possible.
Anyway, here's what I think.. yes, SDL_Delay is not going to have perfect precision, probably no better than 1Hz, and it errs liberally. Even regardless of the precision you can end up being late. If SDL_Flip is also waiting for vsync (depends on your setup, but this is at least what you want it to be doing - and I'm going to guess it is because you said you're using double buffering) then your delay being late by even the most minute amount will cause it to miss the vsync you wanted to wait for, and SDL_Flip will now be waiting for the next one. Meaning an entire frame will be missed and it'll look jumpy.
The first thing you want to do is verify the problem. Keep a running average of frames per second by using SDL_GetTicks and a frames displayed counter. Run it for a long time. If it doesn't stabilize towards the fps you wanted then you know it's busted and it's not just mid-frame jitter. Now, to fix it, what you're going to want to do is delay for a lower period. You might have to do experiment to find out how much you can get away with. In fact, you can make a routine which does this at startup - try several delays back to back in tight loops and see how off you end up in the end by looking at the ticks. You can use this to find timer precision and overhead. You want to take that precision and round
down towards it and then add the overhead. The goal will be to wait for as much as you feel safe waiting for, then let SDL wait for vsync for the rest. This is only necessary because I'm assuming SDL is spin locking to wait for vsync. I say this because I don't think that there are good generic ways of having the OS do it for its Windows or Linux targets. If I'm wrong then that means you should take out the delay entirely. In fact, you may want to try that first just to see if it fixes things.
Pandora won't have this problem because it
will have a way to wait for vsync by using Linux's event system. Linux will be free to schedule other things in the mean time or halt the CPU, but once the vsync interrupt triggers the device driver waiting for it will wake up your process, which will probably be scheduled immediately thereafter.