1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-18 19:49:40 +00:00

x11-wm/kwinft: support mac_priority(4) on Wayland

https://blog.martin-graesslin.com/blog/2017/09/kwinwayland-goes-real-time/
This commit is contained in:
Jan Beich 2023-07-15 08:31:14 +00:00
parent 8c3e03e40f
commit 9bb1dbe677
3 changed files with 44 additions and 1 deletions

View File

@ -1,7 +1,7 @@
PORTNAME= kwinft
DISTVERSIONPREFIX= ${PORTNAME}@
DISTVERSION= 5.27.0
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= x11-wm wayland
MAINTAINER= jbeich@FreeBSD.org

View File

@ -0,0 +1,36 @@
- Emulate SCHED_RESET_ON_FORK via pthread_atfork
- Switch to pthread_setschedparam as Linux sched_setscheduler
operates on threads contrary to POSIX
--- main_wayland.cpp.orig 2023-02-17 14:50:58 UTC
+++ main_wayland.cpp
@@ -58,7 +58,7 @@ along with this program. If not, see <http://www.gnu.
#include <QDebug>
#include <QWindow>
-#include <sched.h>
+#include <pthread.h>
#include <sys/resource.h>
#include <iostream>
@@ -122,12 +122,17 @@ void gainRealTime()
namespace {
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);
+ });
}
}

View File

@ -36,6 +36,13 @@ Replace KWin in Plasma Desktop:
$ pkg set -o x11-wm/plasma5-kwin:x11-wm/kwinft
$ pkg upgrade -f kwinft
$ pkg lock kwinft
Improve Wayland responsiveness under high load:
$ sysrc kld_list+=mac_priority
$ service kld restart
$ pw groupmod realtime -m <user>
$ exit # log out to refresh group permissions
EOM
}
]