backends/drm: disable buffer readability checks on Intel

They cause stutters and reduced frame rates on some Intel laptops because the
buffers don't become readable in time, so disable the checks until that's fixed
on the driver side. For debugging purposes, the environment variable
KWIN_DRM_DISABLE_BUFFER_READABILITY_CHECKS can be used to override the default
behavior.

BUG: 476860
This commit is contained in:
Xaver Hugl 2023-11-13 14:46:26 +01:00
parent 93443a8228
commit 869e86ff00
3 changed files with 16 additions and 0 deletions

View file

@ -26,11 +26,19 @@
namespace KWin
{
static bool s_envIsSet = false;
static bool s_disableBufferWait = qEnvironmentVariableIntValue("KWIN_DRM_DISABLE_BUFFER_READABILITY_CHECKS", &s_envIsSet) && s_envIsSet;
DrmFramebuffer::DrmFramebuffer(DrmGpu *gpu, uint32_t fbId, GraphicsBuffer *buffer)
: m_framebufferId(fbId)
, m_gpu(gpu)
, m_bufferRef(buffer)
{
if (s_disableBufferWait || (m_gpu->isI915() && !s_envIsSet)) {
// buffer readability checks cause frames to be wrongly delayed on some Intel laptops
// See https://gitlab.freedesktop.org/drm/intel/-/issues/9415
m_readable = true;
}
}
DrmFramebuffer::~DrmFramebuffer()

View file

@ -75,6 +75,7 @@ DrmGpu::DrmGpu(DrmBackend *backend, const QString &devNode, int fd, dev_t device
// find out what driver this kms device is using
DrmUniquePtr<drmVersion> version(drmGetVersion(fd));
m_isNVidia = strstr(version->name, "nvidia-drm");
m_isI915 = strstr(version->name, "i915");
m_isVirtualMachine = strstr(version->name, "virtio") || strstr(version->name, "qxl")
|| strstr(version->name, "vmwgfx") || strstr(version->name, "vboxvideo");
@ -690,6 +691,11 @@ bool DrmGpu::isNVidia() const
return m_isNVidia;
}
bool DrmGpu::isI915() const
{
return m_isI915;
}
bool DrmGpu::isRemoved() const
{
return m_isRemoved;

View file

@ -79,6 +79,7 @@ public:
bool addFB2ModifiersSupported() const;
bool asyncPageflipSupported() const;
bool isNVidia() const;
bool isI915() const;
gbm_device *gbmDevice() const;
EglDisplay *eglDisplay() const;
DrmBackend *platform() const;
@ -137,6 +138,7 @@ private:
bool m_atomicModeSetting;
bool m_addFB2ModifiersSupported = false;
bool m_isNVidia;
bool m_isI915;
bool m_isVirtualMachine;
bool m_asyncPageflipSupported = false;
bool m_isRemoved = false;