Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

realtime: take advantage of gamescope supporting rt scheduling #983

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ passwd --lock root

# create user
groupadd -r autologin
useradd -m ${USERNAME} -G autologin,wheel,plugdev
useradd -m ${USERNAME} -G autologin,wheel,plugdev,realtime,audio,video
echo "${USERNAME}:${USERNAME}" | chpasswd

# set the default editor, so visudo works
Expand Down
6 changes: 5 additions & 1 deletion manifest
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ export AUR_PACKAGES="\
hhfc-git \
inputplumber-bin \
legendary \
lib32-gamescope-plus \
libretro-dosbox-pure-git \
libretro-opera-git \
libretro-prosystem-git \
Expand All @@ -227,6 +226,8 @@ export AUR_PACKAGES="\
powerstation-bin \
python-gbopyrator \
python-vdf \
realtime-privileges \
rtkit \
rtl8812au-dkms-git \
rtl8814au-dkms-git \
rtl88x2bu-dkms-git \
Expand Down Expand Up @@ -283,6 +284,9 @@ postinstallhook() {
${USERNAME} ALL=(ALL) NOPASSWD: /usr/share/chimera/bin/power-tool
" >/etc/sudoers.d/chimera

# Add chrt permission
echo "${USERNAME} ALL=(ALL) NOPASSWD: /usr/bin/chrt" > /etc/sudoers.d/realtime

# download and add racing wheel udev rules
pushd /usr/lib/udev/rules.d
curl -L -O https://raw.githubusercontent.com/berarma/oversteer/master/data/udev/99-fanatec-wheel-perms.rules
Expand Down
3 changes: 3 additions & 0 deletions rootfs/etc/security/limits.d/audio.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@audio - rtprio 99 # maximum realtime priority
@audio - memlock unlimited # maximum locked-in-memory address space (KB)
#@audio - nice -19
4 changes: 4 additions & 0 deletions rootfs/etc/security/limits.d/gamer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gamer soft memlock 64
gamer hard memlock 128
gamer - rtprio 99 # maximum realtime priority
gamer - memlock unlimited # maximum locked-in-memory address space (KB)
2 changes: 2 additions & 0 deletions rootfs/etc/security/limits.d/memlock.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* hard memlock 2147484
* soft memlock 2147484
3 changes: 3 additions & 0 deletions rootfs/etc/security/limits.d/realtime.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@realtime - rtprio 99 # maximum realtime priority
@realtime - memlock unlimited # maximum locked-in-memory address space (KB)
#@realtime - nice -19
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Due to a bug from 2011 (https://github.com/heftig/rtkit/issues/13) in rtkit, suspend events cause PipeWire's realtime priority to be revoked and not restored.
# Basically priority gets revoked after s2idle or s3 sleep without this. Bug is ongoing.

[Service]
ExecStart=
ExecStart=/usr/lib/rtkit-daemon --no-canary
1 change: 1 addition & 0 deletions rootfs/etc/udev/rules.d/99-cpu-dma-latency.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DEVPATH=="/devices/virtual/misc/cpu_dma_latency", OWNER="root", GROUP="audio", MODE="0660"
16 changes: 16 additions & 0 deletions rootfs/usr/share/wireplumber/wireplumber.conf.d/realtime.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
context.modules = [
{ name = libpipewire-module-rt
args = {
nice.level = 20
rt.prio = 88
rt.time.soft = -1
rt.time.hard = -1
rlimits.enabled = true
rtportal.enabled = true
rtkit.enabled = true
#uclamp.min = 0
#uclamp.max = 1024
}
flags = [ ifexists nofail ]
}
]