Subject: Latency and nesting

From: Daniel van Vugt <[email-masked]>
Date: Mon, 28 Oct 2013 10:33:00 +0800

Has anyone else noticed there's a number of context switches between a 
client rendering a frame and it finally reaching the framebuffer?

Obviously there's a minimum of one, since the client and server will be 
different processes. But I'm concerned about the increased latency we're 
imposing by other threads. The server takes an additional context switch 
internally to pass a buffer swap from "frontend" to the backend 
(compositor threads).

As for clients, I think they stay in the same thread for rendering and 
sending data to the server. So that's good. But clients suffer a similar 
problem whereby incoming data from the server is in a different thread 
to that where the rendering (probably) happens.

I suspect these context switches, when compounded, could become 
significant to input (touch!) latency. And nesting will multiply the 
issue further.

So we should be keep this in mind going forward, and try to avoid adding 
any more context switches between threads.

- Daniel