diff --git a/src/backends/wayland/wayland_egl_backend.cpp b/src/backends/wayland/wayland_egl_backend.cpp index 735cd801b4..13f1023e6b 100644 --- a/src/backends/wayland/wayland_egl_backend.cpp +++ b/src/backends/wayland/wayland_egl_backend.cpp @@ -66,22 +66,18 @@ std::optional WaylandEglPrimaryLayer::doBeginFrame() const QSize nativeSize = m_output->modeSize(); if (!m_swapchain || m_swapchain->size() != nativeSize) { const QHash> formatTable = m_backend->backend()->display()->linuxDmabuf()->formats(); - uint32_t format = DRM_FORMAT_INVALID; - QList modifiers; for (const uint32_t &candidateFormat : {DRM_FORMAT_XRGB2101010, DRM_FORMAT_XRGB8888}) { auto it = formatTable.constFind(candidateFormat); - if (it != formatTable.constEnd()) { - format = it.key(); - modifiers = it.value(); + if (it == formatTable.constEnd()) { + continue; + } + m_swapchain = EglSwapchain::create(m_backend->drmDevice()->allocator(), m_backend->openglContext(), nativeSize, it.key(), it.value()); + if (m_swapchain) { break; } } - if (format == DRM_FORMAT_INVALID) { - qCWarning(KWIN_WAYLAND_BACKEND) << "Could not find a suitable render format"; - return std::nullopt; - } - m_swapchain = EglSwapchain::create(m_backend->drmDevice()->allocator(), m_backend->openglContext(), nativeSize, format, modifiers); if (!m_swapchain) { + qCWarning(KWIN_WAYLAND_BACKEND) << "Could not find a suitable render format"; return std::nullopt; } }