backends/drm: work around amdgpu bugs with DCC modifiers

See https://gitlab.freedesktop.org/mesa/mesa/-/issues/10875 for details. The workaround
can be disabled again with the KWIN_DRM_NO_DCC_WORKAROUND=1 environment variable
This commit is contained in:
Xaver Hugl 2024-04-22 17:21:19 +02:00
parent 445567f54e
commit 20d5f9bc6e

View file

@ -132,7 +132,15 @@ std::optional<OutputLayerBeginFrameInfo> EglGbmLayerSurface::startRendering(cons
if (requireAlpha && info->alphaBits == 0) {
continue;
}
m_surface->shadowSwapchain = EglSwapchain::create(m_eglBackend->drmDevice()->allocator(), m_eglBackend->openglContext(), m_surface->gbmSwapchain->size(), it.key(), it.value());
auto mods = it.value();
if (m_eglBackend->gpu()->isAmdgpu() && qEnvironmentVariableIntValue("KWIN_DRM_NO_DCC_WORKAROUND") == 0) {
// using modifiers with DCC here causes glitches on amdgpu: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10875
if (!mods.contains(DRM_FORMAT_MOD_LINEAR)) {
continue;
}
mods = {DRM_FORMAT_MOD_LINEAR};
}
m_surface->shadowSwapchain = EglSwapchain::create(m_eglBackend->drmDevice()->allocator(), m_eglBackend->openglContext(), m_surface->gbmSwapchain->size(), it.key(), mods);
if (m_surface->shadowSwapchain) {
break;
}