Investigating dropped frames

I am trying to figure out why our game cannot hit a 100% steady 60 FPS in the Core Animation FPS inspector. It seems to run at several 'ticks' at 60, then there is one 59, then a few 60s, etc. So I turned to the Metal Trace tool and indeed I can find a couple of "Surface was displayed for 33.xx ms" events. But by looking at the trace, I do not understand *why* this frame is displayed for that time. See the screenshot:


Edit: The image does not show up on the forums, so here is a direct link: http://storage.firigames.com/public/dev/dropped_frames.png



The selected red trace obviously has a very slow encoding step (for unknown reasons, the frames do not vary that dramatically), but by looking at the trace it seems that it should have been finished in time for vsync. Instead, the blue frame is displayed for two vsyncs, and then the red one is displayed for another two vsyncs, even though the next green frame is already finished. Anyone have some insight in what is happening here?


All recording on iOS 10 beta 6, using an iPad Pro 9.7".

Are the dropped frames always preceded by a command encoder that takes an abnormally long time, like the one you highlighted? Also, are you rendering on the the main thread or a background thread, and how/when do you present your drawable?

Ok so this post finally showed up. I will do some more testing as soon as I have time. I did find another screenshot of a slow-ish encoding step (~10ms, instead of the usual 2-4 ms). Again, that frame was displayed for 33ms, even though the frame following that one was already finished rendering on the gpu. (I can provide the image on request. I don't want to have this post stuck in moderation for days again).


We are rendering on a background thread (using qos user interactive). Drawables are presented by using [commandbuffer presentDrawable:] .

Hey, did you figure out th eissue? I am having an issue where my fps starts continuously droppinng after like 3-4 minutes and after restarting the game and movin gonto new scene. I erase the screens from the memory however I am still having an issue. Do you know what might be causing the issue?

Thank You in advance!


Filip

Investigating dropped frames
 
 
Q