Open driver pairs: the installed build's version, its upload date, and an Update when the release is rebuilt in place

- The release check records each asset's GitHub id and updated_at; a
  download records them (with the digest) for an open non-Adreno pair.
- Components > GPU drivers: an installed open pair shows its manifest
  version ("android <tag> + linux <commit>"), one not yet installed shows
  "built YYYY-MM-DD". A different digest, asset id or upload time on the
  same tag marks the installed pair "Update available" with an Update
  action: the pair is downloaded again and replaced in place, and stays
  selected only if it was. Adreno and DD-Turnip pairs are unchanged.
- graphics-report.txt: the pair release line gives the installed and the
  listed upload dates and flags a newer build; an exact bundle id match is
  preferred (RADV-Xclipse-upstream is not RADV-Xclipse).
This commit is contained in:
The412Banner committed 2026-10-15 19:22:04 -04:00
1 parent 00b8fc2b7d
commit 5bc5f68761
8 files changed
+125 -18

No files matched your search

@@ -111,12 +111,21 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
val pairs = DriverPairs.from(TurnipReleases.cached(activity))
val recommended = if (QuestExperimental.isSupported()) null else DriverPairs.recommendedKey(gpu, pairs)
pairRows = pairs.map { p ->
val bundle = p.bundle?.let { installedBundle(it) }
val nad = DriverPairs.isNonAdreno(p.key)
val bundle = p.bundle?.let { if (nad) installedBundleAnyBuild(it) else installedBundle(it) }
val displayId = if (p.bundle != null) bundle?.androidId else p.display?.let { TurnipReleases.installedId(activity, it, td::isInstalled) }
val linuxId = if (p.bundle != null) bundle?.linuxId else p.linux?.let { TurnipReleases.installedId(activity, it, lm::isInstalled) }
val mb = p.assets.sumOf { it.size } / 1_048_576.0
val update = nad && bundle != null && p.bundle?.let { TurnipReleases.updateAvailable(activity, it) } == true
val builtOn = if (nad) p.bundle?.builtOn.orEmpty() else ""
val version = when {
!nad -> p.version
bundle != null -> bundle.version.ifEmpty { p.version }
builtOn.isNotEmpty() -> activity.getString(R.string.drivers_built_on, builtOn)
else -> p.version
}
PairRow(
key = p.key, name = p.name, version = p.version,
key = p.key, name = p.name, version = version, update = if (update) builtOn.takeIf { it.isNotEmpty() }?.let { activity.getString(R.string.drivers_built_on, it) } ?: p.version else null,
detail = if (!p.complete) activity.getString(R.string.drivers_half_published) else activity.getString(R.string.drivers_pair_size, mb),
recommended = p.key == recommended, suits = p.suits(gpu), complete = p.complete,
installed = displayId != null && linuxId != null,
@@ -245,7 +254,15 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
installPair(pair, auto = false)
}
private fun installPair(pair: DriverPairs.DriverPair, auto: Boolean) {
/** A newer build of an installed open non-Adreno pair: replaced in place, still selected if it was. */
fun updatePair(key: String) {
if (pairBusy != null) return
val pair = DriverPairs.from(TurnipReleases.cached(activity)).firstOrNull { it.key == key && it.complete } ?: return
val wasActive = pairRows.firstOrNull { it.key == key }?.active == true
installPair(pair, auto = wasActive && mode == SessionPrefs.GPU_DRIVERS_AUTO, force = true, select = wasActive)
}
private fun installPair(pair: DriverPairs.DriverPair, auto: Boolean, force: Boolean = false, select: Boolean = true) {
if (!pair.complete) return
pairBusy = pair.key
pairPercent = 0
@@ -257,7 +274,7 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
val result = runCatching {
val zips = pair.assets
val ids = zips.mapIndexed { i, asset ->
installedIdOf(asset)
(if (force) null else installedIdOf(asset))
?: installAsset(asset) { pct -> ui.post { pairPercent = (i * 100 + pct) / zips.size } }.also { downloaded = true }
}
if (pair.bundle != null) DriverBundle.get(activity, ids[0])!!.let { listOf(it.androidId, it.linuxId) } else ids
@@ -266,6 +283,10 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
pairBusy = null
pairPercent = -1
result.onSuccess { (pairDisplayId, linuxId) ->
if (!select) {
android.widget.Toast.makeText(activity, activity.getString(R.string.drivers_pair_updated, pair.name), android.widget.Toast.LENGTH_LONG).show()
return@onSuccess
}
// A Mali pair under Auto: the compositor draws on the phone's own Mali driver
// (dma-buf, modifiers and AHB all work there) and the guest runs the pair's
// PanVK. Its Android half stays installed for a manual pick.
@@ -313,6 +334,9 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
private fun installedBundle(asset: TurnipReleases.Asset): DriverBundle.Bundle? =
TurnipReleases.installedId(activity, asset) { DriverBundle.get(activity, it) != null }?.let { DriverBundle.get(activity, it) }
private fun installedBundleAnyBuild(asset: TurnipReleases.Asset): DriverBundle.Bundle? =
TurnipReleases.installedIdAnyBuild(activity, asset) { DriverBundle.get(activity, it) != null }?.let { DriverBundle.get(activity, it) }
private fun installedIdOf(asset: TurnipReleases.Asset): String? = when {
asset.bundle -> installedBundle(asset)?.id
asset.linux -> TurnipReleases.installedId(activity, asset, LinuxVulkanDriverManager(activity)::isInstalled)
@@ -1199,6 +1199,7 @@ class MainActivity : ComponentActivity() {
gpuActions = com.droiddeck.launcher.ui.GpuDriversActions(
onAuto = { on -> drivers.setMode(on) },
onPair = { key -> drivers.selectPair(key) },
onPairUpdate = { key -> drivers.updatePair(key) },
onRefresh = { if (drivers.mode == SessionPrefs.GPU_DRIVERS_AUTO) drivers.ensureAuto(force = true) else drivers.checkLatestTurnip() },
onSelectLinux = { id -> drivers.selectDriver(id, linux = true) },
onSelectAndroid = { id -> drivers.selectDriver(id, linux = false) },
@@ -18,7 +18,11 @@ object TurnipReleases {
private const val KEY_DOWNLOADS = "downloads"
class Asset(val source: String, val tag: String, val name: String, val url: String, val size: Long, val linux: Boolean, val label: String,
val sha256: String = "", val pair: String = "", val bundle: Boolean = false)
val sha256: String = "", val pair: String = "", val bundle: Boolean = false,
val assetId: Long = 0, val updatedAt: String = "") {
/** "2026-10-15" from GitHub's updated_at; empty when the check did not record it. */
val builtOn: String get() = updatedAt.take(10)
}
class Check(val assets: List<Asset>, val latest: List<Pair<String, String>>, val failed: List<String>, val checkedAt: Long)
private class Kind(val linux: Boolean, val label: String, val pair: String, val bundle: Boolean = false)
@@ -102,7 +106,7 @@ object TurnipReleases {
assets.put(JSONObject().put("source", src.label).put("tag", tag).put("name", name)
.put("url", a.getString("browser_download_url")).put("size", a.optLong("size"))
.put("linux", linux).put("label", label).put("sha256", sha).put("pair", kind.pair)
.put("bundle", kind.bundle))
.put("bundle", kind.bundle).put("id", a.optLong("id")).put("updated_at", a.optString("updated_at")))
}
}
if (newest != null) latest.put(JSONObject().put("source", src.label).put("tag", newest))
@@ -141,7 +145,7 @@ object TurnipReleases {
val a = list.getJSONObject(i)
out.add(Asset(a.getString("source"), a.getString("tag"), a.getString("name"), a.getString("url"),
a.optLong("size"), a.getBoolean("linux"), a.getString("label"), a.optString("sha256", ""), a.optString("pair", ""),
a.optBoolean("bundle", false)))
a.optBoolean("bundle", false), a.optLong("id"), a.optString("updated_at", "")))
}
val latest = ArrayList<Pair<String, String>>()
val l = json.optJSONArray("latest") ?: JSONArray()
@@ -160,6 +164,31 @@ object TurnipReleases {
}
private const val SHA_PREFIX = "sha256:"
private const val ASSET_ID_PREFIX = "asset:"
private const val UPDATED_PREFIX = "updated:"
/** The id an open non-Adreno pair's asset was installed as, whichever build of it that was. */
fun installedIdAnyBuild(context: Context, asset: Asset, isInstalled: (String) -> Boolean): String? =
downloads(context).optString(asset.name, "").takeIf { it.isNotEmpty() && isInstalled(it) }
/**
* An open non-Adreno pair is rebuilt in place under the same tag: a different digest, asset id
* or upload time than the one installed means a newer build.
*/
fun updateAvailable(context: Context, asset: Asset): Boolean {
if (!DriverPairs.isNonAdreno(asset.pair)) return false
val d = downloads(context)
if (d.optString(asset.name, "").isEmpty()) return false
val sha = d.optString(SHA_PREFIX + asset.name, "")
val id = d.optLong(ASSET_ID_PREFIX + asset.name, 0)
val updated = d.optString(UPDATED_PREFIX + asset.name, "")
return (sha.isNotEmpty() && asset.sha256.isNotEmpty() && !sha.equals(asset.sha256, ignoreCase = true)) ||
(id != 0L && asset.assetId != 0L && id != asset.assetId) ||
(updated.isNotEmpty() && asset.updatedAt.isNotEmpty() && updated != asset.updatedAt)
}
/** When the installed build of [asset] was uploaded, as recorded at download ("" if unknown). */
fun installedBuiltOn(context: Context, asset: Asset): String = downloads(context).optString(UPDATED_PREFIX + asset.name, "").take(10)
fun isDownloaded(context: Context, id: String): Boolean {
val d = downloads(context)
@@ -168,7 +197,11 @@ object TurnipReleases {
fun recordDownload(context: Context, asset: Asset, id: String) {
val d = downloads(context).put(asset.name, id)
if (DriverPairs.isNonAdreno(asset.pair) && asset.sha256.isNotEmpty()) d.put(SHA_PREFIX + asset.name, asset.sha256)
if (DriverPairs.isNonAdreno(asset.pair)) {
if (asset.sha256.isNotEmpty()) d.put(SHA_PREFIX + asset.name, asset.sha256)
if (asset.assetId != 0L) d.put(ASSET_ID_PREFIX + asset.name, asset.assetId)
if (asset.updatedAt.isNotEmpty()) d.put(UPDATED_PREFIX + asset.name, asset.updatedAt)
}
prefs(context).edit().putString(KEY_DOWNLOADS, d.toString()).apply()
}
@@ -133,12 +133,15 @@ object GraphicsReport {
/** The release tag and download a pair bundle came from, when the last release check knows it. */
private fun release(context: Context, bundleId: String): String? {
val asset = TurnipReleases.cached(context)?.assets?.firstOrNull { a ->
val id = a.name.removeSuffix("-Pair.zip")
a.bundle && (bundleId == id || bundleId.startsWith("$id-"))
}
val bundles = TurnipReleases.cached(context)?.assets?.filter { it.bundle }.orEmpty()
val asset = bundles.firstOrNull { it.name.removeSuffix("-Pair.zip") == bundleId }
?: bundles.firstOrNull { bundleId.startsWith(it.name.removeSuffix("-Pair.zip") + "-") }
?: return null
return "${asset.tag} ${asset.url}"
val installed = TurnipReleases.installedBuiltOn(context, asset)
return "${asset.tag} ${asset.url}" +
(if (installed.isNotEmpty()) ", installed build uploaded $installed" else "") +
(if (asset.builtOn.isNotEmpty()) ", listed build uploaded ${asset.builtOn}" else "") +
(if (TurnipReleases.updateAvailable(context, asset)) " << NEWER BUILD AVAILABLE" else "")
}
private fun node(path: String): String {
@@ -521,7 +521,7 @@ fun ComponentsPage(
}
val availableTitle: @Composable (String) -> String = { l ->
when (l) {
GPU_TAB -> stringResource(R.string.comp_available_count, gpu.pairs.count { !it.installed && it.complete && (it.suits || showAllPairs) })
GPU_TAB -> stringResource(R.string.comp_available_count, gpu.pairs.count { (!it.installed || it.update != null) && it.complete && (it.suits || showAllPairs) })
PROTON_TAB -> stringResource(R.string.comp_available_count, protons.rows.count { it.installed == null || it.update != null })
else -> stringResource(R.string.comp_nightlies_count, availableFor(l, catalog, snapshot).size)
}
@@ -543,7 +543,8 @@ fun ComponentsPage(
for (p in gpu.pairs.filter { it.installed && (it.suits || showAllPairs) }) {
val key = "gpu:${p.key}"
ChoiceLine(
p.name, "${p.version} · ${p.detail}", !gpu.auto && p.active, removable = false,
p.name, "${p.version} · ${p.detail}" + (p.update?.let { " · " + stringResource(R.string.proton_update_available, it) } ?: ""),
!gpu.auto && p.active, removable = false,
badge = if (p.recommended) stringResource(R.string.gpu_recommended_caps) else null,
progress = if (gpu.busy == p.key) gpu.percent else null,
modifier = Modifier.trackRow(key, rowsAt),
@@ -612,12 +613,15 @@ fun ComponentsPage(
val availableRows: @Composable ColumnScope.(String) -> Unit = { l ->
when (l) {
GPU_TAB -> {
val shown = gpu.pairs.filter { !it.installed && it.complete && (it.suits || showAllPairs) }
val shown = gpu.pairs.filter { (!it.installed || it.update != null) && it.complete && (it.suits || showAllPairs) }
if (shown.isEmpty()) EmptyLine(stringResource(if (gpu.checking) R.string.gpu_checking else R.string.gpu_none_listed))
for (p in shown) GetLine(
p.name, "${p.version} · ${p.detail}", progress = if (gpu.busy == p.key) gpu.percent else null, enabled = gpu.busy == null,
p.name,
if (p.update != null) "${p.version} · " + stringResource(R.string.proton_update_available, p.update) else "${p.version} · ${p.detail}",
progress = if (gpu.busy == p.key) gpu.percent else null, enabled = gpu.busy == null,
badge = if (p.recommended) stringResource(R.string.gpu_recommended_caps) else null,
) { gpuActions.onAuto(false); gpuActions.onPair(p.key) }
action = if (p.update != null) stringResource(R.string.common_update) else null,
) { if (p.update != null) gpuActions.onPairUpdate(p.key) else { gpuActions.onAuto(false); gpuActions.onPair(p.key) } }
if (gpu.pairs.any { !it.suits }) Box(Modifier.padding(horizontal = 6.dp, vertical = 4.dp)) {
FocusText(stringResource(if (showAllPairs) R.string.gpu_hide_other else R.string.gpu_show_other), pal.signal) { showAllPairs = !showAllPairs }
}
@@ -72,6 +72,8 @@ class PairRow(
val complete: Boolean,
val installed: Boolean,
val active: Boolean,
/** A newer build of this installed pair (its build date), or null. */
val update: String? = null,
)
class GpuDriversState(
@@ -106,6 +108,7 @@ class GpuDriversState(
class GpuDriversActions(
val onAuto: (Boolean) -> Unit = {},
val onPair: (String) -> Unit = {},
val onPairUpdate: (String) -> Unit = {},
val onRefresh: () -> Unit = {},
val onSelectLinux: (String) -> Unit = {},
val onSelectAndroid: (String) -> Unit = {},
+2
View File
@@ -720,6 +720,8 @@
<string name="setup_graphics_logs">Detailed graphics logs</string>
<string name="setup_steam_gpu_drawing">Steam interface: GPU drawing</string>
<string name="setup_steam_gpu_drawing_hint">With the Xclipse driver pair, Steam draws its pages in software (GPU drawing showed broken tiles). Turn on for a faster Steam interface if it looks right on this phone.</string>
<string name="drivers_built_on">built %1$s</string>
<string name="drivers_pair_updated">%1$s updated to the newest build</string>
<string name="setup_gpu_bridge_fell_back">The Mali bridge failed its self-test on %1$s last session (images or draws), so the session used the PanVK driver pair instead.</string>
<string name="setup_gpu_bridge_no_memory_sharing">The Mali bridge found no way to share memory with the driver on %1$s last session, so the session used the PanVK driver pair instead. The bridge cannot work on this phone; turning it off keeps the PanVK pair.</string>
<string name="setup_graphics_logs_hint">Each game\'s Proton, DXVK and driver logs in the session\'s logs. Always on when the GPU is not an Adreno.</string>
@@ -0,0 +1,37 @@
package com.droiddeck.launcher.gpu
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
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 = [28], manifest = Config.NONE)
class DriverPairUpdateTest {
private fun pair(sha: String, id: Long, updated: String, key: String = DriverPairs.nonAdreno("PanVK-Mali-G615")) =
TurnipReleases.Asset("Non-Adreno", "panvk-mali-g615", "PanVK-Mali-G615-Pair.zip", "https://example/p", 9_000_000, false,
"label", sha, key, bundle = true, assetId = id, updatedAt = updated)
@Test fun aRebuildUnderTheSameTagIsAnUpdate() {
val context = RuntimeEnvironment.getApplication()
val installed = pair("a".repeat(64), 1, "2026-10-13T10:00:00Z")
assertFalse("nothing installed yet", TurnipReleases.updateAvailable(context, installed))
TurnipReleases.recordDownload(context, installed, "PanVK-Mali-G615")
assertFalse(TurnipReleases.updateAvailable(context, installed))
assertEquals("2026-10-13", TurnipReleases.installedBuiltOn(context, installed))
assertTrue(TurnipReleases.updateAvailable(context, pair("b".repeat(64), 2, "2026-10-15T10:00:00Z")))
assertTrue("a new asset id alone", TurnipReleases.updateAvailable(context, pair("a".repeat(64), 2, "2026-10-13T10:00:00Z")))
assertEquals("2026-10-15", pair("b".repeat(64), 2, "2026-10-15T10:00:00Z").builtOn)
}
@Test fun adrenoPairsAreNeverFlagged() {
val context = RuntimeEnvironment.getApplication()
val turnip = pair("a".repeat(64), 1, "2026-10-13T10:00:00Z", key = DriverPairs.BANNER)
TurnipReleases.recordDownload(context, turnip, "Turnip-x")
assertFalse(TurnipReleases.updateAvailable(context, pair("b".repeat(64), 2, "2026-10-15T10:00:00Z", key = DriverPairs.BANNER)))
}
}