blob: b84faf4b718389eacf06ecb35b977106ba6a5351 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
MULTILIB_COMPAT=( abi_x86_{32,64} )
inherit meson multilib-minimal ninja-utils systemd
DESCRIPTION="Optimise Linux system performance on demand"
HOMEPAGE="https://github.com/FeralInteractive/gamemode"
if [[ ${PV} == "9999" ]] ; then
EGIT_REPO_URI="https://github.com/FeralInteractive/gamemode.git"
GAMEMODE_GIT_PTR="master"
inherit git-r3
else
GAMEMODE_GIT_PTR="${PV}"
SRC_URI="https://github.com/FeralInteractive/gamemode/releases/download/${GAMEMODE_GIT_PTR}/${P}.tar.xz"
KEYWORDS="~amd64 ~x86"
fi
LICENSE="BSD"
SLOT="0"
IUSE="systemd elogind"
REQUIRED_USE="^^ ( systemd elogind )"
RDEPEND="
acct-group/gamemode
dev-libs/inih
sys-apps/dbus[${MULTILIB_USEDEP},systemd(+)=,elogind(-)=]
sys-auth/polkit
sys-libs/libcap
"
DEPEND="${RDEPEND}"
DOCS=(
CHANGELOG.md
LICENSE.txt
README.md
example/gamemode.ini
)
pkg_pretend() {
elog
elog "GameMode needs a kernel capable of SCHED_ISO to use its soft realtime"
elog "feature. Examples of kernels providing that are sys-kernel/ck-sources"
elog "and sys-kernel/pf-sources."
elog
elog "Support for soft realtime is completely optional. It may provide the"
elog "following benefits with systems having at least four CPU cores:"
elog
elog " * more CPU shares allocated exclusively to the game"
elog " * reduced input lag and reduced thread latency"
elog " * more consistent frame times resulting in less microstutters"
elog
elog "You probably won't benefit from soft realtime mode and thus don't need"
elog "SCHED_ISO if:"
elog
elog " * Your CPU has less than four cores because the game may experience"
elog " priority inversion with the graphics driver (thus heuristics"
elog " automatically disable SCHED_ISO usage then)"
elog " * Your game uses busy-loops to interface with the graphics driver"
elog " but you may still force SCHED_ISO per configuation file, YMMV,"
elog " it depends on the graphics driver implementation, i.e. usage of"
elog " __GL_THREADED_OPTIMIZATIONS or similar."
elog " * If your game causes more than 70% CPU usage across all cores,"
elog " SCHED_ISO automatically turns off and on depending on usage and"
elog " is processed with higher-than-normal priority then (renice)."
elog " This auto-switching may result in a lesser game experience."
elog
elog "For more info look at:"
elog "https://github.com/FeralInteractive/gamemode/blob/${GAMEMODE_GIT_PTR}/README.md"
elog
}
multilib_src_configure() {
local emesonargs=(
-Dwith-sd-bus-provider=$(usex systemd "systemd" "elogind")
-Dwith-systemd-user-unit-dir="$(systemd_get_userunitdir)"
)
if ! multilib_is_native_abi; then
emesonargs+=(
-Dwith-examples=false
-Dwith-sd-bus-provider=no-daemon
)
fi
meson_src_configure
}
multilib_src_compile() {
eninja
}
multilib_src_install() {
DESTDIR="${D}" eninja install
if multilib_is_native_abi; then
insinto /etc/security/limits.d
newins - 45-gamemode.conf <<-EOF
@gamemode - nice -10
EOF
fi
}
pkg_postinst() {
elog
elog "GameMode has optional support for adjusting nice and ioprio of games"
elog "running with it. You may need to adjust your PAM limits to make use"
elog "of this. You need to be in the gamemode group for this to work."
elog
elog "Run the following command as root to add your user:"
elog "# gpasswd -a USER gamemode # with USER = your user name"
elog
elog "You can run the following command to test your settings:"
elog
elog "# gamemoded -t"
elog
elog "GameMode supports GPU optimizations. It defaults to OFF. Any"
elog "damage resulting from usage of this is your own responsibility."
elog
elog "systemd user sessions will automatically run the daemon on demand,"
elog "it does not need to be enabled explicitly. Games not supporting"
elog "GameMode natively can still make use of it, just add"
elog
elog "gamemoderun %command%"
elog
elog "to the start options of any steam game to enable optimizations"
elog "automatically as you start the game."
elog
}
|