opengl: assume a minimum of 2ms of render time
When GPUs are barely loaded, render times can spike randomly, likely because it goes to a lower power state and has to ramp up again when KWin renders. To ensure this doesn't make KWin drop frames, assume rendering always takes at least 2 milliseconds
This commit is contained in:
parent
da80dd4c84
commit
1b10dde569
1 changed files with 4 additions and 1 deletions
|
@ -57,8 +57,11 @@ std::chrono::nanoseconds GLRenderTimeQuery::result()
|
|||
|
||||
const std::chrono::nanoseconds gpuTime(m_gpuProbe.end - m_gpuProbe.start);
|
||||
const std::chrono::nanoseconds cpuTime = m_cpuProbe.end - m_cpuProbe.start;
|
||||
// timings are pretty unpredictable in the sub-millisecond range; this minimum
|
||||
// ensures that when CPU or GPU power states change, we don't drop any frames
|
||||
const std::chrono::nanoseconds minimumTime = std::chrono::milliseconds(2);
|
||||
|
||||
return std::max(gpuTime, cpuTime);
|
||||
return std::max({gpuTime, cpuTime, minimumTime});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue