Non-Adreno: find every driver pair, Venus before the bridge, fix the bridge's begin info

From the logs testers sent since c9ebb247:
- The app read the drivers repo's newest 15 releases only; the component releases (gamescope,
  Venus) pushed every PanVK pair and RADV-Xclipse past them, so Auto found no pair on any Mali
  and switched the Mali bridge on. The non-Adreno repo is now read in one page of 100.
- Auto's stand-in for a missing pair: Mali (Venus) where the apk carries it (Steam runs on it
  from the G57 to the G1-Ultra), the bridge otherwise, nothing on a driver below Vulkan 1.2. It
  no longer clears the Linux driver, does nothing when the list could not be read, records that
  it chose the route, and turns it off again once a pair is installed. A bridge that earlier
  builds left on under Auto is taken as Auto's.
- Mali bridge: vkBeginCommandBuffer sent its begin info without the count the server decodes, so
  Mali got a zeroed begin info with stale flags and crashed at 0x10 (Pixel 8 Pro G715, Lenovo
  G615, Xiaomi G925, Tab S11).
- Mali-G1 series (MT6993, arch v14) known by its chip; its label says Venus, not the bridge.
- A session Android killed for memory is said so on the next start (the S24 FE "crashes" were
  low-memory kills, not driver faults).
- The in-app updater never installs an official (Adreno-only) build over this test build.
This commit is contained in:
The412Banner committed 2026-10-19 09:07:44 +00:00
1 parent 7ad99aba3d
commit f0608bb134
11 files changed
+153 -22

No files matched your search

