fix: reduce flickering on thor and a7xx: match the A740 TP UBWC flag hint to the system driver so Android UI stops flickering (#963)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-16 13:37:28 -04:00
1 parent 3f3ed3923b
commit 5e57d78b5d
4 files changed
+64

No files matched your search

@@ -0,0 +1,36 @@
package com.droiddeck.launcher.gpu
import android.util.Log
object TpUbwcHint {
const val ENV = "FD_DEV_FEATURES"
private const val TAG = "TpUbwcHint"
@Volatile private var resolved = false
@Volatile private var cached: String? = null
// On Adreno 740, TPL1_DBG_ECO_CNTL1.TP_UBWC_FLAG_HINT is shared by every driver on the GPU and must
// match the system driver: blob v6xx leaves it off, newer blobs set it. A mismatch corrupts Android UI.
internal fun features(model: Int, systemDriverVersion: String?): String? {
if (model != 740) return null
val blob = systemDriverVersion?.split('.')?.getOrNull(1)?.toIntOrNull() ?: return null
return "enable_tp_ubwc_flag_hint=" + if (blob >= 700) "1" else "0"
}
@Synchronized
fun forThisDevice(): String? {
if (resolved) return cached
val model = GpuInfo.detect().model
val version = if (model == 740) VulkanInfo.query()["driver_version"] else null
cached = features(model, version)
resolved = true
Log.i(TAG, "Adreno $model, system driver ${version ?: "n/a"}: ${cached ?: "driver default"}")
return cached
}
fun applyToProcess() {
val value = forThisDevice() ?: return
runCatching { android.system.Os.setenv(ENV, value, true) }
.onFailure { Log.w(TAG, "setenv $ENV failed: ${it.javaClass.simpleName}") }
}
}
@@ -292,6 +292,7 @@ class SessionService : Service() {
private fun runSession(gen: Int) {
SessionTerminal.clear()
com.droiddeck.launcher.gpu.TpUbwcHint.forThisDevice()
try {
LinuxRuntime.writeAccounts(this)
} catch (e: Exception) {
@@ -540,6 +541,7 @@ class SessionService : Service() {
LinuxVulkanDriver.resolveIcdPath(this, linuxDriverId)
?.let { guest.add(LinuxVulkanDriver.ENV + "=" + it) }
tuDebug(linuxDriverId)?.let { guest.add("TU_DEBUG=$it") }
com.droiddeck.launcher.gpu.TpUbwcHint.forThisDevice()?.let { guest.add("${com.droiddeck.launcher.gpu.TpUbwcHint.ENV}=$it") }
if (SessionPrefs.zinkLazy(this)) {
guest.add("ZINK_DESCRIPTORS=lazy")
guest.add("ZINK_DEBUG=compact")
@@ -38,6 +38,7 @@ object CompositorHost {
return false
}
WaylandCompositor.nativeSetOutputRefreshRate(refreshHz)
com.droiddeck.launcher.gpu.TpUbwcHint.applyToProcess()
WaylandCompositor.nativeStartWithSurface(
surface, xdgRuntimeDir, driverPath, libraryName, nativeLibDir,
)