mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
fix(drivers): Auto gives Xclipse GPUs the old RADV pair only where that build supports them (#2337)
* fix: route unsupported Xclipse generations upstream * fix: let Auto load upstream Xclipse pairs * fix: clear stale auto-owned Xclipse RADV pair * fix(drivers): clear independently owned fallback selections * fix(drivers): keep independently chosen drivers when session start reconciles an unsupported Xclipse * fix(drivers): name the Xclipse from Vulkan before session start picks which drivers Auto clears * fix(drivers): keep the Vulkan query off the UI thread when session start reconciles Xclipse drivers * test(drivers): control Xclipse GPU family in auto-driver reconciliation test * fix(gpu): guard Xclipse auto-driver cleanup when running and handle open-driver bundles * fix(gpu): keep active RADV-Xclipse-upstream bundle on unsupported Xclipse
This commit is contained in:
1 parent
ca7b7e74ec
commit
bb5218746f
8 files changed
+373
-28
No files matched your search
@@ -319,7 +319,7 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
refreshDrivers()
|
||||
return
|
||||
}
|
||||
if (gpu.family.mali && DriverPairs.recommendedKey(gpu, emptyList()) == null &&
|
||||
if (gpu.family.mali && !DriverPairs.autoEligible(gpu) &&
|
||||
com.droiddeck.launcher.gpu.VulkanInfo.cachedOrNull() == null) {
|
||||
releaseChecking = true
|
||||
autoStatus = activity.getString(R.string.drivers_checking_latest)
|
||||
@@ -335,14 +335,14 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
}, "gpu-name").start()
|
||||
return
|
||||
}
|
||||
Log.i(TAG, "auto: ${gpu.name} (${gpu.family}) -> " + (DriverPairs.recommendedKey(gpu, emptyList()) ?: "no pair"))
|
||||
if (gpu.family.mali && DriverPairs.recommendedKey(gpu, emptyList()) == null) {
|
||||
Log.i(TAG, "auto: ${gpu.name} (${gpu.family}) eligible=${DriverPairs.autoEligible(gpu)}")
|
||||
if (gpu.family.mali && !DriverPairs.autoEligible(gpu)) {
|
||||
// No PanVK build covers this Mali (e.g. the G1 series, arch v14): the phone's own driver.
|
||||
autoStatus = useMaliFallback(null)
|
||||
refreshDrivers()
|
||||
return
|
||||
}
|
||||
if (DriverPairs.recommendedKey(gpu, emptyList()) == null) {
|
||||
if (!DriverPairs.autoEligible(gpu)) {
|
||||
autoStatus = activity.getString(R.string.drivers_none_to_set, gpu.supportText(activity, com.droiddeck.launcher.core.DeviceSupport.vkBridge(activity)).lowercase())
|
||||
return
|
||||
}
|
||||
@@ -372,7 +372,11 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
}
|
||||
gpu.family == GpuInfo.Family.POWERVR && (pair == null || !pair.complete) -> {
|
||||
// RADV is not published right now: the Xclipse falls back to the system route.
|
||||
SessionPrefs.ensurePowerVrAutoDrivers(activity)
|
||||
if (gpu.name.contains("Xclipse", ignoreCase = true) && DriverPairs.xclipseNeedsUpstream(gpu.name)) {
|
||||
if (!SessionState.running) SessionPrefs.ensurePowerVrAutoDrivers(activity, powerVr = true, autoOwnedOnly = true)
|
||||
} else {
|
||||
SessionPrefs.ensurePowerVrAutoDrivers(activity)
|
||||
}
|
||||
autoStatus = activity.getString(R.string.drivers_powervr_builtin)
|
||||
refreshDrivers()
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ object DriverPairs {
|
||||
/** RADV-Xclipse rebased on JimVulkan's upstream: a manual choice, never Auto. */
|
||||
const val NAD_RADV_XCLIPSE_UPSTREAM = "nad:radv-xclipse-upstream"
|
||||
private val XCLIPSE_MODEL = Regex("""(?i)xclipse\s*(\d{3})\b""")
|
||||
private val SUPPORTED_XCLIPSE_MODELS = setOf("530", "920", "940")
|
||||
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"
|
||||
@@ -112,9 +113,12 @@ object DriverPairs {
|
||||
}
|
||||
}
|
||||
|
||||
/** 950 and 960 panic on the older build; a name without a model number is treated the same way. */
|
||||
private fun xclipseNeedsUpstream(name: String): Boolean =
|
||||
XCLIPSE_MODEL.find(name)?.groupValues?.get(1).let { it == null || it == "950" || it == "960" }
|
||||
internal fun xclipseNeedsUpstream(name: String): Boolean =
|
||||
XCLIPSE_MODEL.find(name)?.groupValues?.get(1) !in SUPPORTED_XCLIPSE_MODELS
|
||||
|
||||
fun autoEligible(gpu: GpuInfo, sdk: Int = android.os.Build.VERSION.SDK_INT): Boolean =
|
||||
recommendedKey(gpu, emptyList(), sdk = sdk) != null ||
|
||||
(gpu.family == Family.POWERVR && gpu.name.contains("Xclipse", ignoreCase = true))
|
||||
|
||||
fun recommendedKey(
|
||||
gpu: GpuInfo, pairs: List<DriverPair>,
|
||||
@@ -125,6 +129,7 @@ object DriverPairs {
|
||||
Family.POWERVR -> return when {
|
||||
!gpu.name.contains("Xclipse", ignoreCase = true) -> null
|
||||
xclipseNeedsUpstream(gpu.name) && pairs.any { it.key == NAD_RADV_XCLIPSE_UPSTREAM } -> NAD_RADV_XCLIPSE_UPSTREAM
|
||||
xclipseNeedsUpstream(gpu.name) -> null
|
||||
else -> NAD_RADV_XCLIPSE
|
||||
}
|
||||
Family.MALI_OTHER, Family.NOT_ADRENO -> return null
|
||||
|
||||
@@ -118,9 +118,7 @@ data class GpuInfo(
|
||||
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
|
||||
}
|
||||
family == Family.POWERVR -> systemDriverName(SystemVulkanDriver.gpuName(), VulkanInfo.cachedOrNull())
|
||||
mali != null && mali.isNotEmpty() -> mali
|
||||
!adreno -> Build.HARDWARE.ifBlank { UNNAMED }
|
||||
model > 0 -> "Adreno $model"
|
||||
@@ -134,6 +132,9 @@ data class GpuInfo(
|
||||
)
|
||||
}
|
||||
|
||||
fun systemDriverName(gpu: String, vulkan: Map<String, String>?): String =
|
||||
vulkan?.get("device")?.takeIf { it.contains(gpu, ignoreCase = true) } ?: gpu
|
||||
|
||||
internal fun verifiedOn(model: Int, device: String): Boolean =
|
||||
model == 722 && device.equals("Retroid Pocket Duo", ignoreCase = true)
|
||||
|
||||
|
||||
@@ -697,14 +697,42 @@ object SessionPrefs {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun ensurePowerVrAutoDrivers(context: Context) {
|
||||
if (com.droiddeck.launcher.core.DeviceSupport.openDriverActive(context)) return
|
||||
ensurePowerVrAutoDrivers(context, SystemVulkanDriver.isPowerVr())
|
||||
fun ensurePowerVrAutoDrivers(context: Context) = reconcilePowerVrAutoDrivers(
|
||||
context, SystemVulkanDriver.isPowerVr(), SystemVulkanDriver.isXclipse(),
|
||||
com.droiddeck.launcher.gpu.VulkanInfo::cachedOrNull,
|
||||
)
|
||||
|
||||
fun ensurePowerVrAutoDriversAfterGpuQuery(context: Context) = reconcilePowerVrAutoDrivers(
|
||||
context, SystemVulkanDriver.isPowerVr(), SystemVulkanDriver.isXclipse(),
|
||||
com.droiddeck.launcher.gpu.VulkanInfo::query,
|
||||
)
|
||||
|
||||
internal fun reconcilePowerVrAutoDrivers(
|
||||
context: Context, powerVr: Boolean, xclipse: Boolean, vulkan: () -> Map<String, String>?,
|
||||
) {
|
||||
val device = if (xclipse) vulkan() ?: return else null
|
||||
val unsupported = unsupportedXclipse(xclipse) {
|
||||
com.droiddeck.launcher.gpu.GpuInfo.systemDriverName(SystemVulkanDriver.gpuName(), device)
|
||||
}
|
||||
val activeKey = com.droiddeck.launcher.gpu.DriverBundle.active(context)
|
||||
?.id
|
||||
?.let(com.droiddeck.launcher.gpu.DriverPairs::nonAdreno)
|
||||
val upstreamBundle = activeKey == com.droiddeck.launcher.gpu.DriverPairs.NAD_RADV_XCLIPSE_UPSTREAM ||
|
||||
(activeKey != null && activeKey.startsWith("${com.droiddeck.launcher.gpu.DriverPairs.NAD_RADV_XCLIPSE_UPSTREAM}-"))
|
||||
if (com.droiddeck.launcher.core.DeviceSupport.openDriverActive(context) && (!unsupported || upstreamBundle)) return
|
||||
ensurePowerVrAutoDrivers(context, powerVr, unsupported)
|
||||
}
|
||||
|
||||
internal fun ensurePowerVrAutoDrivers(context: Context, powerVr: Boolean) {
|
||||
internal fun unsupportedXclipse(xclipse: Boolean, gpuName: () -> String): Boolean =
|
||||
xclipse && com.droiddeck.launcher.gpu.DriverPairs.xclipseNeedsUpstream(gpuName())
|
||||
|
||||
internal fun ensurePowerVrAutoDrivers(context: Context, powerVr: Boolean, autoOwnedOnly: Boolean = false) {
|
||||
if (!powerVr || gpuDriverMode(context) != GPU_DRIVERS_AUTO) return
|
||||
prefs(context).edit().putString("linuxDriver", "").putString("androidDriver", TurnipDriver.AUTO).apply()
|
||||
val owned = gpuAutoInstalled(context)
|
||||
val edit = prefs(context).edit()
|
||||
if (!autoOwnedOnly || linuxDriver(context) in owned) edit.putString("linuxDriver", "")
|
||||
if (!autoOwnedOnly || androidDriver(context) in owned) edit.putString("androidDriver", TurnipDriver.AUTO)
|
||||
edit.apply()
|
||||
}
|
||||
|
||||
fun gpuAutoInstalled(context: Context): Set<String> =
|
||||
|
||||
@@ -497,7 +497,7 @@ class SessionService : Service() {
|
||||
|
||||
|
||||
private fun runSession(gen: Int) {
|
||||
SessionPrefs.ensurePowerVrAutoDrivers(this)
|
||||
SessionPrefs.ensurePowerVrAutoDriversAfterGpuQuery(this)
|
||||
if (!com.droiddeck.launcher.core.DeviceSupport.adreno()) {
|
||||
com.droiddeck.launcher.gpu.VulkanInfo.query()["api"]?.let { SessionPrefs.setHostVulkanApi(this, it) }
|
||||
if (SessionPrefs.venus(this)) VenusComponent.hostVulkanTooOld(this)?.let {
|
||||
|
||||
Reference in new issue
Block a user