jlfreund
13 years agoVisitor
Performance problems on roScreen
I have a simple app that displays a few words of text, a small photo, on a fullscreen frame background. Then I want to smoothly animate a second full screen image on top of that. First, I tried roImageCanvas, but after advice from the forum, I rewrote the layout using roScreen, but am still having problems with animation.
Rendering the background (frame, photo, text) takes around 400ms, which is acceptable, except that I cannot simply create and animate a second roScreen on top of that. Both are double buffered, and drawing the second roScreen will leave a black background in place of the first roScreen, so I really need to render and animate everything in one roScreen which means I need all drawing and the swap to complete in 15ms. I profiled the contents of the first roScreen which paints a fullscreen frame, 3 DrawRect/DrawText pairs (very short text), plus one small image for a total of about 1.3X overdraw of the entire screen. Just this amount of painting already takes 400ms, so I'm a long way off.
The first thing the profiling told me was that the first DrawText seems to take a long time (I guess to init the font cache): average of 120ms. I guess if I keep the same roFont for the lifetime of the app, this won't be a problem, because subsequent DrawText using that font seems to be free.
However I found the same problem when measuring DrawRect (used to paint the background of each of the 3 short words on the screen): average of 150ms for the first tiny DrawRect, then 1ms for the 2nd and 3rd call. Not sure why the first DrawRect is always so slow or how I could workaround it.
Regarding the bitmaps, the frame background is free because I can re-use the same scaled bitmap for the lifetime of the app and DrawObject(bitmap) is always 0ms. However the other bitmaps in the layout are not-reused. The DrawObject on those bitmaps is free, but each one must be scaled, and unfortunately, I seem to get unpredictable performance results from DrawScaledObject: 67ms, 5ms, 10ms, 3ms, 5ms; even though they are all JPG, and very similar source and dest sizes.
Finally, SwapBuffers is extremely slow and pretty unpredictable: 17ms, 23ms, 13ms. This seems tragic, given that I only painted the screen ~1.3X times and the time to finish and swap is already so slow.
I'd really like to get the first layer of my scene from 400ms down to 15ms, but it seems like DrawRect and DrawScaledObject are unpredictable, and SwapBuffers is very slow. Does anyone have an idea how to do fast animation including scaled images using roScreen?
Thanks!
Jason
Rendering the background (frame, photo, text) takes around 400ms, which is acceptable, except that I cannot simply create and animate a second roScreen on top of that. Both are double buffered, and drawing the second roScreen will leave a black background in place of the first roScreen, so I really need to render and animate everything in one roScreen which means I need all drawing and the swap to complete in 15ms. I profiled the contents of the first roScreen which paints a fullscreen frame, 3 DrawRect/DrawText pairs (very short text), plus one small image for a total of about 1.3X overdraw of the entire screen. Just this amount of painting already takes 400ms, so I'm a long way off.
The first thing the profiling told me was that the first DrawText seems to take a long time (I guess to init the font cache): average of 120ms. I guess if I keep the same roFont for the lifetime of the app, this won't be a problem, because subsequent DrawText using that font seems to be free.
However I found the same problem when measuring DrawRect (used to paint the background of each of the 3 short words on the screen): average of 150ms for the first tiny DrawRect, then 1ms for the 2nd and 3rd call. Not sure why the first DrawRect is always so slow or how I could workaround it.
Regarding the bitmaps, the frame background is free because I can re-use the same scaled bitmap for the lifetime of the app and DrawObject(bitmap) is always 0ms. However the other bitmaps in the layout are not-reused. The DrawObject on those bitmaps is free, but each one must be scaled, and unfortunately, I seem to get unpredictable performance results from DrawScaledObject: 67ms, 5ms, 10ms, 3ms, 5ms; even though they are all JPG, and very similar source and dest sizes.
Finally, SwapBuffers is extremely slow and pretty unpredictable: 17ms, 23ms, 13ms. This seems tragic, given that I only painted the screen ~1.3X times and the time to finish and swap is already so slow.
I'd really like to get the first layer of my scene from 400ms down to 15ms, but it seems like DrawRect and DrawScaledObject are unpredictable, and SwapBuffers is very slow. Does anyone have an idea how to do fast animation including scaled images using roScreen?
Thanks!
Jason