mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
fix(session): games keep OpenGL error checks when the client skips them (#2562)
* fix(session): games keep OpenGL error checks when the client skips them * docs(session): separate the GL error checks note from the picker paragraph
This commit is contained in:
1 parent
f6d1794624
commit
30d103280b
5 files changed
+51
-12
No files matched your search
@@ -997,7 +997,9 @@ class SessionService : Service() {
|
||||
SessionPrefs.vramCapMb(this).takeIf { it > 0 }?.let { guest.add("BL_VRAM_MB=$it") }
|
||||
guest.add("AUDIO_DIRECT_DECAY=0")
|
||||
val extra = extraEnv() + agentEnvironment
|
||||
if (extra.none { it.startsWith("TU_DEBUG=") }) guest.add("$GAME_TU_DEBUG=" + (tuOverride ?: if (tuDriver) "sysmem" else ""))
|
||||
mapOf("TU_DEBUG" to (tuOverride ?: if (tuDriver) "sysmem" else ""), "MESA_NO_ERROR" to "").forEach { (name, game) ->
|
||||
if (extra.none { it.startsWith("$name=") }) guest.add("$GAME_PREFIX$name=$game")
|
||||
}
|
||||
extra.forEach { guest.add(it) }
|
||||
com.droiddeck.launcher.gpu.TpUbwcHint.forThisDevice(this)?.let { guest.add("${com.droiddeck.launcher.gpu.TpUbwcHint.ENV}=$it") }
|
||||
val clientPinned = steamHere && SessionPrefs.clientCpusOverride(this)
|
||||
@@ -2377,7 +2379,7 @@ class SessionService : Service() {
|
||||
private const val TRACER_NICE = -6
|
||||
private const val MIC_RELEASE_TIMEOUT_MS = 5_000L
|
||||
private const val TU_DEBUG_SWITCH = "Download/droiddeck-tu-debug"
|
||||
private const val GAME_TU_DEBUG = "DROIDDECK_GAME_TU_DEBUG"
|
||||
private const val GAME_PREFIX = "DROIDDECK_GAME_"
|
||||
private const val LEGACY_ENV_SWITCH = "Download/droiddeck-env"
|
||||
private const val ENV_SWITCH_NAME = "droiddeck-env"
|
||||
|
||||
|
||||
@@ -254,6 +254,14 @@ The former feature-level rules for Caravan SandWitch, RoboCop: Rogue City,
|
||||
ReSkate and Cyberpunk 2077 compensated for the global `12_2` override and are
|
||||
removed. Stellar Blade also uses automatic detection. The separate Deep Rock
|
||||
Galactic GDK ray-tracing opt-out and Mali bridge capability cap remain.
|
||||
|
||||
"Skip GL error checks" (under "Client interface") sets `MESA_NO_ERROR=1` for the client
|
||||
interface and Chromium apps only. Games keep Mesa's GL error checks: with
|
||||
`MESA_NO_ERROR`, an invalid call such as `glBufferData` with no buffer bound reads
|
||||
a NULL buffer object instead of returning `GL_INVALID_OPERATION`, and the game's
|
||||
render thread stops. A game profile entry, or `MESA_NO_ERROR` in the session's own
|
||||
environment, still applies to games.
|
||||
|
||||
Other picker suggestions are editable starting values and are enabled only when
|
||||
added and saved. Older or
|
||||
custom components can support a different set of options. Android Wine wrapper,
|
||||
|
||||
@@ -10,7 +10,8 @@ import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
GAME_TU_DEBUG = "DROIDDECK_GAME_TU_DEBUG"
|
||||
GAME_PREFIX = "DROIDDECK_GAME_"
|
||||
GAME_SPLIT_KEYS = ("TU_DEBUG", "MESA_NO_ERROR")
|
||||
CHROMIUM_FILES = {"chrome-sandbox", "chrome_100_percent.pak", "v8_context_snapshot.bin"}
|
||||
D3D9_DEFAULT_MEMORY_MB = 4096
|
||||
SYNC_KEYS = ("BL_SYNC", "BL_SYNC_FALLBACK", "BL_FSYNC_FIRST", "BL_SYNC_MIN_NOFILE", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "PROTON_NO_NTSYNC", "WINEESYNC")
|
||||
@@ -385,16 +386,19 @@ def chromium_app(folder):
|
||||
|
||||
|
||||
def game_gpu(env, keep=False):
|
||||
if GAME_TU_DEBUG not in env:
|
||||
if not any(GAME_PREFIX + key in env for key in GAME_SPLIT_KEYS):
|
||||
return env
|
||||
result = env.copy()
|
||||
value = result.pop(GAME_TU_DEBUG)
|
||||
if keep:
|
||||
return result
|
||||
if value:
|
||||
result["TU_DEBUG"] = value
|
||||
else:
|
||||
result.pop("TU_DEBUG", None)
|
||||
for key in GAME_SPLIT_KEYS:
|
||||
if GAME_PREFIX + key not in result:
|
||||
continue
|
||||
value = result.pop(GAME_PREFIX + key)
|
||||
if keep:
|
||||
continue
|
||||
if value:
|
||||
result[key] = value
|
||||
else:
|
||||
result.pop(key, None)
|
||||
return result
|
||||
|
||||
|
||||
|
||||
@@ -950,6 +950,22 @@ 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_games_run_with_gl_error_checks_unless_the_user_turns_them_off(self):
|
||||
gpu = MODULE["game_gpu"]
|
||||
session = {"MESA_NO_ERROR": "1", "DROIDDECK_GAME_MESA_NO_ERROR": "", "KEEP": "1"}
|
||||
self.assertEqual(gpu(session), {"KEEP": "1"})
|
||||
self.assertEqual(gpu(session, True), {"MESA_NO_ERROR": "1", "KEEP": "1"})
|
||||
self.assertEqual(gpu({"MESA_NO_ERROR": "1"}), {"MESA_NO_ERROR": "1"})
|
||||
self.assertEqual(gpu({"MESA_NO_ERROR": "1", "DROIDDECK_GAME_MESA_NO_ERROR": "1"}), {"MESA_NO_ERROR": "1"})
|
||||
both = gpu({"MESA_NO_ERROR": "1", "DROIDDECK_GAME_MESA_NO_ERROR": "", "TU_DEBUG": "sysmem", "DROIDDECK_GAME_TU_DEBUG": "nolrz"})
|
||||
self.assertEqual(both, {"TU_DEBUG": "nolrz"})
|
||||
self.assertEqual(gpu({"TU_DEBUG": "sysmem", "DROIDDECK_GAME_TU_DEBUG": "", "MESA_NO_ERROR": "1"}),
|
||||
{"MESA_NO_ERROR": "1"})
|
||||
config = {"version": 1, "games": {"42": {"MESA_NO_ERROR": "1"}}}
|
||||
env = gpu(session)
|
||||
self.assertEqual(MODULE["apply_config"](env, config, "42")["MESA_NO_ERROR"], "1")
|
||||
self.assertNotIn("MESA_NO_ERROR", 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),
|
||||
|
||||
@@ -9,7 +9,7 @@ from pathlib import Path
|
||||
|
||||
BIN = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin"
|
||||
KEYS = ("TU_DEBUG", "DROIDDECK_GAME_TU_DEBUG", "MESA_LOADER_DRIVER_OVERRIDE", "GALLIUM_DRIVER",
|
||||
"LIBGL_KOPPER_DRI2", "VK_ICD_FILENAMES", "VK_DRIVER_FILES")
|
||||
"LIBGL_KOPPER_DRI2", "VK_ICD_FILENAMES", "VK_DRIVER_FILES", "MESA_NO_ERROR", "DROIDDECK_GAME_MESA_NO_ERROR")
|
||||
SESSION = {"TU_DEBUG": "sysmem", "DROIDDECK_GAME_TU_DEBUG": ""}
|
||||
GPU_SESSION = {"MESA_LOADER_DRIVER_OVERRIDE": "zink", "GALLIUM_DRIVER": "zink",
|
||||
"LIBGL_KOPPER_DRI2": "true", "VK_ICD_FILENAMES": "/runtime/turnip.json",
|
||||
@@ -68,6 +68,15 @@ class GameGpuLaunchersTest(unittest.TestCase):
|
||||
self.chromium()
|
||||
self.assertEqual("sysmem", self.wrapper("--for", str(self.app / "files"))["TU_DEBUG"])
|
||||
|
||||
def test_programs_get_gl_error_checks_back_while_chromium_keeps_the_client_setting(self):
|
||||
session = dict(GPU_SESSION, MESA_NO_ERROR="1", DROIDDECK_GAME_MESA_NO_ERROR="")
|
||||
values = self.wrapper(session=session)
|
||||
self.assertEqual(("unset", "unset"), (values["MESA_NO_ERROR"], values["DROIDDECK_GAME_MESA_NO_ERROR"]))
|
||||
self.assertEqual(GPU_SESSION, {key: values[key] for key in GPU_SESSION})
|
||||
self.assertEqual("1", self.wrapper("--chromium", session=session)["MESA_NO_ERROR"])
|
||||
self.assertEqual("unset", self.flatpak(session)["MESA_NO_ERROR"])
|
||||
self.assertEqual("1", self.wrapper(session={"MESA_NO_ERROR": "1"})["MESA_NO_ERROR"])
|
||||
|
||||
def test_without_the_game_setting_the_wrapper_changes_nothing(self):
|
||||
self.assertEqual("sysmem", self.wrapper(session={"TU_DEBUG": "sysmem"})["TU_DEBUG"])
|
||||
self.assertEqual("unset", self.wrapper(session={})["TU_DEBUG"])
|
||||
|
||||
Reference in new issue
Block a user