Add experimental Quest 2 and Adreno 6xx display-driver support (#676)

This commit is contained in:
Jagger15 authored and GitHub committed 2026-10-13 14:16:20 -04:00
1 parent 249ab44533
commit 6de6ec821c
8 files changed
+171 -12

No files matched your search

@@ -1349,6 +1349,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
// Turnip, not the system Adreno driver: importing the dma-bufs gamescope commits needs
// VK_EXT_image_drm_format_modifier, which the system driver does not implement.
val turnip = TurnipDriver(this)
com.droiddeck.launcher.gpu.DriverSetupLog.write(this, "surface.driver-setup")
val driverId = if (CompositorHost.isStarted) null else turnip.install()
// The output size belongs to the session, not to the Surface: gamescope's display is
@@ -1417,6 +1418,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
)
Log.i(TAG, "hdr: " + (if (on) "on" else if (wanted) "wanted but ${probe.reason}" else "off") + " · display ${probe.formats.ifEmpty { "SDR" }}")
}
com.droiddeck.launcher.gpu.DriverSetupLog.write(this, "compositor.start driver=$driverId")
CompositorHost.startOrAttach(
holder.surface, runtimeDir.path,
driverId?.let { turnip.driverPath(it) }, driverId?.let { turnip.libraryName(it) },
@@ -0,0 +1,30 @@
package com.droiddeck.launcher.gpu;
import android.content.Context;
import android.util.Log;
import java.io.File;
import java.io.FileWriter;
/** Setup breadcrumbs survive failures before a session log exists. No account data. */
public final class DriverSetupLog {
private DriverSetupLog() {}
public static synchronized void write(Context context, String stage) {
Log.i("DriverSetup", stage);
append(context.getFilesDir(), stage);
try { append(context.getExternalFilesDir(null), stage); }
catch (Exception ignored) { /* External storage is optional. */ }
}
private static void append(File directory, String stage) {
if (directory == null) return;
try {
directory.mkdirs();
File file = new File(directory, "driver-setup.txt");
// Keep the latest run's breadcrumbs bounded across repeated attempts.
try (FileWriter out = new FileWriter(file, file.length() < 131072)) {
out.write(System.currentTimeMillis() + " " + stage + "\n");
}
} catch (Exception ignored) { /* Diagnostics must never prevent startup. */ }
}
}
@@ -45,13 +45,16 @@ import java.util.zip.ZipInputStream;
*/
public final class TurnipDriver {
private static final String TAG = "TurnipDriver";
/** Pinned A6xx/A7xx upstream build; used as the A6xx offline fallback. */
private static final String DRIVER_A6XX = "turnip26.3.0-a6xx";
/** Adreno 7xx (8 Gen 2/3, e.g. the Pocket FIT's A750). */
private static final String DRIVER_A7XX = "turnip25.1.0";
/** Adreno 8xx (8 Elite, e.g. a Fold 8's A830). */
private static final String DRIVER_A8XX = "turnip-sdk36";
/** The two the apk carries; never removable, unpacked on demand. */
public static final List<String> BUNDLED = Collections.unmodifiableList(Arrays.asList(
DRIVER_A7XX, DRIVER_A8XX, com.droiddeck.launcher.session.QuestExperimental.DRIVER));
DRIVER_A7XX, DRIVER_A8XX, com.droiddeck.launcher.session.QuestExperimental.DRIVER,
DRIVER_A6XX, com.droiddeck.launcher.session.QuestExperimental.DRIVER_A6XX));
/** Overrides the pick, for a device we cannot reach: a7xx, a8xx or system. */
private static final String OVERRIDE_FILE = "Download/droiddeck-driver";
/** Bundled drivers the user deleted: hidden from the list, their unpacked copy removed. */
@@ -289,12 +292,14 @@ public final class TurnipDriver {
*/
public String install() {
String id = choose();
DriverSetupLog.write(context, "install.begin driver=" + id);
if (id == null) return null;
File dir = new File(contentDir, id);
if (!new File(dir, "meta.json").isFile()) {
FileUtils.delete(dir);
if (!TarZst.extractAsset(context, "graphics_driver/adrenotools-" + id + ".tzst", dir)) {
Log.e(TAG, "could not unpack " + id);
DriverSetupLog.write(context, "install.unpack-failed driver=" + id);
FileUtils.delete(dir);
return null;
}
@@ -305,6 +310,7 @@ public final class TurnipDriver {
return null;
}
Log.i(TAG, "graphics driver " + id + " (" + library + ")");
DriverSetupLog.write(context, "install.ready driver=" + id + " library=" + library);
return id;
}
@@ -338,6 +344,7 @@ public final class TurnipDriver {
if (forced.startsWith("system")) return null;
if (forced.startsWith("a8")) return DRIVER_A8XX;
if (forced.startsWith("a7")) return DRIVER_A7XX;
if (forced.startsWith("a6")) return DRIVER_A6XX;
}
String model = gpuModel();
Log.i(TAG, "gpu model: " + (model == null ? "unknown" : model));
@@ -348,6 +355,7 @@ public final class TurnipDriver {
char generation = m.group(1).charAt(0);
if (generation >= '8') return DRIVER_A8XX;
if (generation == '7') return DRIVER_A7XX;
if (generation == '6') return DRIVER_A6XX;
}
}
// Nothing to go on: Android 16 shipped with the 8 Elite, so treat a new device as 8xx.
@@ -10,29 +10,36 @@ import java.io.File
object QuestExperimental {
private const val TAG = "QuestExperimental"
const val DRIVER = "turnip25.1.0-quest1"
const val DRIVER_A6XX = "turnip26.3.0-quest2"
internal fun quest2(model: String, device: String, manufacturer: String): Boolean =
model.equals("Quest 2", ignoreCase = true) ||
((manufacturer.equals("Oculus", ignoreCase = true) || manufacturer.equals("Meta", ignoreCase = true)) &&
device == "hollywood")
// Quest 2 has an A6xx GPU and cannot use this bundled A7xx driver.
internal fun supported(model: String, device: String, manufacturer: String): Boolean =
model.equals("Quest 3", ignoreCase = true) || model.equals("Quest 3S", ignoreCase = true) ||
quest2(model, device, manufacturer) || model.equals("Quest 3", ignoreCase = true) || model.equals("Quest 3S", ignoreCase = true) ||
((manufacturer.equals("Oculus", ignoreCase = true) || manufacturer.equals("Meta", ignoreCase = true)) &&
(device == "eureka" || device == "panther"))
fun isSupported(): Boolean = supported(Build.MODEL, Build.DEVICE, Build.MANUFACTURER)
fun isQuest2(): Boolean = quest2(Build.MODEL, Build.DEVICE, Build.MANUFACTURER)
fun initialize(context: Context) {
if (!isSupported()) return
val prefs = context.getSharedPreferences("session", Context.MODE_PRIVATE)
if (!prefs.getBoolean("questDefaultsV1", false)) {
val defaultsKey = if (isQuest2()) "quest2DefaultsV1" else "questDefaultsV1"
if (!prefs.getBoolean(defaultsKey, false)) {
// Auto would download an unwrapped display driver and lose the compatibility path.
// Apply once so deliberate changes made during headset testing remain possible.
prefs.edit()
.putString("gpuDriverMode", SessionPrefs.GPU_DRIVERS_MANUAL)
.putString("androidDriver", DRIVER)
.putString("androidDriver", if (isQuest2()) DRIVER_A6XX else DRIVER)
.putString("linuxDriver", "")
// The existing HDR option uses SurfaceControl presentation. This is a
// corruption workaround from upstream issue #245, not a claim of HDR accuracy.
.putBoolean("hdr.steam", true)
.putBoolean("questDefaultsV1", true)
.putBoolean(defaultsKey, true)
.apply()
}
val report = buildString {
@@ -51,7 +58,7 @@ object QuestExperimental {
appendLine("androidDriver=${SessionPrefs.androidDriver(context)}")
appendLine("steamSurfaceControlWorkaround=${SessionPrefs.hdr(context, "steam")}")
appendLine("GPUOBJ fallback installed in Android driver and ARM64 libblsession")
appendLine("Experimental Quest 3/3S compatibility; 2D panel application")
appendLine("Experimental Quest 2/3/3S compatibility; 2D panel application")
}
Log.i(TAG, report)
runCatching { File(context.filesDir, "quest-startup.txt").writeText(report) }