From 3d0c38c1d3462785c3ab1bae5970b2688ee381f6 Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Sun, 15 Nov 2026 21:10:37 -0500 Subject: [PATCH] fix(session): default eligible Steam interfaces to GPU compositing (#2660) --- .../launcher/session/SessionPrefs.kt | 2 +- .../session/SteamGpuCompositingTest.kt | 44 +++++++++++++++++++ tools/tests/test_steam_presentation.py | 20 ++++++++- 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 app/src/test/java/com/droiddeck/launcher/session/SteamGpuCompositingTest.kt diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt index aae250583a..9bd15695c9 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt @@ -946,7 +946,7 @@ object SessionPrefs { prefs(context).edit().putBoolean("steamGpuCompositing", false).apply() return false } - return prefs(context).getBoolean("steamGpuCompositing", false) + return prefs(context).getBoolean("steamGpuCompositing", true) } fun steamGpuCompositingAllowed(): Boolean = diff --git a/app/src/test/java/com/droiddeck/launcher/session/SteamGpuCompositingTest.kt b/app/src/test/java/com/droiddeck/launcher/session/SteamGpuCompositingTest.kt new file mode 100644 index 0000000000..f43bb8d1c2 --- /dev/null +++ b/app/src/test/java/com/droiddeck/launcher/session/SteamGpuCompositingTest.kt @@ -0,0 +1,44 @@ +package com.droiddeck.launcher.session + +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment +import org.robolectric.annotation.Config + +@RunWith(RobolectricTestRunner::class) +@Config(sdk = [34], application = android.app.Application::class) +class SteamGpuCompositingTest { + private val context get() = RuntimeEnvironment.getApplication() + + @Before fun clear() { + context.getSharedPreferences("session", 0).edit().clear().commit() + assertTrue(SessionPrefs.steamGpuCompositingAllowed()) + } + + @Test fun eligibleRendererUsesGpuCompositingByDefault() { + assertTrue(SessionPrefs.steamGpuCompositing(context)) + } + + @Test fun savedSoftwareChoiceIsPreserved() { + context.getSharedPreferences("session", 0).edit() + .putBoolean("steamGpuCompositing", false).commit() + assertFalse(SessionPrefs.steamGpuCompositing(context)) + } + + @Test fun savedGpuChoiceIsPreserved() { + context.getSharedPreferences("session", 0).edit() + .putBoolean("steamGpuCompositing", true).commit() + assertTrue(SessionPrefs.steamGpuCompositing(context)) + } + + @Test fun preferenceCanStillBeToggled() { + SessionPrefs.setSteamGpuCompositing(context, false) + assertFalse(SessionPrefs.steamGpuCompositing(context)) + SessionPrefs.setSteamGpuCompositing(context, true) + assertTrue(SessionPrefs.steamGpuCompositing(context)) + } +} diff --git a/tools/tests/test_steam_presentation.py b/tools/tests/test_steam_presentation.py index fc1b6fec35..476b90779c 100644 --- a/tools/tests/test_steam_presentation.py +++ b/tools/tests/test_steam_presentation.py @@ -21,7 +21,7 @@ class SteamPresentationTest(unittest.TestCase): + 'steam_client=("$steam_root/steamrtarm64/steam")\n' + source[command:command_end]) env = dict(os.environ) - for key in ("BL_STEAM_GL_PRESENT", "DISABLE_GAMESCOPE_WSI", "LIBGL_KOPPER_DISABLE"): + for key in ("BL_STEAM_GL_PRESENT", "BL_STEAM_SOFT_COMPOSITING", "DISABLE_GAMESCOPE_WSI", "LIBGL_KOPPER_DISABLE"): env.pop(key, None) if enabled is not None: env["BL_STEAM_GL_PRESENT"] = enabled @@ -63,6 +63,24 @@ class SteamPresentationTest(unittest.TestCase): self.assertEqual(result["kopper"], "true") self.assertEqual(result["args"][-1], "steam://open/main") + def test_explicit_software_compositing_keeps_gpu_raster(self): + result = self.launch(inherited={"BL_STEAM_SOFT_COMPOSITING": "1"}) + self.assertIn("-cef-disable-gpu-compositing", result["args"]) + self.assertIn("-cef-force-gpu", result["args"]) + self.assertIn("-cef-use-angle=vulkan", result["args"]) + self.assertNotIn("-cef-disable-gpu", result["args"]) + + def test_explicit_gpu_compositing_preserves_vulkan(self): + result = self.launch(inherited={"BL_STEAM_SOFT_COMPOSITING": "0"}) + self.assertNotIn("-cef-disable-gpu-compositing", result["args"]) + self.assertIn("-cef-force-gpu", result["args"]) + self.assertIn("-cef-use-angle=vulkan", result["args"]) + + def test_powervr_presentation_keeps_its_software_fallback(self): + result = self.launch("1", {"BL_STEAM_SOFT_COMPOSITING": "0"}) + self.assertIn("-cef-disable-gpu-compositing", result["args"]) + self.assertIn("-cef-use-angle=gl", result["args"]) + def test_disabled_option_preserves_existing_environment(self): result = self.launch("0", {"DISABLE_GAMESCOPE_WSI": "0", "LIBGL_KOPPER_DISABLE": "false"}) self.assertIn("-cef-use-angle=vulkan", result["args"])