Skip to content

opengl: Harden GLRenderTimeQuery against opengl providing bad timestamps

The end render timestamp can be slightly in the past before the start render timestamp. This results in negative render times, which can make kwin wait way more than just one vblank interval before starting the next frame.

It appears that there is no way to detect if the gpu has performed a disjoint operation in OpenGL. It's available only in GLES. As a way around, this change makes the GLRenderTimeQuery insert two probes: one queries gl timestamps when starting rendering and ending rendering; another one just queries std::steady_clock before and after painting. This hardens the GLRenderTimeQuery against OpenGL providing nonsensical results sometimes.

BUG: 481721

Merge request reports