From 2c2a73e320375bb15f23996d4d6bc143ba176627 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 6 Feb 2021 17:07:21 -0600 Subject: [PATCH] Fix build and require SDL 2.0.15 to hook --- app/app.pro | 1 + app/masterhook.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/app/app.pro b/app/app.pro index a710e9c8..a91c4fd2 100644 --- a/app/app.pro +++ b/app/app.pro @@ -254,6 +254,7 @@ libdrm { linux { message(Master hooks enabled) SOURCES += masterhook.c + LIBS += -ldl } } config_EGL { diff --git a/app/masterhook.c b/app/masterhook.c index 0c4b4b92..e7e6b84a 100644 --- a/app/masterhook.c +++ b/app/masterhook.c @@ -20,6 +20,14 @@ #include #include +// We require SDL 2.0.15+ to hook because it supports sharing +// the DRM FD with our code. This avoids having multiple DRM FDs +// in flight at the same time which would significantly complicate +// the logic here because we'd need to figure out exactly which FD +// should be the master at any given time. With the position of our +// hooks, that is definitely not trivial. +#if SDL_VERSION_ATLEAST(2, 0, 15) + // Qt's DRM master FD grabbed by our hook int g_QtDrmMasterFd = -1; struct stat64 g_DrmMasterStat; @@ -134,3 +142,5 @@ int close(int fd) } return ret; } + +#endif