Repository navigation
Enable automatic direct scanout for fullscreen games - #11553
candrewlee14 wants to merge 2 commits into
Conversation
Automated AI review
Outcome: On Omarchy the setting mainly reaches RetroArch; the new test passes with it commented out. Proton and SDL games are unaffectedMode 2 scans out only fullscreen windows of content type Suggested change: describe the reach as "clients that tag themselves as games, such as RetroArch", or add a The test misses a disabled settingThe grep passes when Suggested change: evaluate it in Lua like Reproducer (at 5e936e3)Run from the root of a checkout of the PR head (5e936e3). It copies #!/bin/bash
# Run from the root of a checkout of the PR head (5e936e3).
# Breaks default/hypr/looknfeel.lua in two ways and shows what the PR's test,
# a Lua-evaluating test, and Hyprland's own config check say about each copy.
set -u
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
cat >"$work/hyprland-direct-scanout-test.sh" <<'TEST'
#!/bin/bash
source "$(dirname "${BASH_SOURCE[0]}")/base-test.sh"
require_command lua
# Evaluate the package default the way Hyprland merges it: every hl.config()
# call sets the dotted keys it names, and a later call wins.
settings=$(OMARCHY_PATH="$ROOT" lua <<'LUA'
local merged = {}
local function merge(prefix, tbl)
for key, value in pairs(tbl) do
local name = prefix == "" and key or prefix .. "." .. key
if type(value) == "table" and type(next(value)) == "string" then
merge(name, value)
else
merged[name] = value
end
end
end
hl = setmetatable({
config = function(tbl) merge("", tbl) end,
}, {
__index = function() return function() end end,
})
dofile(os.getenv("OMARCHY_PATH") .. "/default/hypr/looknfeel.lua")
print("render.direct_scanout=" .. tostring(merged["render.direct_scanout"]))
print("general.allow_tearing=" .. tostring(merged["general.allow_tearing"]))
LUA
)
grep -Fxq 'render.direct_scanout=2' <<<"$settings" ||
fail "default looknfeel sets render.direct_scanout to 2" "$settings"
pass "default looknfeel sets render.direct_scanout to 2"
grep -Fxq 'general.allow_tearing=false' <<<"$settings" ||
fail "default looknfeel keeps general.allow_tearing off" "$settings"
pass "default looknfeel keeps general.allow_tearing off"
TEST
check() { # label sed-args...
local label=$1
shift
rm -rf "$work/repo"
mkdir "$work/repo"
cp -R test default "$work/repo/"
chmod -R u+w "$work/repo"
[[ $# -gt 0 ]] && sed -i "$@" "$work/repo/default/hypr/looknfeel.lua"
cp "$work/hyprland-direct-scanout-test.sh" "$work/repo/test/shell.d/"
echo "=== $label"
diff default/hypr/looknfeel.lua "$work/repo/default/hypr/looknfeel.lua"
echo "--- PR test (hypr-direct-scanout-test.sh)"
(cd "$work/repo" && bash test/shell.d/hypr-direct-scanout-test.sh 2>&1)
echo "exit=$?"
echo "--- Lua-evaluating test (hyprland-direct-scanout-test.sh)"
(cd "$work/repo" && bash test/shell.d/hyprland-direct-scanout-test.sh 2>&1)
echo "exit=$?"
if command -v Hyprland >/dev/null; then
echo "--- Hyprland --verify-config"
printf 'dofile("%s/repo/default/hypr/looknfeel.lua")\n' "$work" >"$work/check.lua"
Hyprland --verify-config -c "$work/check.lua" 2>&1 | sed -n '/Config parsing result/,$p' | sed "s|$work|<tmp>|g" | grep -v '^$'
fi
}
check "PR head, unchanged"
check "direct_scanout line commented out" 's/^ direct_scanout = 2,$/ -- direct_scanout = 2,/'
check "direct_scanout moved under general" -e '/^ render = {$/,/^ },$/d' -e 's/^ allow_tearing = false,$/&\n direct_scanout = 2,/'Output (Hyprland 0.56.2, Lua 5.5.1): Details
Review informationTest scope: Source and sandbox runs on Hyprland 0.56.2 at AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check. Opt out: To stop receiving these reviews, reply to this comment saying so. |
|
Thanks for this. Closing because the default is going the other way: |
Summary
Sets Hyprland
render.direct_scanout = 2, allowing automatic direct-scanout attempts for fullscreen content identified as games. Experimental asynchronous tearing remains disabled.Why
Direct scanout can avoid an unnecessary compositor copy when a compatible fullscreen game is the only visible surface. Mode
2is the conservative automatic setting: Hyprland limits attempts to game content and falls back to normal composition when scanout is unavailable.CachyOS ships the same
direct_scanout = 2Hyprland default:Hyprland documents the setting and recommends disabling it on systems where fullscreen applications show graphical glitches:
Changes
default/hypr/looknfeel.lua: configurerender.direct_scanout = 2while retaininggeneral.allow_tearing = false.test/shell.d/hypr-direct-scanout-test.sh: verify automatic direct scanout is configured without enabling experimental tearing.Verification
bash test/shell.d/hypr-direct-scanout-test.shpasses../test/shellreaches and passes the new coverage. The full run has seven pre-existing environment-dependent failures (including unavailableomarchy-pkgs,/var/tmpownership assumptions, and missing Wayland runtime coverage).hyprctl getoption render:direct_scanoutreportsint: 2; normal windowed applications remain composited.