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 9bd15695c9..e970e27b00 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionPrefs.kt @@ -949,6 +949,9 @@ object SessionPrefs { return prefs(context).getBoolean("steamGpuCompositing", true) } + fun steamGpuCompositingChosen(context: Context): Boolean = + prefs(context).contains("steamGpuCompositing") && steamGpuCompositing(context) + fun steamGpuCompositingAllowed(): Boolean = !com.droiddeck.launcher.core.DeviceSupport.adreno() && !com.droiddeck.launcher.core.DeviceSupport.mali() diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt index 1c34443968..eb4723456d 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt @@ -973,6 +973,7 @@ class SessionService : Service() { val bridge = com.droiddeck.launcher.core.DeviceSupport.vkBridge(this) if (!bridge && !venus && SystemVulkanDriver.usesDefault(linuxDriverId)) { SystemVulkanDriver.addEnvironment(this, guest) + if (SessionPrefs.steamGpuCompositingChosen(this)) guest.add("BL_STEAM_GPU_COMPOSITING=1") } (if (bridge || venus) null else LinuxVulkanDriver.resolveIcdPath(this, linuxDriverId)) ?.let { guest.add(LinuxVulkanDriver.ENV + "=" + it) } diff --git a/app/src/test/java/com/droiddeck/launcher/session/SteamGpuCompositingTest.kt b/app/src/test/java/com/droiddeck/launcher/session/SteamGpuCompositingTest.kt index f43bb8d1c2..868671c4a9 100644 --- a/app/src/test/java/com/droiddeck/launcher/session/SteamGpuCompositingTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/session/SteamGpuCompositingTest.kt @@ -41,4 +41,18 @@ class SteamGpuCompositingTest { SessionPrefs.setSteamGpuCompositing(context, true) assertTrue(SessionPrefs.steamGpuCompositing(context)) } + + @Test fun untouchedPreferenceIsNotAChoice() { + assertFalse(SessionPrefs.steamGpuCompositingChosen(context)) + } + + @Test fun savedGpuChoiceIsAChoice() { + SessionPrefs.setSteamGpuCompositing(context, true) + assertTrue(SessionPrefs.steamGpuCompositingChosen(context)) + } + + @Test fun savedSoftwareChoiceIsNotChosenGpu() { + SessionPrefs.setSteamGpuCompositing(context, false) + assertFalse(SessionPrefs.steamGpuCompositingChosen(context)) + } } diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session index 4d36d446d0..dcbd1964e8 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session @@ -1491,8 +1491,12 @@ case $mode in bl_steam_path="/usr/local/libexec/droiddeck-steam:$PATH" export DISABLE_GAMESCOPE_WSI=1 LIBGL_KOPPER_DISABLE=true bl_steam_angle=gl - bl_steam_presentation=(-cef-disable-gpu-compositing) - echo "== steam: system PowerVR uses OpenGL/DRI3 through Zink with software CEF compositing" + if [ "${BL_STEAM_GPU_COMPOSITING:-0}" = 1 ]; then + echo "== steam: system PowerVR uses OpenGL/DRI3 through Zink with GPU CEF compositing" + else + bl_steam_presentation=(-cef-disable-gpu-compositing) + echo "== steam: system PowerVR uses OpenGL/DRI3 through Zink with software CEF compositing" + fi elif [ "${BL_STEAM_SOFT_COMPOSITING:-}" = 1 ]; then bl_steam_presentation=(-cef-disable-gpu-compositing) echo "== steam: open driver pair - software CEF compositing, GPU raster" diff --git a/tools/tests/test_steam_presentation.py b/tools/tests/test_steam_presentation.py index 476b90779c..a5cf743a68 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", "BL_STEAM_SOFT_COMPOSITING", "DISABLE_GAMESCOPE_WSI", "LIBGL_KOPPER_DISABLE"): + for key in ("BL_STEAM_GL_PRESENT", "BL_STEAM_GPU_COMPOSITING", "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 @@ -81,6 +81,14 @@ class SteamPresentationTest(unittest.TestCase): self.assertIn("-cef-disable-gpu-compositing", result["args"]) self.assertIn("-cef-use-angle=gl", result["args"]) + def test_powervr_presentation_honors_chosen_gpu_compositing(self): + result = self.launch("1", {"BL_STEAM_GPU_COMPOSITING": "1"}) + self.assertNotIn("-cef-disable-gpu-compositing", result["args"]) + self.assertIn("-cef-force-gpu", result["args"]) + self.assertIn("-cef-use-angle=gl", result["args"]) + self.assertEqual(result["disable"], "1") + self.assertEqual(result["kopper"], "true") + 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"])