I'm currently in the process of trying to draw to screen as fast as possible on a S60 5th device, my ultimate dream is to get my app running at constant 60fps.
So I wanted to draw directly to the frame buffer, but looks like there is no way to do that in S60 5th. I heard that a good workaround is to use CDirectScreenBitmap, so I tried using it, with this example : http://wiki.forum.nokia.com/index.ph...ctScreenBitmap
It's working but there are few issues :
-when running the app the first time, the drawing is correctly synchronized with the screen refresh rate, the app run at a constant 30 fps (one frame out of two, which makes sense),
But, if the phone goes into sleep mode when the apps is running, either by a press to the keyguard switch or after a while, when it resumes the drawing is NOT synchronized with the screen refresh rate anymore, and there is some tearing, plus the app is now running at 38 fps. Even if I restart the app, the problem remains, the only way to get things back to normal (with sync screen) is to reboot the phone.
Anyone experienced this before ? is it a symbian os bug or is there something wrong with my app ?
oh and the Vsync never works when the app run under the windows emulator, is this normal too ?
-Now comes the performance issue :
I only get 30fps at max while the screen refresh rate is 60Hz (one frame out of two).
I tried to draw something very simple in order to use the less time as possible while drawing to the backbuffer, but I still get the same results. Actually, the whole process of :
writing data to the backbuffer
takes less than 5ms (on the phone, because for some reasons EndUpdate takes much more time on the emulator)
but the wait for the Update to finish takes lot of time,I think that's weird, because, correct me if I'm wrong, but if the backbuffer is copied to the screenbuffer while trying to avoid tearing, this means that it needs to be copied during the Vblank, ie while the screen is not using the screen buffer, maybe I'm wrong but in any case it should take less than a screen refresh time . so why does it looks like it takes more than 1/60 sec to do it, I know it waits for the Vblank to start copy (hence the "anti-tearing"), but even if I write very few pixels to the buffer (which takes no time) and start to render the frame immediately after one copy is completed, I can't get over 30fps
-In the example quoted above, it is stated that start processing the next frame in RunL (which is called when the copy of the frame is completed) is slow, but if I use a Cperiodic timer to process frame it is even slower, no matter what the Interval time is.
It is also stated that there is a delay between CDirectScreenBitmap::EndUpdate() and the completion of screen refresh , this may explain the problem I talked about before, but it doesn't says how to avoid it.
but I'm not really sure of how all this stuff is working, is it really a copy from the backbuffer to the screenbuffer ? (a buffer switching would have been faster)
or maybe it copy to the screen at the same speed the screen is being refresh, meaning this leaves only the Vblank time to write to the backbuffer. I don't know so if someone knows something about that, but any kind of help is appreciated.
Thank your if you can find some time to help me.