backends/drm: delay cursor updates with VRR by default for non-AMD GPUs
This commit is contained in:
parent
039fd39e34
commit
564bfafb57
3 changed files with 17 additions and 6 deletions
|
@ -22,16 +22,19 @@ namespace KWin
|
|||
*/
|
||||
static constexpr auto s_pageflipTimeout = 5s;
|
||||
|
||||
// amdgpu doesn't handle this correctly, so it's off by default
|
||||
// https://gitlab.freedesktop.org/drm/amd/-/issues/2186
|
||||
static const bool s_delayVrrCursorUpdates = qEnvironmentVariableIntValue("KWIN_DRM_DELAY_VRR_CURSOR_UPDATES") == 1;
|
||||
|
||||
DrmCommitThread::DrmCommitThread(DrmGpu *gpu, const QString &name)
|
||||
{
|
||||
if (!gpu->atomicModeSetting()) {
|
||||
return;
|
||||
}
|
||||
m_thread.reset(QThread::create([this]() {
|
||||
|
||||
static bool delayVrrCursorUpdatesEnvSet = false;
|
||||
static const bool delayVrrCursorUpdatesEnv = qEnvironmentVariableIntValue("KWIN_DRM_DELAY_VRR_CURSOR_UPDATES", &delayVrrCursorUpdatesEnvSet) == 1;
|
||||
// amdgpu doesn't handle this correctly, so it's off by default for amd gpus
|
||||
// See https://gitlab.freedesktop.org/drm/amd/-/issues/2186 for more details
|
||||
const bool delayVrrCursorUpdates = (!delayVrrCursorUpdatesEnvSet && !gpu->isAmdgpu()) || delayVrrCursorUpdatesEnv;
|
||||
|
||||
m_thread.reset(QThread::create([this, delayVrrCursorUpdates]() {
|
||||
const auto thread = QThread::currentThread();
|
||||
gainRealTime();
|
||||
while (true) {
|
||||
|
@ -77,7 +80,7 @@ DrmCommitThread::DrmCommitThread(DrmGpu *gpu, const QString &name)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if (m_commits.front()->isCursorOnly() && m_vrr && s_delayVrrCursorUpdates) {
|
||||
if (m_commits.front()->isCursorOnly() && m_vrr && delayVrrCursorUpdates) {
|
||||
// wait for a primary plane commit to be in, while still enforcing
|
||||
// a minimum cursor refresh rate of 30Hz
|
||||
const auto cursorTarget = m_lastPageflip + std::chrono::duration_cast<std::chrono::nanoseconds>(1s) / 30;
|
||||
|
|
|
@ -80,6 +80,7 @@ DrmGpu::DrmGpu(DrmBackend *backend, const QString &devNode, int fd, dev_t device
|
|||
DrmUniquePtr<drmVersion> version(drmGetVersion(fd));
|
||||
m_isI915 = strstr(version->name, "i915");
|
||||
m_isNVidia = strstr(version->name, "nvidia-drm");
|
||||
m_isAmdgpu = strstr(version->name, "amdgpu");
|
||||
m_isVirtualMachine = strstr(version->name, "virtio") || strstr(version->name, "qxl")
|
||||
|| strstr(version->name, "vmwgfx") || strstr(version->name, "vboxvideo");
|
||||
|
||||
|
@ -700,6 +701,11 @@ bool DrmGpu::isNVidia() const
|
|||
return m_isNVidia;
|
||||
}
|
||||
|
||||
bool DrmGpu::isAmdgpu() const
|
||||
{
|
||||
return m_isAmdgpu;
|
||||
}
|
||||
|
||||
bool DrmGpu::isRemoved() const
|
||||
{
|
||||
return m_isRemoved;
|
||||
|
|
|
@ -79,6 +79,7 @@ public:
|
|||
bool asyncPageflipSupported() const;
|
||||
bool isI915() const;
|
||||
bool isNVidia() const;
|
||||
bool isAmdgpu() const;
|
||||
gbm_device *gbmDevice() const;
|
||||
EglDisplay *eglDisplay() const;
|
||||
DrmBackend *platform() const;
|
||||
|
@ -138,6 +139,7 @@ private:
|
|||
bool m_addFB2ModifiersSupported = false;
|
||||
bool m_isNVidia;
|
||||
bool m_isI915;
|
||||
bool m_isAmdgpu;
|
||||
bool m_isVirtualMachine;
|
||||
bool m_supportsCursorPlaneHotspot = false;
|
||||
bool m_asyncPageflipSupported = false;
|
||||
|
|
Loading…
Reference in a new issue