Auto drivers for Mali and Xclipse on the non-Adreno test branch

Auto now picks an open driver pair for the GPU, the way it does for Adreno:
- Mali (no KGSL, /dev/mali0): the GPU's name ("Mali-G720-Immortalis MC12", from the vendor
  Vulkan driver or kbase's gpuinfo) picks the PanVK build: G52-G78 (Job Manager), G610/G710,
  G615 or G720. A Mali none of them covers (G925...), or one whose pair is not published yet,
  draws through the Mali bridge, switched on by Auto.
- Xclipse keeps the system-driver path as Auto; the RADV pair is offered as a manual choice.
- The pairs come from The412Banner/droiddeck-nonadreno-drivers (one pre-release per driver,
  each a DriverBundle zip). Only a device without an Adreno reads that repo.
- The importers accept PanVK and RADV libraries (libvulkan_panfrost / libvulkan_radeon).
- An open driver pair and the Mali bridge are alternatives: a selected pair turns the bridge off.
- TU_DEBUG is only set for Turnip, on an Adreno.

Every new branch is reached only when the device has no Adreno; an Adreno's detection, release
sources, Auto choice and session environment are unchanged.
This commit is contained in:
The412Banner committed 2026-10-12 19:12:03 -04:00
1 parent b50d333f6c
commit 3dc58e58cb
10 files changed
+204 -16

No files matched your search

