|
|
|
|
@ -66,22 +66,18 @@ std::optional<OutputLayerBeginFrameInfo> WaylandEglPrimaryLayer::doBeginFrame() |
|
|
|
|
const QSize nativeSize = m_output->modeSize(); |
|
|
|
|
if (!m_swapchain || m_swapchain->size() != nativeSize) { |
|
|
|
|
const QHash<uint32_t, QList<uint64_t>> formatTable = m_backend->backend()->display()->linuxDmabuf()->formats(); |
|
|
|
|
uint32_t format = DRM_FORMAT_INVALID; |
|
|
|
|
QList<uint64_t> 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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|