fix(drivers): never load a KGSL-only display driver on a GPU without KGSL, and report the drivers actually in use (#2588)

* fix(drivers): never load a KGSL-only display driver on a GPU without KGSL, and report the drivers actually in use

* fix(drivers): gate KGSL-only drivers on the KGSL kernel node, not Adreno detection
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-15 09:36:47 -05:00
1 parent 1570d4457c
commit b424bfa353
5 files changed
+96 -7

No files matched your search

@@ -145,16 +145,22 @@ object DeviceInfo {
private fun drivers(context: Context, gpu: GpuInfo) = Section("Drivers DroidDeck uses", buildList<Pair<String, String>> {
add("Driver mode", SessionPrefs.gpuDriverMode(context))
val turnip = TurnipDriver(context)
val choice = SessionPrefs.androidDriver(context).ifEmpty { turnip.autoId() }
val choice = turnip.effectiveId()
val powerVr = gpu.family == GpuInfo.Family.POWERVR
add("Display driver", if (choice == "system") builtinDriverLabel(powerVr, runtime = false)
else "${turnip.displayName(choice)} ${turnip.driverVersion(choice)}".trim())
val linux = LinuxVulkanDriverManager(context)
val id = SessionPrefs.linuxDriver(context)
add("Game driver", if (id.isEmpty()) builtinDriverLabel(powerVr, runtime = true) else "${linux.getDriverName(id)} ${linux.getDriverVersion(id)}".trim())
add("Game driver", hostRoute(context) ?: if (id.isEmpty()) builtinDriverLabel(powerVr, runtime = true) else "${linux.getDriverName(id)} ${linux.getDriverVersion(id)}".trim())
if (gpu.oneUi8Gen2) add("Note", "One UI on an 8 Gen 2: needs the OneUI Turnip build")
})
internal fun hostRoute(context: Context): String? = when {
com.droiddeck.launcher.session.VenusComponent.wanted(context) -> "Mali (Venus)"
com.droiddeck.launcher.core.DeviceSupport.vkBridge(context) -> "the Mali bridge"
else -> null
}
/** Shared by the device card and the session report, which are written in English. */
internal fun builtinDriverLabel(powerVr: Boolean, runtime: Boolean): String = when {
powerVr -> "System PowerVR"
@@ -34,6 +34,8 @@ public final class TurnipDriver {
public static final List<String> BUNDLED = Collections.unmodifiableList(Arrays.asList(
DRIVER_A7XX, DRIVER_A8XX, com.droiddeck.launcher.session.QuestExperimental.DRIVER,
DRIVER_A6XX, com.droiddeck.launcher.session.QuestExperimental.DRIVER_A6XX));
private static final String KGSL_NODE = "/dev/kgsl-3d0";
private static final String KGSL_SYSFS = "/sys/class/kgsl/kgsl-3d0";
private static final String OVERRIDE_FILE = "Download/droiddeck-driver";
private static final String PREFS = "graphics_driver";
private static final String KEY_HIDDEN = "hiddenBundled";
@@ -140,6 +142,25 @@ public final class TurnipDriver {
return id == null ? "system" : id;
}
public String effectiveId() {
String id = choose();
return id == null || !reachesGpu(id) ? "system" : id;
}
public boolean reachesGpu(String driverId) {
String library = libraryName(driverId);
return library == null || !needsMissingKgsl(new File(new File(contentDir, driverId), library),
kgslPresent(new File(KGSL_NODE), new File(KGSL_SYSFS)));
}
static boolean kgslPresent(File node, File sysfs) {
return node.exists() || sysfs.exists();
}
static boolean needsMissingKgsl(File library, boolean kgsl) {
return !kgsl && library.isFile() && LinuxVulkanDriverManager.containsAscii(library, KGSL_NODE);
}
public void remove(String driverId) {
if (driverId == null || driverId.isEmpty() || BUNDLED.contains(driverId)
|| driverId.contains("/") || driverId.contains("..")) return;
@@ -257,6 +278,11 @@ public final class TurnipDriver {
Log.e(TAG, id + " unpacked without " + library);
return null;
}
if (!reachesGpu(id)) {
Log.w(TAG, id + " needs " + KGSL_NODE + ", which this GPU does not have; display on the system Vulkan loader");
DriverSetupLog.write(context, "install.no-kgsl driver=" + id);
return null;
}
Log.i(TAG, "graphics driver " + id + " (" + library + ")");
DriverSetupLog.write(context, "install.ready driver=" + id + " library=" + library);
return id;