From e4d6723c8c56349eb7dcf2528acdfc0f25f3f965 Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sat, 9 Nov 2024 04:04:25 -0600 Subject: [PATCH] ensure 'tuned-ppd' is absent (Fedora 41), +gamescope RT --- roles/tuned_amdgpu/files/rt_gamescope.sh | 33 ++++++++++++++++++++++++ roles/tuned_amdgpu/tasks/main.yml | 15 +++++++++++ 2 files changed, 48 insertions(+) create mode 100755 roles/tuned_amdgpu/files/rt_gamescope.sh diff --git a/roles/tuned_amdgpu/files/rt_gamescope.sh b/roles/tuned_amdgpu/files/rt_gamescope.sh new file mode 100755 index 0000000..82ad68b --- /dev/null +++ b/roles/tuned_amdgpu/files/rt_gamescope.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# script run by 'tuned' to ensure gamescope has the proper capability + +# Check for arguments +if [ $# -eq 0 ]; then + echo "Usage: $0 {verify|start}" + exit 1 +fi + +function verify_cap() { + /usr/sbin/getcap "$(which gamescope)" |& grep 'sys_nice=eip' + return $? +} + +function set_cap() { + /usr/sbin/setcap 'CAP_SYS_NICE=eip' "$(which gamescope)" +} + +# Handle arguments +case "$1" in + verify) + verify_cap + ;; + start) + set_cap + ;; + *) + echo "Invalid argument. Use 'verify' or 'start'." + exit 1 + ;; +esac + diff --git a/roles/tuned_amdgpu/tasks/main.yml b/roles/tuned_amdgpu/tasks/main.yml index d22e160..9518ae3 100644 --- a/roles/tuned_amdgpu/tasks/main.yml +++ b/roles/tuned_amdgpu/tasks/main.yml @@ -22,6 +22,12 @@ state: present become: true +- name: Ensure 'tuned-ppd' is absent + ansible.builtin.package: + name: tuned-ppd + state: absent + become: true + - name: Find bundled 'tuned' profiles ansible.builtin.find: paths: @@ -85,6 +91,15 @@ notify: Restart tuned become: true +- name: Copy gamescope RT capability script + ansible.builtin.copy: + src: rt_gamescope.sh + dest: /etc/tuned/rt_gamescope.sh + owner: root + group: root + mode: '0755' + become: true + - name: Template tuned.conf for custom profiles ansible.builtin.template: src: templates/tuned.conf.j2