mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
fix(session): default eligible Steam interfaces to GPU compositing (#2660)
This commit is contained in:
1 parent
81e238b92e
commit
3d0c38c1d3
3 files changed
+64
-2
No files matched your search
@@ -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 =
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
@@ -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"])
|
||||
|
||||
Reference in new issue
Block a user