Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
adbd117437 | ||
|
|
bf76c6ab50 | ||
|
|
e0e41be40a | ||
|
|
469b354640 | ||
|
|
e6bf86f5b2 | ||
|
|
1d6959a9ec | ||
|
|
babcc271b7 | ||
|
|
46518cf21d |
No files matched your search
@@ -130,6 +130,7 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
}
|
||||
|
||||
var restartBlocked: () -> Boolean = { SessionState.running }
|
||||
var onRouteChanged: () -> Unit = {}
|
||||
|
||||
fun loadTpUbwcMode() {
|
||||
tpUbwcMode = SessionPrefs.tpUbwcMode(activity)
|
||||
@@ -185,6 +186,7 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
runtimePending = sessionRunning && SessionState.runtimeDriver.let { it != null && it != linuxSelected }
|
||||
refreshReleaseRows()
|
||||
refreshPairs()
|
||||
onRouteChanged()
|
||||
}
|
||||
|
||||
fun summary(): String {
|
||||
|
||||
@@ -1199,6 +1199,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
drivers.restartBlocked = ::runtimeChangesBlocked
|
||||
drivers.onRouteChanged = { ui.post { refreshSteamGpuDrawing() } }
|
||||
drivers.loadTpUbwcMode()
|
||||
pendingSessionLogExport = savedInstanceState?.getString(KEY_PENDING_SESSION_LOG_EXPORT)?.let(::File)
|
||||
homeChoiceOpen = savedInstanceState?.getBoolean(STATE_HOME_CHOICE_OPEN) == true
|
||||
@@ -1456,15 +1457,20 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
onRuntime = { onRuntimeButton() },
|
||||
onVkBridge = { on ->
|
||||
SessionPrefs.setVkBridge(this, on); SessionPrefs.setMaliFallbackByAuto(this, ""); vkBridge = on
|
||||
refreshSteamGpuDrawing()
|
||||
if (!on) com.droiddeck.launcher.session.ComponentsManager.settleAutoDxvk(this)
|
||||
},
|
||||
onVenus = { on ->
|
||||
SessionPrefs.setVenus(this, on)
|
||||
SessionPrefs.setMaliFallbackByAuto(this, "")
|
||||
venus = on
|
||||
refreshSteamGpuDrawing()
|
||||
if (on && !com.droiddeck.launcher.core.DeviceSupport.adreno()) Thread({
|
||||
com.droiddeck.launcher.gpu.VulkanInfo.query()["api"]?.let { SessionPrefs.setHostVulkanApi(this, it) }
|
||||
runOnUiThread { venusHostVulkan = com.droiddeck.launcher.session.VenusComponent.hostVulkanTooOld(this) }
|
||||
runOnUiThread {
|
||||
venusHostVulkan = com.droiddeck.launcher.session.VenusComponent.hostVulkanTooOld(this)
|
||||
refreshSteamGpuDrawing()
|
||||
}
|
||||
}, "venus-host-vulkan").start()
|
||||
},
|
||||
onVkBridgeSafe = { on -> SessionPrefs.setVkBridgeSafe(this, on); vkBridgeSafe = on },
|
||||
@@ -1526,8 +1532,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
gameDebugLogsNeedsRestart = gameDebugLogsNeedsRestart()
|
||||
},
|
||||
onSteamGpuDrawing = {
|
||||
SessionPrefs.setSteamGpuCompositing(this, !SessionPrefs.steamGpuCompositing(this))
|
||||
steamGpuDrawing = SessionPrefs.steamGpuCompositing(this)
|
||||
SessionPrefs.setSteamGpuCompositing(this, !SessionPrefs.steamGpuDrawingShown(this))
|
||||
refreshSteamGpuDrawing()
|
||||
},
|
||||
onGraphicsLogs = {
|
||||
SessionPrefs.setDetailedGraphicsLogs(this, !SessionPrefs.detailedGraphicsLogs(this))
|
||||
@@ -3067,6 +3073,10 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun refreshSteamGpuDrawing() {
|
||||
steamGpuDrawing = SessionPrefs.steamGpuDrawingShown(this)
|
||||
}
|
||||
|
||||
private fun refresh() {
|
||||
val listX64 = SessionPrefs.activeSteamClientArch(this) == "x86_64"
|
||||
if (listX64 != steamGamesX64) {
|
||||
@@ -3098,7 +3108,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
agentCommands = com.droiddeck.launcher.agent.AgentAccess.commandsEnabled(this)
|
||||
graphicsLogs = SessionPrefs.detailedGraphicsLogs(this)
|
||||
buildWatermark = SessionPrefs.buildWatermarkEnabled(this)
|
||||
steamGpuDrawing = SessionPrefs.steamGpuCompositing(this)
|
||||
refreshSteamGpuDrawing()
|
||||
bridgeFellBack = SessionPrefs.bridgeFellBack(this)
|
||||
bridgeFellBackMemory = SessionPrefs.bridgeFellBackForMemory(this)
|
||||
clearCachedApps = SessionPrefs.clearCachedApps(this)
|
||||
|
||||
@@ -949,6 +949,16 @@ object SessionPrefs {
|
||||
return prefs(context).getBoolean("steamGpuCompositing", true)
|
||||
}
|
||||
|
||||
fun steamGpuDrawingShown(context: Context, systemDriverPath: Boolean = systemDriverSteamPath(context)): Boolean =
|
||||
steamGpuCompositing(context) && (!systemDriverPath || prefs(context).contains("steamGpuCompositing"))
|
||||
|
||||
fun steamGpuCompositingChosen(context: Context, mode: String): Boolean =
|
||||
mode == SessionService.MODE_STEAM && steamGpuDrawingShown(context, true)
|
||||
|
||||
fun systemDriverSteamPath(context: Context): Boolean =
|
||||
!com.droiddeck.launcher.core.DeviceSupport.vkBridge(context) && !VenusComponent.wanted(context) &&
|
||||
com.droiddeck.launcher.gpu.SystemVulkanDriver.usesDefault(linuxDriver(context))
|
||||
|
||||
fun steamGpuCompositingAllowed(): Boolean =
|
||||
!com.droiddeck.launcher.core.DeviceSupport.adreno() && !com.droiddeck.launcher.core.DeviceSupport.mali()
|
||||
|
||||
|
||||
@@ -971,8 +971,9 @@ class SessionService : Service() {
|
||||
linuxDriverId,
|
||||
)
|
||||
val bridge = com.droiddeck.launcher.core.DeviceSupport.vkBridge(this)
|
||||
if (!bridge && !venus && SystemVulkanDriver.usesDefault(linuxDriverId)) {
|
||||
if (SessionPrefs.systemDriverSteamPath(this)) {
|
||||
SystemVulkanDriver.addEnvironment(this, guest)
|
||||
if (SessionPrefs.steamGpuCompositingChosen(this, SessionState.mode)) guest.add("BL_STEAM_GPU_COMPOSITING=1")
|
||||
}
|
||||
(if (bridge || venus) null else LinuxVulkanDriver.resolveIcdPath(this, linuxDriverId))
|
||||
?.let { guest.add(LinuxVulkanDriver.ENV + "=" + it) }
|
||||
|
||||
@@ -117,4 +117,52 @@ class DriverMenusAutoTest {
|
||||
menus.refreshDrivers()
|
||||
assertTrue(menus.tpUbwcRestartRequired())
|
||||
}
|
||||
|
||||
private fun menusRecordingRouteChanges(activity: Activity, seen: MutableList<String>) =
|
||||
DriverMenus(activity, Handler(Looper.getMainLooper())).also {
|
||||
it.onRouteChanged = { seen += SessionPrefs.linuxDriver(activity) + "|" + SessionPrefs.androidDriver(activity) }
|
||||
}
|
||||
|
||||
@Test fun selectingALinuxDriverReportsTheRouteAfterItIsSaved() {
|
||||
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
|
||||
SessionPrefs.setGpuDriverMode(activity, SessionPrefs.GPU_DRIVERS_MIX)
|
||||
val seen = mutableListOf<String>()
|
||||
menusRecordingRouteChanges(activity, seen).selectDriver("chosen-linux", linux = true)
|
||||
assertEquals("chosen-linux", seen.last().substringBefore("|"))
|
||||
}
|
||||
|
||||
@Test fun selectingTheSystemRuntimeReportsTheRouteAfterItIsSaved() {
|
||||
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
|
||||
SessionPrefs.setGpuDriverMode(activity, SessionPrefs.GPU_DRIVERS_MIX)
|
||||
SessionPrefs.setLinuxDriver(activity, "chosen-linux")
|
||||
val seen = mutableListOf<String>()
|
||||
menusRecordingRouteChanges(activity, seen).selectDriver("", linux = true)
|
||||
assertEquals("", seen.last().substringBefore("|"))
|
||||
}
|
||||
|
||||
@Test fun selectingADisplayDriverReportsTheRouteAfterItIsSaved() {
|
||||
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
|
||||
SessionPrefs.setGpuDriverMode(activity, SessionPrefs.GPU_DRIVERS_MIX)
|
||||
val seen = mutableListOf<String>()
|
||||
menusRecordingRouteChanges(activity, seen).selectDriver("chosen-display", linux = false)
|
||||
assertEquals("chosen-display", seen.last().substringAfter("|"))
|
||||
}
|
||||
|
||||
@Test fun pickingTheAutoDisplayReportsTheRouteAfterAutoOwnsIt() {
|
||||
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
|
||||
SessionPrefs.setGpuDriverMode(activity, SessionPrefs.GPU_DRIVERS_MIX)
|
||||
SessionPrefs.setLinuxDriver(activity, "chosen-linux")
|
||||
val seen = mutableListOf<String>()
|
||||
menusRecordingRouteChanges(activity, seen).selectDriver(TurnipDriver.AUTO, linux = false)
|
||||
assertEquals("|${QuestExperimental.DRIVER}", seen.last())
|
||||
}
|
||||
|
||||
@Test fun turningAutoOnReportsTheRouteAutoChose() {
|
||||
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
|
||||
SessionPrefs.setGpuDriverMode(activity, SessionPrefs.GPU_DRIVERS_MANUAL)
|
||||
SessionPrefs.setLinuxDriver(activity, "chosen-linux")
|
||||
val seen = mutableListOf<String>()
|
||||
menusRecordingRouteChanges(activity, seen).setMode(true)
|
||||
assertEquals("|${QuestExperimental.DRIVER}", seen.last())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.droiddeck.launcher.gpu
|
||||
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
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 SteamGpuDrawingRouteTest {
|
||||
private val context get() = RuntimeEnvironment.getApplication()
|
||||
|
||||
@Before fun clear() {
|
||||
context.getSharedPreferences("session", 0).edit().clear().commit()
|
||||
}
|
||||
|
||||
@Test fun selectingTheSystemDriverFlipsTheUntouchedRowToSoftware() {
|
||||
assertFalse(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(true, "")))
|
||||
}
|
||||
|
||||
@Test fun selectingAnOpenDriverFlipsTheUntouchedRowToGpu() {
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(true, "custom-driver")))
|
||||
}
|
||||
|
||||
@Test fun otherGpusKeepTheGpuRowWhateverDriverIsSelected() {
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(false, "")))
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(false, "custom-driver")))
|
||||
}
|
||||
|
||||
@Test fun savedChoiceSurvivesDriverRouteChanges() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, false)
|
||||
assertFalse(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(true, "")))
|
||||
assertFalse(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(true, "custom-driver")))
|
||||
SessionPrefs.setSteamGpuCompositing(context, true)
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(true, "")))
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(true, "custom-driver")))
|
||||
}
|
||||
}
|
||||
@@ -41,4 +41,57 @@ class SteamGpuCompositingTest {
|
||||
SessionPrefs.setSteamGpuCompositing(context, true)
|
||||
assertTrue(SessionPrefs.steamGpuCompositing(context))
|
||||
}
|
||||
|
||||
@Test fun untouchedPreferenceIsNotAChoice() {
|
||||
assertFalse(SessionPrefs.steamGpuCompositingChosen(context, SessionService.MODE_STEAM))
|
||||
}
|
||||
|
||||
@Test fun savedGpuChoiceIsAChoice() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, true)
|
||||
assertTrue(SessionPrefs.steamGpuCompositingChosen(context, SessionService.MODE_STEAM))
|
||||
}
|
||||
|
||||
@Test fun savedSoftwareChoiceIsNotChosenGpu() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, false)
|
||||
assertFalse(SessionPrefs.steamGpuCompositingChosen(context, SessionService.MODE_STEAM))
|
||||
}
|
||||
|
||||
@Test fun desktopSessionNeverReceivesChosenGpuCompositing() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, true)
|
||||
assertFalse(SessionPrefs.steamGpuCompositingChosen(context, SessionService.MODE_DESKTOP))
|
||||
}
|
||||
|
||||
@Test fun runSessionNeverReceivesChosenGpuCompositing() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, true)
|
||||
assertFalse(SessionPrefs.steamGpuCompositingChosen(context, SessionService.MODE_RUN))
|
||||
}
|
||||
|
||||
@Test fun untouchedPreferenceShowsSoftwareOnSystemDriverPath() {
|
||||
assertFalse(SessionPrefs.steamGpuDrawingShown(context, true))
|
||||
}
|
||||
|
||||
@Test fun untouchedPreferenceShowsGpuOnOpenDriverPath() {
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, false))
|
||||
}
|
||||
|
||||
@Test fun savedGpuChoiceIsShownOnBothPaths() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, true)
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, true))
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, false))
|
||||
}
|
||||
|
||||
@Test fun savedSoftwareChoiceIsShownOnBothPaths() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, false)
|
||||
assertFalse(SessionPrefs.steamGpuDrawingShown(context, true))
|
||||
assertFalse(SessionPrefs.steamGpuDrawingShown(context, false))
|
||||
}
|
||||
|
||||
@Test fun firstToggleFromUntouchedSystemDriverRowSavesGpu() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, !SessionPrefs.steamGpuDrawingShown(context, true))
|
||||
assertTrue(SessionPrefs.steamGpuCompositingChosen(context, SessionService.MODE_STEAM))
|
||||
}
|
||||
|
||||
@Test fun systemDriverPathIsOffOnDevicesWithoutThePowerVrDriver() {
|
||||
assertFalse(SessionPrefs.systemDriverSteamPath(context))
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
|
||||
@@ -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"])
|
||||
|
||||
Reference in new issue
Block a user