diff --git a/build-image.sh b/build-image.sh index e8e4f769c..1cfa0b39f 100755 --- a/build-image.sh +++ b/build-image.sh @@ -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 diff --git a/manifest b/manifest index 1cfbe3cb4..160ce0775 100644 --- a/manifest +++ b/manifest @@ -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 \ @@ -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 \ @@ -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 diff --git a/rootfs/etc/security/limits.d/audio.conf b/rootfs/etc/security/limits.d/audio.conf new file mode 100644 index 000000000..a0fce32a0 --- /dev/null +++ b/rootfs/etc/security/limits.d/audio.conf @@ -0,0 +1,3 @@ +@audio - rtprio 99 # maximum realtime priority +@audio - memlock unlimited # maximum locked-in-memory address space (KB) +#@audio - nice -19 \ No newline at end of file diff --git a/rootfs/etc/security/limits.d/gamer.conf b/rootfs/etc/security/limits.d/gamer.conf new file mode 100644 index 000000000..7bfd2dc88 --- /dev/null +++ b/rootfs/etc/security/limits.d/gamer.conf @@ -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) \ No newline at end of file diff --git a/rootfs/etc/security/limits.d/memlock.conf b/rootfs/etc/security/limits.d/memlock.conf new file mode 100644 index 000000000..87b17b013 --- /dev/null +++ b/rootfs/etc/security/limits.d/memlock.conf @@ -0,0 +1,2 @@ +* hard memlock 2147484 +* soft memlock 2147484 \ No newline at end of file diff --git a/rootfs/etc/security/limits.d/realtime.conf b/rootfs/etc/security/limits.d/realtime.conf new file mode 100644 index 000000000..e9ebc2e49 --- /dev/null +++ b/rootfs/etc/security/limits.d/realtime.conf @@ -0,0 +1,3 @@ +@realtime - rtprio 99 # maximum realtime priority +@realtime - memlock unlimited # maximum locked-in-memory address space (KB) +#@realtime - nice -19 \ No newline at end of file diff --git a/rootfs/etc/systemd/system/rtkit-daemon.service.d/override.conf b/rootfs/etc/systemd/system/rtkit-daemon.service.d/override.conf new file mode 100644 index 000000000..484d821ec --- /dev/null +++ b/rootfs/etc/systemd/system/rtkit-daemon.service.d/override.conf @@ -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 \ No newline at end of file diff --git a/rootfs/etc/udev/rules.d/99-cpu-dma-latency.rules b/rootfs/etc/udev/rules.d/99-cpu-dma-latency.rules new file mode 100644 index 000000000..d18d39a8f --- /dev/null +++ b/rootfs/etc/udev/rules.d/99-cpu-dma-latency.rules @@ -0,0 +1 @@ +DEVPATH=="/devices/virtual/misc/cpu_dma_latency", OWNER="root", GROUP="audio", MODE="0660" \ No newline at end of file diff --git a/rootfs/usr/share/wireplumber/wireplumber.conf.d/realtime.conf b/rootfs/usr/share/wireplumber/wireplumber.conf.d/realtime.conf new file mode 100644 index 000000000..5103f8206 --- /dev/null +++ b/rootfs/usr/share/wireplumber/wireplumber.conf.d/realtime.conf @@ -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 ] +} +] \ No newline at end of file