From 71cefb0754ca71383692bc3190e79681393ebcd0 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sat, 15 Jul 2023 07:36:17 +0000 Subject: [PATCH] x11-wm/plasma5-kwin: support mac_priority(4) on Wayland PR: 272511 Approved by: ? --- x11-wm/plasma5-kwin/Makefile | 1 + .../files/patch-src_utils_realtime.cpp | 35 +++++++++++++++++++ x11-wm/plasma5-kwin/pkg-message | 8 +++++ 3 files changed, 44 insertions(+) create mode 100644 x11-wm/plasma5-kwin/files/patch-src_utils_realtime.cpp create mode 100644 x11-wm/plasma5-kwin/pkg-message diff --git a/x11-wm/plasma5-kwin/Makefile b/x11-wm/plasma5-kwin/Makefile index 6d3853a76212..60ff9205cba9 100644 --- a/x11-wm/plasma5-kwin/Makefile +++ b/x11-wm/plasma5-kwin/Makefile @@ -1,5 +1,6 @@ PORTNAME= kwin DISTVERSION= ${KDE_PLASMA_VERSION} +PORTREVISION= 1 CATEGORIES= x11-wm kde kde-plasma MAINTAINER= kde@FreeBSD.org diff --git a/x11-wm/plasma5-kwin/files/patch-src_utils_realtime.cpp b/x11-wm/plasma5-kwin/files/patch-src_utils_realtime.cpp new file mode 100644 index 000000000000..48efbb08a1c0 --- /dev/null +++ b/x11-wm/plasma5-kwin/files/patch-src_utils_realtime.cpp @@ -0,0 +1,35 @@ +- Emulate SCHED_RESET_ON_FORK via pthread_atfork +- Switch to pthread_setschedparam as Linux sched_setscheduler + operates on threads contrary to POSIX + +--- src/utils/realtime.cpp.orig 2023-06-20 13:32:36 UTC ++++ src/utils/realtime.cpp +@@ -8,19 +8,24 @@ + + #include "config-kwin.h" + +-#include ++#include + + namespace KWin + { + + void gainRealTime() + { +-#if HAVE_SCHED_RESET_ON_FORK + const int minPriority = sched_get_priority_min(SCHED_RR); + sched_param sp; + sp.sched_priority = minPriority; +- sched_setscheduler(0, SCHED_RR | SCHED_RESET_ON_FORK, &sp); +-#endif ++ if (pthread_setschedparam(pthread_self(), SCHED_RR, &sp)) ++ return; ++ ++ pthread_atfork(NULL, NULL, []() { ++ sched_param sp; ++ sp.sched_priority = 0; ++ pthread_setschedparam(pthread_self(), SCHED_OTHER, &sp); ++ }); + } + + } // namespace KWin diff --git a/x11-wm/plasma5-kwin/pkg-message b/x11-wm/plasma5-kwin/pkg-message new file mode 100644 index 000000000000..df793f16184b --- /dev/null +++ b/x11-wm/plasma5-kwin/pkg-message @@ -0,0 +1,8 @@ +[ +{ type: install + message: <