@@ -258,6 +258,10 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
// A Mali pair set by an earlier build put its PanVK Android half on the display, which fails
// on Mali gralloc. Under Auto the display is the phone's own driver (Android's loader).
if (gpu.family.mali) {
// Builds before 0.5.0-nad1 turned the bridge on under Auto without recording it, and
// left it on for good (it wins over the pair). Under Auto that switch is taken as Auto's.
if (!SessionPrefs.maliFallbackKnown(activity))
SessionPrefs.setMaliFallbackByAuto(activity, if (SessionPrefs.vkBridge(activity)) "bridge" else "")
val display = SessionPrefs.androidDriver(activity)
if (display.isNotEmpty() && DriverPairs.isNonAdreno(DriverBundle.containing(activity, display, false)?.id)) {
SessionPrefs.setAndroidDriver(activity, TurnipDriver.AUTO)
@@ -296,8 +300,8 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
}
Log.i(TAG, "auto: ${gpu.name} (${gpu.family}) -> " + (DriverPairs.recommendedKey(gpu, emptyList()) ?: "no pair"))
if (gpu.family.mali && DriverPairs.recommendedKey(gpu, emptyList()) == null) {
useMaliBridge()
autoStatus = activity.getString(R.string.drivers_mali_bridge_auto)
// No PanVK build covers this Mali (e.g. the G1 series, arch v14): the phone's own driver.
autoStatus = useMaliFallback(null)
refreshDrivers()
return
}
@@ -327,10 +331,13 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
autoStatus = activity.getString(R.string.drivers_powervr_builtin)
refreshDrivers()
}
gpu.family.mali && (pair == null || !pair.complete) &&
(problem != null || TurnipReleases.cached(activity)?.failed?.contains(TurnipReleases.NON_ADRENO_LABEL) == true) ->
// The list could not be read: nothing is known to be missing, so nothing is switched.
autoStatus = activity.getString(R.string.upd_couldnt_check, problem ?: TurnipReleases.NON_ADRENO_LABEL)
gpu.family.mali && (pair == null || !pair.complete) -> {
// No open driver for this Mali published yet: draw through the bridge.
useMaliBridge()
autoStatus = activity.getString(R.string.drivers_mali_bridge_fallback, key?.let { DriverPairs.nonAdrenoName(it) } ?: gpu.name)
// No open driver for this Mali published yet: the phone's own driver until it is.
autoStatus = useMaliFallback(key?.let { DriverPairs.nonAdrenoName(it) } ?: gpu.name)
refreshDrivers()
}
pair == null || !pair.complete ->
@@ -345,12 +352,42 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
}, "gpu-driver-auto").start()
}
private fun useMaliBridge() {
if (DeviceSupport.openDriverActive(activity)) {
SessionPrefs.setAndroidDriver(activity, TurnipDriver.AUTO)
SessionPrefs.setLinuxDriver(activity, "")
/**
* A Mali with no open driver pair to install ([missing] names the unpublished pair, or null when
* no PanVK build covers this GPU) runs through the phone's own driver: Mali (Venus) where this
* apk carries it (Steam runs on it from the G57 to the G1 series), the Mali bridge otherwise.
* Both need Vulkan 1.2 from the phone's driver for gamescope, so with an older one nothing is
* switched on. The Linux driver choice is left alone (it is the bridge's fallback), and Auto
* switches only its own choice off again once a pair is installed ([endMaliFallback]).
*/
private fun useMaliFallback(missing: String?): String {
com.droiddeck.launcher.session.VenusComponent.hostVulkanTooOld(activity)?.let { api ->
Log.i(TAG, "auto: Mali driver reports Vulkan $api; no Venus or bridge for gamescope")
return activity.getString(R.string.drivers_mali_vulkan_too_old, missing ?: gpu.name, api)
}
SessionPrefs.setVkBridge(activity, true)
val venus = com.droiddeck.launcher.session.VenusComponent.available(activity)
if (venus && !SessionPrefs.venus(activity)) {
SessionPrefs.setVenus(activity, true)
SessionPrefs.setMaliFallbackByAuto(activity, "venus")
} else if (!venus && !SessionPrefs.vkBridge(activity)) {
SessionPrefs.setVkBridge(activity, true)
SessionPrefs.setMaliFallbackByAuto(activity, "bridge")
}
val route = activity.getString(if (venus) R.string.drivers_route_venus else R.string.drivers_route_bridge)
Log.i(TAG, "auto: Mali stand-in route $route (missing pair: ${missing ?: "none covers ${gpu.name}"})")
return if (missing == null) activity.getString(R.string.drivers_mali_no_pair_auto, route)
else activity.getString(R.string.drivers_mali_unpublished_auto, missing, route)
}
/** A pair is installed for this Mali: the route Auto switched on in its place goes off again. */
private fun endMaliFallback() {
when (SessionPrefs.maliFallbackByAuto(activity)) {
"venus" -> SessionPrefs.setVenus(activity, false)
"bridge" -> SessionPrefs.setVkBridge(activity, false)
else -> return
}
Log.i(TAG, "auto: pair installed; ${SessionPrefs.maliFallbackByAuto(activity)} (Auto's stand-in) off")
SessionPrefs.setMaliFallbackByAuto(activity, "")
}
fun selectPair(key: String) {
@@ -409,8 +446,10 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
val displayChanged = previousDisplay != displayId
SessionPrefs.setAndroidDriver(activity, displayId)
SessionPrefs.setLinuxDriver(activity, linuxId)
// The Mali bridge switch is the user's and is left as it is: when it is on, the
// bridge wins for the session (DeviceSupport.vkBridge) and the pair waits.
// A route Auto switched on in place of a missing pair goes off now that one is
// here. A Mali bridge or Venus switch the user set stays: it wins for the session
// (DeviceSupport.vkBridge, VenusComponent.wanted) and the pair waits.
if (gpu.family.mali && DriverPairs.isNonAdreno(pair.key)) endMaliFallback()
val restart = displayChanged && CompositorHost.isStarted
if (auto) {
val trial = AutoDriverTrial.current(activity)
@@ -904,9 +904,10 @@ class MainActivity : ComponentActivity() {
onInstallPackage = { id -> installPackage(id) },
onRemovePackage = { id -> removePackage(id) },
onRuntime = { onRuntimeButton() },
onVkBridge = { on -> SessionPrefs.setVkBridge(this, on); vkBridge = on },
onVkBridge = { on -> SessionPrefs.setVkBridge(this, on); SessionPrefs.setMaliFallbackByAuto(this, ""); vkBridge = on },
onVenus = { on ->
SessionPrefs.setVenus(this, on)
SessionPrefs.setMaliFallbackByAuto(this, "")
venus = on
if (on && !com.droiddeck.launcher.core.DeviceSupport.adreno()) Thread({
com.droiddeck.launcher.gpu.VulkanInfo.query()["api"]?.let { SessionPrefs.setHostVulkanApi(this, it) }
@@ -1192,6 +1193,9 @@ class MainActivity : ComponentActivity() {
com.droiddeck.launcher.frontend.GamesFolderMigration.run(this)
SessionLogShare.clear(this)
SessionArtifacts.finishAbandoned(this)
if (SessionPrefs.takeMemoryKillNotice(this)) runOnUiThread {
android.widget.Toast.makeText(this, R.string.session_killed_for_memory, android.widget.Toast.LENGTH_LONG).show()
}
SessionArtifacts.scrubOlder(this)
SessionArtifacts.prune(this)
}, "finish-abandoned").start()
@@ -57,7 +57,7 @@ data class GpuInfo(
Support.UNTESTED -> when (family) {
Family.POWERVR -> if (name.contains("Xclipse", ignoreCase = true)) "Experimental: RADV or the system Xclipse driver"
else "System PowerVR driver: compatibility varies by device"
Family.MALI_OTHER -> "Experimental: Mali through the Vulkan bridge"
Family.MALI_OTHER -> "Experimental: Mali through the phone's own driver (Venus)"
Family.MALI_JM, Family.MALI_G610_G710, Family.MALI_G615, Family.MALI_G720, Family.MALI_LATEST -> "Experimental: open Mali driver (test builds)"
Family.A7XX_LOW -> "Experimental: its drivers are test builds"
else -> "Outside tested hardware (Adreno 650, 725 and newer): it may not run"
@@ -152,7 +152,7 @@ data class GpuInfo(
/** Chips whose Mali is known for certain (MediaTek Dimensity / Helio / Kompanio, Google Tensor). */
private val MALI_SOCS = mapOf(
"mt6991" to "Mali-G925", "mt6989" to "Mali-G720", "mt6899" to "Mali-G720", "mt6985" to "Mali-G715",
"mt6993" to "Mali-G1-Ultra", "mt6991" to "Mali-G925", "mt6989" to "Mali-G720", "mt6899" to "Mali-G720", "mt6985" to "Mali-G715",
"mt6983" to "Mali-G710", "mt6897" to "Mali-G615", "mt6878" to "Mali-G615", "mt6895" to "Mali-G610",
"mt6896" to "Mali-G610", "mt6886" to "Mali-G610", "mt6893" to "Mali-G77", "mt6891" to "Mali-G77",
"mt6889" to "Mali-G77", "mt6885" to "Mali-G77", "mt6877" to "Mali-G68", "mt6853" to "Mali-G57",
@@ -63,7 +63,7 @@ object TurnipReleases {
// <Id>-Pair.zip: open drivers for GPUs that are not Adreno (PanVK for Mali, RADV for
// Xclipse), both halves in one zip. One release per driver, replaced in place on each
// rebuild; every one is a test build, published as a pre-release.
Source("Non-Adreno", NON_ADRENO_REPO, prerelease = true) { name, _ ->
Source(NON_ADRENO_LABEL, NON_ADRENO_REPO, prerelease = true) { name, _ ->
val m = Regex("""^(RADV-Xclipse(?:-[A-Za-z0-9]+)*?|PanVK-[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*?)-Pair\.zip$""").find(name) ?: return@Source null
val key = DriverPairs.nonAdreno(m.groupValues[1])
Kind(false, "Android + Linux · " + DriverPairs.nonAdrenoName(key), key, bundle = true)
@@ -71,6 +71,7 @@ object TurnipReleases {
)
private const val NON_ADRENO_REPO = "The412Banner/droiddeck-nonadreno-drivers"
const val NON_ADRENO_LABEL = "Non-Adreno"
private fun sources(): List<Source> =
if (com.droiddeck.launcher.core.DeviceSupport.adreno()) SOURCES.filter { it.repo != NON_ADRENO_REPO } else SOURCES
@@ -88,7 +89,10 @@ object TurnipReleases {
val sources = sources()
for (src in sources) {
try {
val releases = JSONArray(get(context, "https://api.github.com/repos/${src.repo}/releases?per_page=15"))
// The non-Adreno repo keeps one release per driver plus many component builds (gamescope,
// Venus): its driver pairs fall past the first 15, so it is read in one full page.
val perPage = if (src.repo == NON_ADRENO_REPO) 100 else 15
val releases = JSONArray(get(context, "https://api.github.com/repos/${src.repo}/releases?per_page=$perPage"))
val seen = HashSet<String>()
var newest: String? = null
for (i in 0 until releases.length()) {
@@ -216,13 +216,19 @@ object SessionArtifacts {
Log.i(TAG, "collected ${out.listFiles()?.size ?: 0} Steam log(s), scrubbed, into $out")
}
/**
* Finishes the folders of sessions whose process died without its teardown. Returns true when
* the newest of them ended because Android killed the app for memory, so the app can say so
* (a game "crashing" on a phone with little free RAM is usually this, not a driver fault).
*/
@Synchronized
fun finishAbandoned(context: Context) {
fun finishAbandoned(context: Context): Boolean {
val parent = LinuxRuntime.logDir(context)
val abandoned = parent.listFiles { f ->
SessionPaths.isSessionFolder(f) && !File(f, COMPLETE_MARKER).exists() && !inFlight(f)
}?.sortedWith(SessionPaths.chronological) ?: return
if (abandoned.isEmpty()) return
}?.sortedWith(SessionPaths.chronological) ?: return false
if (abandoned.isEmpty()) return false
var killedForMemory = false
val current = SessionPaths.current()
LogRedactor.learnFromRuntime(LinuxRuntime.rootDir(context))
abandoned.forEachIndexed { i, dir ->
@@ -240,6 +246,7 @@ object SessionArtifacts {
"session died of a crash, the entry is in there unless the device rebooted.\n" +
(if (newest) exitReasons(context) else "")
)
if (newest && lastExitForMemory(context)) killedForMemory = true
val record = Record(dir)
if (newest) {
copySteamLogs(context, dir, record, recordedClient(dir))
@@ -254,6 +261,21 @@ object SessionArtifacts {
Log.w(TAG, "could not finish $dir", e)
}
}
// Whoever finishes the folder first (the agent provider starts before the activity) leaves
// the notice for the launcher to show.
if (killedForMemory) SessionPrefs.setMemoryKillNotice(context, true)
return killedForMemory
}
/** Android's newest record for this app's main process says it was killed for memory. */
private fun lastExitForMemory(context: Context): Boolean {
if (android.os.Build.VERSION.SDK_INT < 30) return false
return runCatching {
val am = context.getSystemService(android.app.ActivityManager::class.java) ?: return false
am.getHistoricalProcessExitReasons(context.packageName, 0, 3)
.firstOrNull { it.processName == context.packageName }
?.reason == android.app.ApplicationExitInfo.REASON_LOW_MEMORY
}.getOrDefault(false)
}
private fun exitReasons(context: Context): String {
@@ -483,6 +483,31 @@ object SessionPrefs {
prefs(context).edit().putBoolean("steamGpuCompositing", on && steamGpuCompositingAllowed()).apply()
}
/**
* The route Auto switched on for a Mali that has no open driver pair yet ("venus" or "bridge"),
* or "" when the user's own Setup switches are in charge. Auto turns only its own choice off
* again once a pair is installed; a Setup switch the user flips clears this.
*/
/** The last session's process was killed by Android for memory; the launcher says so once. */
fun takeMemoryKillNotice(context: Context): Boolean {
val on = prefs(context).getBoolean("memoryKillNotice", false)
if (on) prefs(context).edit().putBoolean("memoryKillNotice", false).apply()
return on
}
fun setMemoryKillNotice(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("memoryKillNotice", on).apply()
}
fun maliFallbackByAuto(context: Context): String = prefs(context).getString("maliFallbackByAuto", "").orEmpty()
/** Whether [maliFallbackByAuto] was ever recorded (builds before it left the bridge on without saying who). */
fun maliFallbackKnown(context: Context): Boolean = prefs(context).contains("maliFallbackByAuto")
fun setMaliFallbackByAuto(context: Context, route: String) {
prefs(context).edit().putString("maliFallbackByAuto", route).apply()
}
fun setVenus(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("venus", on).apply()
}
@@ -74,6 +74,12 @@ object AppUpdates {
val updatable: Boolean,
val committedAt: Long = 0L,
val ciBuild: Boolean = BuildConfig.CI_BUILD,
/**
* A build of the non-Adreno test branch (Mali / Xclipse / PowerVR routes). The official
* channels carry the Adreno-only app: installing one over it drops those routes, so none is
* offered. Its updates are published on The412Banner/droiddeck-nonadreno-drivers.
*/
val nonAdrenoTest: Boolean = false,
)
enum class PreviewHistoryKind { CURRENT, BEHIND, RECENT }
@@ -125,6 +131,7 @@ object AppUpdates {
BuildConfig.VERSION_CODE,
releaseSigned,
BuildConfig.COMMIT_TIME,
nonAdrenoTest = BuildConfig.BUILD_LABEL.contains("non-adreno"),
)
fun release(catalog: Catalog, follow: Follow): Release? = when (follow.channel) {
@@ -191,6 +198,7 @@ object AppUpdates {
}
fun installBlock(r: Release, me: Installed = installed()): InstallBlock? = when {
me.nonAdrenoTest -> InstallBlock(R.string.upd_block_non_adreno_test)
r.apk == null -> InstallBlock(R.string.upd_block_no_apk)
r.apk.versionCode < me.versionCode -> InstallBlock(R.string.upd_block_version_code, r.apk.versionCode, me.versionCode)
else -> null
+7
View File
@@ -1854,6 +1854,13 @@
<string name="gpu_auto_system_hint">Uses the built-in drivers for this GPU</string>
<string name="drivers_powervr_builtin">The system PowerVR driver is selected for the runtime and display.</string>
<string name="drivers_mali_bridge_auto">No open driver covers this Mali yet: the Mali bridge is on.</string>
<string name="upd_block_non_adreno_test">This is the non-Snapdragon test build: the official builds here only run on Adreno, so they are not installed over it. New test builds are on github.com/The412Banner/droiddeck-nonadreno-drivers.</string>
<string name="session_killed_for_memory">The last session ended because Android closed DroidDeck to free memory, not a crash. Close other apps or lower the game\'s texture settings, then try again.</string>
<string name="drivers_route_venus">Mali (Venus)</string>
<string name="drivers_route_bridge">the Mali bridge</string>
<string name="drivers_mali_no_pair_auto">No open driver covers this Mali yet: %1$s is used, on the phone\'s own driver.</string>
<string name="drivers_mali_unpublished_auto">%1$s isn\'t published yet: %2$s is used until it is.</string>
<string name="drivers_mali_vulkan_too_old">%1$s isn\'t available, and this phone\'s driver reports Vulkan %2$s (Venus and the Mali bridge need 1.2). Pick a PanVK pair under Driver pairs.</string>
<string name="drivers_mali_bridge_fallback">%1$s isn\'t published yet: the Mali bridge is on until it is.</string>
<string name="cmgr_powervr_dxvk_queued">Queued: %1$s (waiting for a different runtime driver)</string>
<string name="cmgr_powervr_dxvk_managed">DXVK is provided by the system PowerVR runtime. Other DXVK packages can be stored but are not applied with this driver.</string>
@@ -248,6 +248,13 @@ class DriverPairsTest {
assertTrue(GpuInfo.maliKbaseCovered("Mali-G720 (by chip mt6989)"))
}
@Test
fun theMaliG1SeriesHasNoPanVkPairAndIsKnownByItsChip() {
// Arch v14 (Dimensity 9500): no PanVK build is proven there, so Auto uses the phone's own driver.
assertEquals("Mali-G1-Ultra (by chip mt6993)", GpuInfo.maliOfSoc(listOf("MT6993")))
assertEquals(Family.MALI_OTHER, GpuInfo.familyOf(false, 0, mali = "Mali-G1-Ultra MC12"))
}
@Test
fun autoTakesRadvOnAnXclipseAndLeavesPowerVrOnTheSystemDriver() {
assertEquals(DriverPairs.NAD_RADV_XCLIPSE, DriverPairs.recommendedKey(GpuInfo("Samsung Xclipse 940", 0, Family.POWERVR, "", false), emptyList()))
@@ -129,6 +129,12 @@ class AppUpdatesTest {
assertNull(AppUpdates.installBlock(stable, me("eeeeeee", versionCode = 9)))
}
@Test
fun theNonAdrenoTestBuildIsNeverReplacedByAnOfficialBuild() {
val testBuild = AppUpdates.Installed("eeeeeee", 0, "0.2.0", 9, updatable = true, nonAdrenoTest = true)
assertNotNull(AppUpdates.installBlock(stable, testBuild))
}
@Test
fun aMissingVariantIsBlockedBeforeDownload() {
val missing = release("ddddddd", withApk = false)