androidvsyncsurfaceflinger

Android display VSYNC signal is highly erratic


I'm investigating frame drops in my Android app. They are irregular and happen around once a second on average. I have paired back the renderer in question to a very simple shader and I'm confident that frame render time is short.

When I run systrace I can see what look like the dropped frames, but the cause appears to be that the HW_VSYNC_0 signal occasionally fails to flip (i.e. it sticks at 0 or 1 for half a cycle). My understanding (from this answer) was that this clock comes from the display hardware and should therefore be regular.

The VSYNC-sf signal carries on regardless, although occasionally it flips as well, presumably in a desperate attempt to get back in sync.

My question: is this expected behaviour and what causes it to happen?

Screenshot of systrace


Solution

  • While I can't exactly explain the erratic behaviour of the various sync signals, I did finally work out that my underlying stutter was caused by overzealous power control at the OS level. The CPU clock appeared to step down until the frame rendering time exceeded the refresh time, then something (probably unrelated) kicked the CPU clock back up to maximum.