mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 21:35:59 +00:00
fix(desktop): Flatpak and Snap apps get the game GPU setting (#2295)
The session's TU_DEBUG=sysmem is meant for the Steam client and Chromium-based apps. Flatpak and Snap apps inherited it, so emulators and other programs installed that way rendered through system memory. droiddeck-game-env now holds the Chromium check next to game_gpu, and a small droiddeck-game-gpu wrapper applies both to any program. The AppImage, Flatpak and Snap launchers use it, so the rule lives in one place.
This commit is contained in:
1 parent
3bb279f635
commit
1760f008ae
9 files changed
+221
-11
No files matched your search
@@ -902,6 +902,46 @@ class GameEnvironmentTest(unittest.TestCase):
|
||||
self.assertEqual(MODULE["apply_config"](env, config, "42")["TU_DEBUG"], "sysmem")
|
||||
self.assertNotIn("TU_DEBUG", MODULE["apply_config"](env, config, "43"))
|
||||
|
||||
def test_a_chromium_app_keeps_the_sessions_turnip_debug(self):
|
||||
gpu = MODULE["game_gpu"]
|
||||
self.assertEqual(gpu({"TU_DEBUG": "sysmem", "DROIDDECK_GAME_TU_DEBUG": "", "KEEP": "1"}, True),
|
||||
{"TU_DEBUG": "sysmem", "KEEP": "1"})
|
||||
self.assertEqual(gpu({"TU_DEBUG": "sysmem", "DROIDDECK_GAME_TU_DEBUG": "nolrz"}, True), {"TU_DEBUG": "sysmem"})
|
||||
self.assertEqual(gpu({"TU_DEBUG": "sysmem"}, True), {"TU_DEBUG": "sysmem"})
|
||||
|
||||
def test_chromium_files_are_found_four_levels_deep_and_no_further(self):
|
||||
chromium = MODULE["chromium_app"]
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp) / "app"
|
||||
(root / "usr/lib/tool").mkdir(parents=True)
|
||||
(root / "usr/lib/tool/libtool.so").write_bytes(b"")
|
||||
self.assertFalse(chromium(str(root)))
|
||||
for name in ("chrome-sandbox", "chrome_100_percent.pak", "v8_context_snapshot.bin"):
|
||||
found = root / "a/b/c" / name
|
||||
found.parent.mkdir(parents=True, exist_ok=True)
|
||||
found.write_bytes(b"")
|
||||
self.assertTrue(chromium(str(root)), name)
|
||||
found.unlink()
|
||||
deep = root / "a/b/c/d/chrome-sandbox"
|
||||
deep.parent.mkdir(parents=True)
|
||||
deep.write_bytes(b"")
|
||||
self.assertFalse(chromium(str(root)))
|
||||
self.assertFalse(chromium(str(Path(tmp) / "missing")))
|
||||
|
||||
def test_chromium_detection_does_not_follow_links_inside_the_app(self):
|
||||
chromium = MODULE["chromium_app"]
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
other = Path(tmp) / "other"
|
||||
other.mkdir()
|
||||
(other / "chrome-sandbox").write_bytes(b"")
|
||||
root = Path(tmp) / "app"
|
||||
root.mkdir()
|
||||
(root / "linked").symlink_to(other, target_is_directory=True)
|
||||
self.assertFalse(chromium(str(root)))
|
||||
link = Path(tmp) / "app-link"
|
||||
link.symlink_to(other, target_is_directory=True)
|
||||
self.assertTrue(chromium(str(link)))
|
||||
|
||||
def test_the_vram_cap_comes_before_the_games_own_dxvk_settings(self):
|
||||
cap = MODULE["vram_cap"]
|
||||
self.assertEqual(cap({"BL_VRAM_MB": "4096"})["DXVK_CONFIG"], "dxgi.maxDeviceMemory = 4096")
|
||||
|
||||
Reference in new issue
Block a user