@@ -12,6 +12,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.runtime.mutableIntStateOf
import com.droiddeck.launcher.gpu.DriverBundle
import com.droiddeck.launcher.core.DeviceSupport
import com.droiddeck.launcher.gpu.DriverPairs
import com.droiddeck.launcher.gpu.GpuInfo
import com.droiddeck.launcher.gpu.LinuxVulkanDriver
@@ -164,6 +165,12 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
}
if (!force && autoCheckedThisProcess) return
autoCheckedThisProcess = true
if (gpu.family == GpuInfo.Family.MALI_OTHER) {
useMaliBridge()
autoStatus = activity.getString(R.string.drivers_mali_bridge_auto)
refreshDrivers()
return
}
if (DriverPairs.recommendedKey(gpu, emptyList()) == null) {
autoStatus = activity.getString(R.string.drivers_none_to_set, gpu.supportText(activity).lowercase())
return
@@ -186,6 +193,12 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
when {
row?.active == true -> autoStatus = problem?.let { activity.getString(R.string.drivers_up_to_date_check_failed, it) }
?: activity.getString(R.string.upd_current_status)
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)
refreshDrivers()
}
pair == null || !pair.complete ->
autoStatus = problem?.let { activity.getString(R.string.upd_couldnt_check, it) } ?: activity.getString(R.string.drivers_recommended_unpublished)
else -> installPair(pair, auto = true)
@@ -194,6 +207,18 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
}, "gpu-driver-auto").start()
}
/**
* Auto on a Mali without an open driver pair: the Vulkan bridge draws instead, on the phone's
* own driver, so a pair Auto set earlier is unset rather than left half-working.
*/
private fun useMaliBridge() {
if (DeviceSupport.openDriverActive(activity)) {
SessionPrefs.setAndroidDriver(activity, TurnipDriver.AUTO)
SessionPrefs.setLinuxDriver(activity, "")
}
SessionPrefs.setVkBridge(activity, true)
}
/** Manual: install (if need be) and set both halves of a pair. */
fun selectPair(key: String) {
if (pairBusy != null) return
@@ -230,6 +255,8 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
val displayChanged = SessionPrefs.androidDriver(activity) != displayId
SessionPrefs.setAndroidDriver(activity, displayId)
SessionPrefs.setLinuxDriver(activity, linuxId)
// An open Mali/Xclipse driver and the Mali bridge are alternatives: the pair wins.
if (DriverPairs.isNonAdreno(pair.key)) SessionPrefs.setVkBridge(activity, false)
val restart = displayChanged && CompositorHost.isStarted
if (auto) {
val previous = SessionPrefs.gpuAutoInstalled(activity)
@@ -23,10 +23,21 @@ object DeviceSupport {
* Xclipse) already handles. An Adreno keeps Turnip whatever the setting says.
*/
fun vkBridge(context: Context): Boolean =
!adreno() && !SystemVulkanDriver.isAvailable() && com.droiddeck.launcher.session.SessionPrefs.vkBridge(context)
!adreno() && !SystemVulkanDriver.isAvailable() && !openDriverActive(context) &&
com.droiddeck.launcher.session.SessionPrefs.vkBridge(context)
/** A session can draw: Adreno with Turnip, PowerVR/Xclipse on the system driver, or the bridge. */
fun canDraw(context: Context): Boolean = graphicsAvailable() || vkBridge(context)
/**
* Whether an open non-Adreno driver pair (PanVK for Mali, RADV for Xclipse) is the one in use:
* it and the bridge are alternatives, and the pair wins. Always false on an Adreno.
*/
fun openDriverActive(context: Context): Boolean =
!adreno() && com.droiddeck.launcher.gpu.DriverPairs.isNonAdreno(com.droiddeck.launcher.gpu.DriverBundle.active(context)?.id)
/**
* A session can draw: Adreno with Turnip, PowerVR/Xclipse on the system driver, an open
* non-Adreno driver pair, or the bridge.
*/
fun canDraw(context: Context): Boolean = graphicsAvailable() || openDriverActive(context) || vkBridge(context)
/** The chip as the device names it, for the card that explains the refusal. */
fun gpuName(context: Context): String {
@@ -100,7 +100,7 @@ object DriverBundle {
val linuxStage = lm.newStagingDir()
val linuxId = try {
val library = linuxDir.listFiles()?.firstOrNull { it.isFile && it.name.startsWith("libvulkan_freedreno") && it.name.endsWith(".so") }
val library = linuxDir.listFiles()?.firstOrNull { it.isFile && LinuxVulkanDriverManager.isDriverLibrary(it.name) }
library?.copyTo(File(linuxStage, LinuxVulkanDriverManager.LIB_NAME))
val meta = File(linuxDir, LinuxVulkanDriverManager.META_NAME).takeIf { it.isFile }
?.let { runCatching { JSONObject(FileUtils.readString(it)) }.getOrNull() }
@@ -27,6 +27,30 @@ object DriverPairs {
/** Each DD-Turnip release is its own pair: "dd-turnip:DD-Turnip-v0.1.0". */
fun ddTurnip(tag: String) = "$DD_TURNIP:$tag"
/** The open non-Adreno drivers (The412Banner/droiddeck-nonadreno-drivers), one pair per driver. */
const val NON_ADRENO = "nad"
const val NAD_RADV_XCLIPSE = "nad:radv-xclipse"
const val NAD_MALI_JM = "nad:panvk-mali-jm"
const val NAD_MALI_G710 = "nad:panvk-mali-g710"
const val NAD_MALI_G615 = "nad:panvk-mali-g615"
const val NAD_MALI_G720 = "nad:panvk-mali-g720"
/** "PanVK-Mali-G720" (the release asset's id) to its pair key, "nad:panvk-mali-g720". */
fun nonAdreno(id: String) = "$NON_ADRENO:" + id.lowercase()
/** True for a non-Adreno pair's key, or a bundle installed from one ("PanVK-Mali-G720"). */
fun isNonAdreno(keyOrBundleId: String?): Boolean = keyOrBundleId != null &&
(keyOrBundleId.startsWith("$NON_ADRENO:") || Regex("""^(?i)(RADV-Xclipse|PanVK-Mali-[A-Za-z0-9]+)(-\d+)?$""").matches(keyOrBundleId))
fun nonAdrenoName(key: String): String = describeNonAdreno(key).first
private fun describeNonAdreno(key: String): Pair<String, Set<Family>> = when (key) {
NAD_RADV_XCLIPSE -> "RADV · Samsung Xclipse" to setOf(Family.POWERVR)
NAD_MALI_JM -> "PanVK · Mali G52-G78" to setOf(Family.MALI_JM)
NAD_MALI_G710 -> "PanVK · Mali-G610/G710" to setOf(Family.MALI_G610_G710)
NAD_MALI_G615 -> "PanVK · Mali-G615" to setOf(Family.MALI_G615)
NAD_MALI_G720 -> "PanVK · Mali-G720" to setOf(Family.MALI_G720)
else -> key.removePrefix("$NON_ADRENO:") to emptySet<Family>()
}
class DriverPair(
val key: String,
/** "Banners-Turnip · Adreno 6xx/7xx", "WinNative · Balanced". */
@@ -44,14 +68,19 @@ object DriverPairs {
/** "r4 · 1.19 + 0.1.2": the build of each half. */
val version: String
get() = listOfNotNull(bundle?.tag, display?.tag, linux?.tag).distinct().joinToString(" + ") { it.removePrefix("linux-").removePrefix("DD-Turnip-") }
fun suits(gpu: GpuInfo) = gpu.family in families ||
(gpu.family == Family.ADRENO_UNKNOWN && (Family.A7XX in families || Family.A8XX in families))
fun suits(gpu: GpuInfo) = when {
// The system-driver family covers PowerVR and Xclipse; RADV is only for the Xclipse.
key == NAD_RADV_XCLIPSE -> gpu.family == Family.POWERVR && gpu.name.contains("Xclipse", ignoreCase = true)
else -> gpu.family in families ||
(gpu.family == Family.ADRENO_UNKNOWN && (Family.A7XX in families || Family.A8XX in families))
}
}
private val ALL_ADRENO = setOf(Family.A6XX, Family.A7XX, Family.A7XX_LOW, Family.A8XX, Family.ADRENO_UNKNOWN)
private fun describe(key: String): Pair<String, Set<Family>> = when {
key.startsWith(DD_TURNIP) -> "DroidDeck · DD-Turnip" to ALL_ADRENO
key.startsWith("$NON_ADRENO:") -> describeNonAdreno(key)
else -> describeFixed(key)
}
@@ -68,7 +97,7 @@ object DriverPairs {
/** Every pair the last release check found, in the order the list shows them. */
fun from(check: TurnipReleases.Check?): List<DriverPair> {
val assets = check?.assets.orEmpty().filter { it.pair.isNotEmpty() }
val order = listOf(DD_TURNIP, BANNER, BANNER_A8XX, BANNER_ONEUI, BANNER_710, WN_BALANCED, WN_PERFORMANCE)
val order = listOf(DD_TURNIP, BANNER, BANNER_A8XX, BANNER_ONEUI, BANNER_710, WN_BALANCED, WN_PERFORMANCE, NON_ADRENO)
return assets.map { it.pair }.distinct()
.sortedBy { key -> order.indexOf(key.substringBefore(':')).let { i -> if (i < 0) order.size else i } }
.map { key ->
@@ -93,7 +122,13 @@ object DriverPairs {
* the 710/720/722, and upstream Banners-Turnip for the rest. Null when nothing fits (not Adreno).
*/
fun recommendedKey(gpu: GpuInfo, pairs: List<DriverPair>): String? = when (gpu.family) {
Family.NOT_ADRENO, Family.POWERVR -> null
// PowerVR and Xclipse keep the system driver (RADV stays a manual choice); a Mali no open
// build covers draws through the Vulkan bridge instead (DriverMenus.ensureAuto).
Family.NOT_ADRENO, Family.POWERVR, Family.MALI_OTHER -> null
Family.MALI_JM -> NAD_MALI_JM
Family.MALI_G610_G710 -> NAD_MALI_G710
Family.MALI_G615 -> NAD_MALI_G615
Family.MALI_G720 -> NAD_MALI_G720
Family.A8XX -> if (gpu.model == 840) newestDdTurnip(pairs) ?: WN_BALANCED else WN_BALANCED
Family.A7XX_LOW -> BANNER_710
Family.A7XX -> if (gpu.oneUi8Gen2) BANNER_ONEUI else BANNER
@@ -36,8 +36,17 @@ data class GpuInfo(
/** An Adreno whose model KGSL does not give: treated as the newest family it could be. */
ADRENO_UNKNOWN("Adreno"),
POWERVR("PowerVR"),
/** Mali on Arm's kbase driver, by the open PanVK build each generation needs. */
MALI_JM("Mali (G52-G78)"),
MALI_G610_G710("Mali-G610/G710"),
MALI_G615("Mali-G615"),
MALI_G720("Mali-G720"),
/** A Mali no open driver build covers yet (G925...): the Vulkan bridge is its only path. */
MALI_OTHER("Mali"),
NOT_ADRENO("Not an Adreno GPU");
val mali: Boolean get() = name.startsWith("MALI_")
/** [label] in the app's language: the Adreno families are names, the rest is words. */
fun label(context: Context): String = if (this == NOT_ADRENO) context.getString(R.string.gpuinfo_not_adreno) else label
}
@@ -59,6 +68,8 @@ data class GpuInfo(
Support.TESTED -> "Supported"
Support.UNTESTED -> when (family) {
Family.POWERVR -> "System PowerVR driver: compatibility varies by device"
Family.MALI_OTHER -> "Experimental: Mali through the Vulkan bridge"
Family.MALI_JM, Family.MALI_G610_G710, Family.MALI_G615, Family.MALI_G720 -> "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"
}
@@ -71,6 +82,7 @@ data class GpuInfo(
Support.UNTESTED -> when (family) {
Family.POWERVR -> R.string.gpuinfo_powervr
Family.A7XX_LOW -> R.string.gpuinfo_experimental
Family.MALI_JM, Family.MALI_G610_G710, Family.MALI_G615, Family.MALI_G720, Family.MALI_OTHER -> R.string.gpuinfo_experimental
else -> R.string.gpuinfo_below_tested
}
Support.UNSUPPORTED -> R.string.gpuinfo_unsupported
@@ -102,13 +114,16 @@ data class GpuInfo(
fromPlatform > 0 -> "platform"
else -> ""
}
val family = familyOf(adreno, model, SystemVulkanDriver.isPowerVr())
// Mali, named by the vendor's Vulkan driver ("Mali-G720-Immortalis MC12") or by kbase.
val mali = if (adreno || !File("/dev/mali0").exists()) null else maliName()
val family = familyOf(adreno, model, SystemVulkanDriver.isPowerVr(), mali)
val samsung = Build.MANUFACTURER.equals("samsung", ignoreCase = true)
return GpuInfo(
name = when {
family == Family.POWERVR -> SystemVulkanDriver.gpuName().let { gpu ->
VulkanInfo.cachedOrNull()?.get("device")?.takeIf { it.contains(gpu, ignoreCase = true) } ?: gpu
}
mali != null && mali.isNotEmpty() -> mali
!adreno -> Build.HARDWARE.ifBlank { UNNAMED }
model > 0 -> "Adreno $model"
else -> "Adreno"
@@ -137,8 +152,29 @@ data class GpuInfo(
""
}
internal fun familyOf(adreno: Boolean, model: Int, powerVr: Boolean = false): Family = when {
/** The Mali's name, "" when the device has a kbase node but names no GPU. */
private fun maliName(): String =
VulkanInfo.cachedOrNull()?.get("device")?.takeIf { it.contains("Mali", ignoreCase = true) }
?: FileUtils.readString(File("/sys/class/misc/mali0/device/gpuinfo"))?.trim()?.takeIf { it.contains("Mali", ignoreCase = true) }
?.substringBefore(" ")
?: ""
/** The PanVK generation a Mali name belongs to; MALI_OTHER when none of the builds covers it. */
internal fun maliFamily(name: String): Family {
val number = Regex("""G(\d{2,3})""", RegexOption.IGNORE_CASE).find(name)?.groupValues?.get(1)?.toIntOrNull()
?: return Family.MALI_OTHER
return when (number) {
31, 51, 52, 57, 68, 71, 72, 76, 77, 78 -> Family.MALI_JM
610, 710 -> Family.MALI_G610_G710
615 -> Family.MALI_G615
720 -> Family.MALI_G720
else -> Family.MALI_OTHER
}
}
internal fun familyOf(adreno: Boolean, model: Int, powerVr: Boolean = false, mali: String? = null): Family = when {
!adreno && powerVr -> Family.POWERVR
!adreno && mali != null -> maliFamily(mali)
!adreno -> Family.NOT_ADRENO
model == 0 -> Family.ADRENO_UNKNOWN
model >= 800 -> Family.A8XX
@@ -141,8 +141,8 @@ public class LinuxVulkanDriverManager {
// Flatten: only the base name matters, and it also defeats zip-slip paths.
String base = new File(entry.getName()).getName();
if (base.isEmpty()) continue;
if (base.startsWith("libvulkan_freedreno") && base.endsWith(".so")) {
if (soName != null) Log.w(TAG, "zip has several libvulkan_freedreno*.so; using the first (" + soName + ")");
if (isDriverLibrary(base)) {
if (soName != null) Log.w(TAG, "zip has several driver libraries; using the first (" + soName + ")");
else {
Files.copy(zis, new File(tmpDir, LIB_NAME).toPath(), StandardCopyOption.REPLACE_EXISTING);
soName = base;
@@ -245,6 +245,16 @@ public class LinuxVulkanDriverManager {
return id;
}
/**
* A Linux Vulkan driver's library as release zips name it: Turnip (freedreno) on Adreno, PanVK
* (panfrost) on Mali, RADV (radeon) on Xclipse. Whichever it is, it is installed as
* {@link #LIB_NAME}; the ICD manifest loads it by that absolute path.
*/
public static boolean isDriverLibrary(String base) {
return base.endsWith(".so") && (base.startsWith("libvulkan_freedreno")
|| base.startsWith("libvulkan_panfrost") || base.startsWith("libvulkan_radeon"));
}
static String sanitizeId(String name) {
String s = name.trim().replaceAll("[^A-Za-z0-9._-]+", "_").replaceAll("^[._]+", "");
if (s.length() > 64) s = s.substring(0, 64);
@@ -43,7 +43,8 @@ object TurnipReleases {
/** What an asset is: a Linux build or not, the menu label, and the pair it belongs to. */
private class Kind(val linux: Boolean, val label: String, val pair: String, val bundle: Boolean = false)
private class Source(val label: String, val repo: String, val classify: (name: String, tag: String) -> Kind?)
/** [prerelease]: a source whose bundles are all test builds offers them from pre-releases too. */
private class Source(val label: String, val repo: String, val prerelease: Boolean = false, val classify: (name: String, tag: String) -> Kind?)
private val SOURCES = listOf(
// Turnip-<tag>[-variant][-Linux|-Wayland].zip; -Wayland is for a path this app does not have.
@@ -77,8 +78,22 @@ object TurnipReleases {
if (!Regex("""^DD-Turnip-v\d+\.\d+\.\d+\.zip$""").matches(name)) return@Source null
Kind(false, "Android + Linux · all Adreno", DriverPairs.ddTurnip(tag), bundle = true)
},
// <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, _ ->
val m = Regex("""^((?:RADV-Xclipse|PanVK-Mali-[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)
},
)
private const val NON_ADRENO_REPO = "The412Banner/droiddeck-nonadreno-drivers"
/** The sources this device reads: an Adreno never asks the non-Adreno repo, so its list is as before. */
private fun sources(): List<Source> =
if (com.droiddeck.launcher.core.DeviceSupport.adreno()) SOURCES.filter { it.repo != NON_ADRENO_REPO } else SOURCES
/** The result of the last check, or null when the user has never checked. */
fun cached(context: Context): Check? {
val raw = prefs(context).getString(KEY_RELEASE, null) ?: return null
@@ -94,7 +109,8 @@ object TurnipReleases {
val latest = JSONArray()
val failed = ArrayList<String>()
var lastError: Exception? = null
for (src in SOURCES) {
val sources = sources()
for (src in sources) {
try {
val releases = JSONArray(get(context, "https://api.github.com/repos/${src.repo}/releases?per_page=15"))
val seen = HashSet<String>()
@@ -110,7 +126,7 @@ object TurnipReleases {
val name = a.getString("name")
val kind = src.classify(name, tag) ?: continue
// A bundle is only offered from an official release, never a pre-release.
if (kind.bundle && r.optBoolean("prerelease")) continue
if (kind.bundle && r.optBoolean("prerelease") && !src.prerelease) continue
val linux = kind.linux
val label = kind.label
// Only assets GitHub has a sha256 for are offered: the download is checked against it.
@@ -129,7 +145,7 @@ object TurnipReleases {
lastError = e
}
}
if (failed.size == SOURCES.size) throw lastError ?: IOException("no source answered")
if (failed.size == sources.size) throw lastError ?: IOException("no source answered")
val stored = JSONObject().put("assets", assets).put("latest", latest)
.put("failed", JSONArray(failed)).put("checkedAt", System.currentTimeMillis())
prefs(context).edit().putString(KEY_RELEASE, stored.toString()).apply()
@@ -307,6 +307,8 @@ class SessionService : Service() {
}
private fun tuDebug(linuxDriverId: String): String? {
// Turnip's switch; a non-Adreno GPU runs another driver (PanVK, RADV, the bridge).
if (!com.droiddeck.launcher.core.DeviceSupport.adreno()) return null
val override = File(Environment.getExternalStorageDirectory(), TU_DEBUG_SWITCH)
.takeIf { it.isFile }?.let { FileUtils.readString(it)?.trim() }
if (!override.isNullOrEmpty()) return override
+2
View File
@@ -1906,6 +1906,8 @@
<string name="gpu_system_powervr">System PowerVR</string>
<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="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>
<string name="gpuinfo_supported">Supported</string>
@@ -131,4 +131,53 @@ class DriverPairsTest {
assertEquals(DriverPairs.WN_BALANCED, DriverPairs.recommendedKey(gpu(825), pairs))
assertEquals(DriverPairs.BANNER, DriverPairs.recommendedKey(gpu(740), pairs))
}
@Test
fun maliFamiliesFollowTheOpenDriverBuilds() {
assertEquals(Family.MALI_JM, GpuInfo.familyOf(false, 0, mali = "Mali-G57 MC2"))
assertEquals(Family.MALI_JM, GpuInfo.familyOf(false, 0, mali = "Mali-G77"))
assertEquals(Family.MALI_G610_G710, GpuInfo.familyOf(false, 0, mali = "Mali-G710"))
assertEquals(Family.MALI_G615, GpuInfo.familyOf(false, 0, mali = "Mali-G615 MC6"))
assertEquals(Family.MALI_G720, GpuInfo.familyOf(false, 0, mali = "Mali-G720-Immortalis MC12"))
assertEquals(Family.MALI_OTHER, GpuInfo.familyOf(false, 0, mali = "Mali-G925-Immortalis MC12"))
assertEquals(Family.MALI_OTHER, GpuInfo.familyOf(false, 0, mali = ""))
// An Adreno is an Adreno whatever else the device reports, and the system HAL keeps priority.
assertEquals(Family.A7XX, GpuInfo.familyOf(true, 740, mali = "Mali-G720"))
assertEquals(Family.POWERVR, GpuInfo.familyOf(false, 0, powerVr = true, mali = "Mali-G720"))
}
@Test
fun autoPicksTheOpenDriverForEachMaliAndNothingForTheRest() {
fun mali(name: String) = GpuInfo(name, 0, GpuInfo.familyOf(false, 0, mali = name), "", false)
assertEquals(DriverPairs.NAD_MALI_JM, DriverPairs.recommendedKey(mali("Mali-G57"), emptyList()))
assertEquals(DriverPairs.NAD_MALI_G710, DriverPairs.recommendedKey(mali("Mali-G710"), emptyList()))
assertEquals(DriverPairs.NAD_MALI_G615, DriverPairs.recommendedKey(mali("Mali-G615"), emptyList()))
assertEquals(DriverPairs.NAD_MALI_G720, DriverPairs.recommendedKey(mali("Mali-G720"), emptyList()))
assertNull("a Mali no build covers uses the bridge", DriverPairs.recommendedKey(mali("Mali-G925"), emptyList()))
assertEquals(DriverPairs.BANNER, DriverPairs.recommendedKey(gpu(740), emptyList()))
}
@Test
fun nonAdrenoPairsComeFromTheirBundlesAndSuitOnlyTheirGpu() {
val pairs = DriverPairs.from(TurnipReleases.Check(
listOf(
TurnipReleases.Asset("Non-Adreno", "panvk-mali-g720", "PanVK-Mali-G720-Pair.zip", "https://example/a", 9_000_000,
false, "label", "0".repeat(64), DriverPairs.nonAdreno("PanVK-Mali-G720"), bundle = true),
TurnipReleases.Asset("Non-Adreno", "radv-xclipse", "RADV-Xclipse-Pair.zip", "https://example/b", 9_000_000,
false, "label", "0".repeat(64), DriverPairs.nonAdreno("RADV-Xclipse"), bundle = true),
),
emptyList(), emptyList(), 0L,
))
val g720 = pairs.single { it.key == DriverPairs.NAD_MALI_G720 }
val radv = pairs.single { it.key == DriverPairs.NAD_RADV_XCLIPSE }
assertTrue(g720.complete)
assertTrue(g720.suits(GpuInfo("Mali-G720", 0, Family.MALI_G720, "", false)))
assertFalse(g720.suits(gpu(740)))
assertTrue(radv.suits(GpuInfo("Xclipse", 0, Family.POWERVR, "", false)))
assertFalse("RADV is not for a PowerVR Pixel", radv.suits(GpuInfo("PowerVR", 0, Family.POWERVR, "", false)))
assertTrue(DriverPairs.isNonAdreno("PanVK-Mali-G720"))
assertTrue(DriverPairs.isNonAdreno("RADV-Xclipse-2"))
assertFalse(DriverPairs.isNonAdreno("DD-Turnip-v0.1.0"))
assertFalse(DriverPairs.isNonAdreno(null))
}
}