Detailed graphics logs for non-Adreno test reports

- graphics-report.txt in every session folder: the graphics path the session draws with and why
  (Turnip, system Vulkan #570, Mali bridge #517, or an open driver pair with its release), the
  driver mode and choices, what Auto would pick, the GPU (family, Vulkan device name, kbase
  gpuinfo, Android, SoC, kernel), the GPU nodes the app can see (access, device numbers, SELinux
  label; nothing is opened) and the guest's graphics environment. At the end it adds the
  compositor's driver lines from app.log and the game launches that were logged.
- vulkan-summary.txt: the session's own vulkaninfo --summary with the driver as exported, in the
  background with a 10 s timeout.
- Per-game logs under games/<time>-<appid>/: Proton's log, DXVK's and vkd3d-proton's, Mesa's and
  PanVK's startup messages and the launch environment, from droiddeck-game-env. Each file is cut
  to 20 MB and the folder to 120 MB at the session's end.
- The per-game logs and the Vulkan summary are on for a GPU that is not an Adreno, and on an
  Adreno only with Setup's new "Detailed graphics logs" switch. Share logs already takes the
  whole session folder, so all of it is in the zip, scrubbed as before.
This commit is contained in:
The412Banner committed 2026-10-12 19:55:18 -04:00
1 parent 797840be7e
commit da45bbc7cf
11 files changed
+321 -1

No files matched your search

@@ -353,6 +353,48 @@ def system_graphics_launch(command, env):
return [str(wrapper), *command], result
def game_logs(command, env, app_id, now=None):
"""Detailed graphics logs for one game launch, in the session's log folder: Proton's own log,
DXVK's and vkd3d-proton's, and the Vulkan driver's startup messages. The app turns this on
(BL_GAME_LOGS=1) on a GPU that is not an Adreno, or with Setup's "Detailed graphics logs"."""
if env.get("BL_GAME_LOGS") != "1" or not env.get("BL_DEBUG_DIR") or len(command) < 3 \
or command[1] != "waitforexitandrun":
return env
import time
stamp = time.strftime("%Y%m%d-%H%M%S", time.localtime(now))
name = app_id or re.sub(r"[^A-Za-z0-9._-]+", "_", Path(command[2]).stem)[:40] or "game"
folder = Path(env["BL_DEBUG_DIR"]) / "games" / ("%s-%s" % (stamp, name))
try:
folder.mkdir(parents=True, exist_ok=True)
except OSError as error:
print("droiddeck-game-env: no game log folder (%s)" % error, file=sys.stderr)
return env
result = dict(env)
result.update({
"PROTON_LOG": "1",
"PROTON_LOG_DIR": str(folder),
"DXVK_LOG_PATH": str(folder),
"DXVK_LOG_LEVEL": env.get("DXVK_LOG_LEVEL", "info"),
"VKD3D_LOG_FILE": str(folder / "vkd3d.log"),
"VKD3D_DEBUG": env.get("VKD3D_DEBUG", "warn"),
"VKD3D_SHADER_DEBUG": env.get("VKD3D_SHADER_DEBUG", "none"),
"MESA_LOG_FILE": str(folder / "mesa.log"),
"MESA_DEBUG": env.get("MESA_DEBUG", "silent"),
"PANVK_DEBUG": env.get("PANVK_DEBUG", "startup"),
})
try:
(folder / "launch.txt").write_text("\n".join([
"app: %s" % (app_id or "-"),
"exe: %s" % command[2],
"proton: %s" % command[0],
"started: %s" % time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(now)),
] + ["%s=%s" % (key, env[key]) for key in sorted(env)
if key.startswith(("VK_", "BL_VK", "BL_DRM", "MESA_", "PANVK", "DXVK_", "VKD3D", "ZINK", "TU_"))]) + "\n")
except OSError:
pass
return result
def exec_proton(command, env):
# Synchronization selection has already picked the actual Proton executable.
command, env = system_graphics_launch(command, env)
@@ -392,6 +434,7 @@ def main():
env = apply_config(env, {"version": 1}, app_id, fixes)
except (OSError, ValueError, TypeError, AttributeError):
print("droiddeck-game-env: invalid configuration; using inherited environment", file=sys.stderr)
env = game_logs(command, env, app_id)
env = force_ssbs(command, env)
command, env = start_without_steam(command, env, app_id)
sync = load_sync()
@@ -163,6 +163,23 @@ if [ "${BL_VKBRIDGE:-0}" = 1 ]; then
fi
unset bl_vkb_icd
fi
# Detailed graphics logs (BL_GAME_LOGS=1: a GPU that is not an Adreno, or Setup's switch): the
# session's own view of Vulkan, with the driver exactly as exported above, once per session. In the
# background with a timeout, so a driver that hangs here never holds the session up.
if [ "${BL_GAME_LOGS:-0}" = 1 ] && [ -z "${BL_INSIDE:-}" ] && [ -n "${BL_DEBUG_DIR:-}" ]; then
(
{
echo "== VK_DRIVER_FILES=${VK_DRIVER_FILES:-} VK_ICD_FILENAMES=${VK_ICD_FILENAMES:-} BL_DRM_STANDIN=${BL_DRM_STANDIN:-}"
if command -v vulkaninfo >/dev/null 2>&1; then
timeout 10 vulkaninfo --summary
echo "== vulkaninfo exit: $?"
else
echo "== vulkaninfo is not in this runtime; GPU nodes:"
ls -l /dev/kgsl-3d0 /dev/mali0 /dev/dri 2>&1
fi
} > "$BL_DEBUG_DIR/vulkan-summary.txt" 2>&1
) &
fi
# The app's gamescope build (tools/gamescope) asks for realtime-priority Vulkan queues on this
# switch instead of on CAP_SYS_NICE, which proot never has; it falls back to normal priority
# where the driver refuses, and the runtime's own build ignores it. On KGSL Turnip (Mesa 26.2) it
+20
View File
@@ -373,6 +373,26 @@ class GameEnvironmentTest(unittest.TestCase):
with self.assertRaises(ValueError):
MODULE["apply_config"]({}, {**config, "dxvkConfigGames": []}, "42")
def test_game_logs_only_when_asked_and_only_for_game_launches(self):
game_logs = MODULE["game_logs"]
with tempfile.TemporaryDirectory() as tmp:
command = ["/proton", "waitforexitandrun", "/games/Hades/Hades.exe"]
env = {"BL_DEBUG_DIR": tmp, "VK_DRIVER_FILES": "/icd.json"}
self.assertEqual(game_logs(command, env, "1145360", now=0), env)
on = dict(env, BL_GAME_LOGS="1")
self.assertEqual(game_logs(["/proton", "run", "x.exe"], on, "1145360", now=0), on)
result = game_logs(command, on, "1145360", now=0)
folder = Path(result["PROTON_LOG_DIR"])
self.assertEqual(folder.parent, Path(tmp) / "games")
self.assertTrue(folder.name.endswith("-1145360"))
self.assertEqual(result["DXVK_LOG_PATH"], str(folder))
self.assertEqual(result["PROTON_LOG"], "1")
launch = (folder / "launch.txt").read_text()
self.assertIn("VK_DRIVER_FILES=/icd.json", launch)
self.assertNotIn("PROTON_LOG", env)
named = game_logs(command, on, None, now=0)
self.assertTrue(Path(named["PROTON_LOG_DIR"]).name.endswith("-Hades"))
def test_game_ids_and_probes(self):
for prefix in ("", "/compatdata/0", "/compatdata/0-123", "/compatdata/nope", "/compatdata/4294967296"):
self.assertIsNone(MODULE["game_id"]({"STEAM_COMPAT_DATA_PATH": prefix}))