Skip to content

turnip/perfetto: handle gpu timestamps being non-monotonic and several fixes/refactorings

A number of fixes extracted from !12805 (merged) since its progress stalled.

Notable changes are:

  • Fixes leak when the last cmd buffer in submission doesn't have tracepoints leading to flush data not being freed.
  • Handling the fact that GPU timestamps are not monotonic.

Since non-monotonic timestamp issue isn't fully resolve - the easy way to out is to disable GPU autosuspend by increasing the suspend delay:

echo 5000 > /sys/devices/platform/soc@0/5000000.gpu/power/autosuspend_delay_ms

To properly resolve the issue with non-monotonic GPU timestamps I think we need additional cooperation from the kernel. At the moment we may read timestamps that were written before the last gpu suspend(s) and we don't have a good way to handle this.

I think the best way is for kernel on DRM_MSM_GEM_SUBMIT to return current CPU time, current monotonic GPU timestamp offset (which is increased between suspends), and current GPU timestamp. With this we would be able able to save the offset and add it to the relative timestamp we would read later from the GPU.

As a reference KGSL internally tracks these values.

Edited by Danylo Piliaiev

Merge request reports