Internal ftrace marker

Roman Gilg requested to merge romangg/xserver:ftraceMarker into master

This is an internal interface for ftrace on Linux. The original idea is to allow us analyzing frame-by-frame timings of XServer's internal processes intertwined with other external processes and hardware.

For example look at this output via GPUVis of ftrace markings in Present together with some additional ones in KWin presenting Neverball in windowed mode:


We can clearly see that flip 4623 for some reason does not hit the next vblank although there should be enough time for that. And from this point on KWin's internal logic is broken leading to an additional delay of one frame. The marked long pause is a single call into GLX to receive buffer age information on the current back-buffer.

This new ftrace interface can be fed at arbitrary places in the XServer with the ftrace_print and ftrace_print_begin/end calls. It is always available on Linux allowing us to get traces from users. It is started by providing the new -ftrace option when launching the XServer. It might be a good idea to provide a D-Bus interface as well so it can be toggled on/off while the XServer is running.

I thought it would be smart to use function pointers instead of conditionals and switching these pointers around when enabling/disabling the interface in order to improve performance. But my research later on showed that it probably does not make a difference with modern branch prediction. So as it is now with the pointers it works, but if public opinion prefers not to use function pointers, I can do this too.

Merge request reports