wayland_server: guard against DRM_IOCTL_SYNCOBJ_EVENTFD being broken

...either because it's not implemented, or because it's buggy.
This commit is contained in:
Xaver Hugl 2024-04-16 13:51:42 +02:00
parent 01d224fa22
commit 26afbfb6fa

View file

@ -19,6 +19,7 @@
#include "layershellv1window.h"
#include "main.h"
#include "options.h"
#include "utils/kernel.h"
#include "utils/serviceutils.h"
#include "virtualdesktops.h"
#include "wayland/appmenu.h"
@ -840,6 +841,15 @@ LinuxDrmSyncObjV1Interface *WaylandServer::linuxSyncObj() const
void WaylandServer::setRenderBackend(RenderBackend *backend)
{
if (backend->supportsTimelines()) {
// ensure the DRM_IOCTL_SYNCOBJ_EVENTFD ioctl is supported
const auto linuxVersion = linuxKernelVersion();
if (linuxVersion.majorVersion() < 6 && linuxVersion.minorVersion() < 6) {
return;
}
// also ensure the implementation isn't totally broken, see https://lists.freedesktop.org/archives/dri-devel/2024-January/439101.html
if (linuxVersion.majorVersion() == 6 && (linuxVersion.minorVersion() == 7 || (linuxVersion.minorVersion() == 6 && linuxVersion.patchVersion() < 19))) {
return;
}
if (!m_linuxDrmSyncObj) {
m_linuxDrmSyncObj = new LinuxDrmSyncObjV1Interface(m_display, m_display);
}