User error. And truth is stranger than fiction as always...
Unity8 was freezing every 5 seconds because that's the ext3/ext4 journal commit interval.
Unity8 was not doing the IO directly, but since it's being bypassed through USC, is very time-sensitive. Fullscreen bypass holds buffers back from the client for the duration of a frame. So the freeze was USC periodically failing to return Unity8 a buffer in time. The problem with USC as shown above was in its Mir compositor thread. I had configured it to use --compositor-report=log, which although it writes very little text, is subject to the ext3/ext4 journaling rules which force a commit/sync every 5 seconds by default.
So the delay was USC's compositor thread writing to its log, which only once every 5 seconds is a slow operation. Whenever the hiccup occurred, that held back a bypass buffer from Unity8 a bit too long.
To add to the problem, Mir's Mesa-KMS driver does not allow more than one frame to be pre-rendered so as to keep visual lag down. So it sometimes didn't have a fresh U8 frame ready in time and would skip a whole frame. There's no catch-up in the Mir Mesa-KMS driver, although I've coincidentally been thinking about implementing it. But doesn't matter; as soon as I turned off --compositor-report=log the bug was solved.
User error. And truth is stranger than fiction as always...
Unity8 was freezing every 5 seconds because that's the ext3/ext4 journal commit interval.
Unity8 was not doing the IO directly, but since it's being bypassed through USC, is very time-sensitive. Fullscreen bypass holds buffers back from the client for the duration of a frame. So the freeze was USC periodically failing to return Unity8 a buffer in time. The problem with USC as shown above was in its Mir compositor thread. I had configured it to use --compositor- report= log, which although it writes very little text, is subject to the ext3/ext4 journaling rules which force a commit/sync every 5 seconds by default.
So the delay was USC's compositor thread writing to its log, which only once every 5 seconds is a slow operation. Whenever the hiccup occurred, that held back a bypass buffer from Unity8 a bit too long.
To add to the problem, Mir's Mesa-KMS driver does not allow more than one frame to be pre-rendered so as to keep visual lag down. So it sometimes didn't have a fresh U8 frame ready in time and would skip a whole frame. There's no catch-up in the Mir Mesa-KMS driver, although I've coincidentally been thinking about implementing it. But doesn't matter; as soon as I turned off --compositor- report= log the bug was solved.