diff --git a/README.md b/README.md index a94e837d5c..ad25b36220 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,24 @@ installs a requested build when the next session starts (several hundred MB), pa pressure-vessel like Valve's, and it then appears in Steam under Properties → Compatibility for any game. The dialog queues or cancels a request and removes an installed build. +## Graphics drivers + +Two drivers, two lists, because a zip for one cannot serve the other — the same split Bannerlator's +Contents screen makes: + +- **Linux runtime driver** — the glibc Turnip everything *inside* the runtime renders on: the Steam + client's UI, every game it launches, and in desktop mode every program on the desktop. Import a + "-Linux" Turnip zip from Banners-Turnip; a plain Android or "-Wayland" Turnip is refused with the + reason, since a Linux process cannot load a bionic library. The choice is per mode, so Steam and + the desktop can run different builds, and it takes effect at the next session start. Nothing in + the runtime is modified: the session is handed the imported driver's ICD manifest and points the + Vulkan loader at it, and the runtime's own Turnip is what a removed or unreadable import falls + back to. This is how a driver fix reaches an installed runtime without a ~790 MB re-download. +- **Display driver (Android)** — the bionic Turnip the app's compositor puts the frame on the panel + with, the last step of every session. *Auto* picks one of the two bundled builds by GPU; an + imported AdrenoTools zip can be chosen instead. The compositor loads its driver once per app + process, so this one applies after the app is fully closed and started again. + ## Frame generation Extra frames are generated between the real ones on the way to the screen — inside the app's diff --git a/app/src/main/java/com/steamdeck/launcher/MainActivity.kt b/app/src/main/java/com/steamdeck/launcher/MainActivity.kt index 3f894964bb..29d57cf9d1 100644 --- a/app/src/main/java/com/steamdeck/launcher/MainActivity.kt +++ b/app/src/main/java/com/steamdeck/launcher/MainActivity.kt @@ -3,18 +3,24 @@ package com.steamdeck.launcher import android.Manifest import android.content.Intent import android.content.pm.PackageManager +import android.net.Uri +import android.provider.OpenableColumns import android.os.Bundle import android.os.Handler import android.os.Looper import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import com.steamdeck.launcher.core.FileUtils import com.steamdeck.launcher.gpu.FrameGen +import com.steamdeck.launcher.gpu.LinuxVulkanDriver +import com.steamdeck.launcher.gpu.LinuxVulkanDriverManager +import com.steamdeck.launcher.gpu.TurnipDriver import com.steamdeck.launcher.gpu.LsfgNative import com.steamdeck.launcher.runtime.LinuxRuntime import com.steamdeck.launcher.runtime.DesktopCatalog @@ -24,8 +30,11 @@ import com.steamdeck.launcher.ui.DesktopAppsDialog import com.steamdeck.launcher.ui.PackageRow import com.steamdeck.launcher.session.OfflineMode import com.steamdeck.launcher.session.ProtonExtras +import com.steamdeck.launcher.session.SessionPrefs import com.steamdeck.launcher.ui.ProtonDialog import com.steamdeck.launcher.ui.ProtonRow +import com.steamdeck.launcher.ui.DriverDialog +import com.steamdeck.launcher.ui.DriverRow import com.steamdeck.launcher.ui.ConfirmDialog import com.steamdeck.launcher.ui.CreditsDialog import com.steamdeck.launcher.ui.FrameGenDialog @@ -63,6 +72,21 @@ class MainActivity : ComponentActivity() { private var offlineAccount by mutableStateOf(null) private var offline by mutableStateOf(false) private var protonRows by mutableStateOf>(emptyList()) + private var showDrivers by mutableStateOf(false) + private var linuxRows by mutableStateOf>(emptyList()) + private var linuxSteam by mutableStateOf("") + private var linuxDesktop by mutableStateOf("") + private var androidRows by mutableStateOf>(emptyList()) + private var androidSelected by mutableStateOf("") + + // The system file picker, once per driver list: the two lists validate differently, and the + // reason a zip is refused names the list it belongs in. + private val pickLinuxDriver = registerForActivityResult(ActivityResultContracts.OpenDocument()) { uri -> + if (uri != null) importDriver(uri, linux = true) + } + private val pickAndroidDriver = registerForActivityResult(ActivityResultContracts.OpenDocument()) { uri -> + if (uri != null) importDriver(uri, linux = false) + } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -91,6 +115,7 @@ class MainActivity : ComponentActivity() { onRuntime = { onRuntimeButton() }, onFrameGen = { showFrameGen = true }, onProtons = { refreshProtons(); showProtons = true }, + onDrivers = { refreshDrivers(); showDrivers = true }, onCredits = { showCredits = true }, ) if (showApps) DesktopAppsDialog( @@ -106,6 +131,17 @@ class MainActivity : ComponentActivity() { onRemove = { id -> ProtonExtras.tools.first { it.id == id }.let { ProtonExtras.remove(this, it) }; refreshProtons() }, onDismiss = { showProtons = false }, ) + if (showDrivers) DriverDialog( + linuxRows = linuxRows, linuxSteam = linuxSteam, linuxDesktop = linuxDesktop, + androidRows = androidRows, androidSelected = androidSelected, + onSelectLinux = { mode, id -> SessionPrefs.setLinuxDriver(this, mode, id); refreshDrivers() }, + onImportLinux = { pickLinuxDriver.launch(ZIP_TYPES) }, + onRemoveLinux = { id -> LinuxVulkanDriverManager(this).removeDriver(id); refreshDrivers() }, + onSelectAndroid = { id -> SessionPrefs.setAndroidDriver(this, id); refreshDrivers() }, + onImportAndroid = { pickAndroidDriver.launch(ZIP_TYPES) }, + onRemoveAndroid = { id -> TurnipDriver(this).remove(id); refreshDrivers() }, + onDismiss = { showDrivers = false }, + ) if (showRemove) ConfirmDialog( title = "Remove Linux runtime", text = "This deletes the runtime, the Steam client inside it, and every game installed there.", @@ -174,6 +210,70 @@ class MainActivity : ComponentActivity() { }, "install-pkg").start() } + /** Both driver lists as the dialog shows them, re-read from disk so an import or removal shows at once. */ + private fun refreshDrivers() { + val lm = LinuxVulkanDriverManager(this) + linuxRows = LinuxVulkanDriver.optionValues(this).map { id -> + if (id.isEmpty()) DriverRow("", "Runtime default", "the Turnip built into the runtime", false) + else DriverRow( + id, lm.getDriverName(id), + listOfNotNull( + lm.getDriverVersion(id).takeIf { it.isNotEmpty() }, + lm.getMinGlibc(id).takeIf { it.isNotEmpty() }?.let { "glibc $it+" }, + ).joinToString(" · ").ifEmpty { "imported" }, + true, + ) + } + linuxSteam = SessionPrefs.linuxDriver(this, SessionService.MODE_STEAM) + linuxDesktop = SessionPrefs.linuxDriver(this, SessionService.MODE_DESKTOP) + val td = TurnipDriver(this) + val auto = td.autoId() + androidRows = buildList { + add(DriverRow( + TurnipDriver.AUTO, "Auto — picked by GPU", + if (auto == "system") "system Vulkan: no bundled build for this GPU" else "${td.displayName(auto)} (bundled)", + false, + )) + for (id in TurnipDriver.BUNDLED) add(DriverRow(id, td.displayName(id), "bundled" + td.driverVersion(id).let { if (it.isEmpty()) "" else " · $it" }, false)) + for (id in td.enumerateImported()) add(DriverRow(id, td.displayName(id), "imported" + td.driverVersion(id).let { if (it.isEmpty()) "" else " · $it" }, true)) + } + androidSelected = SessionPrefs.androidDriver(this) + } + + /** + * Import off the main thread — a driver zip is a few MB and the glibc check reads the whole + * library — then say what happened. A refusal's message is the user-facing reason. + */ + private fun importDriver(uri: Uri, linux: Boolean) { + val name = displayNameOf(uri) + Thread({ + val problem = try { + if (linux) LinuxVulkanDriverManager(this).installDriver(uri, name) + else TurnipDriver(this).installFromZip(uri, name) + null + } catch (e: IllegalArgumentException) { + e.message + } catch (e: Exception) { + Log.w(TAG, "driver import", e) + "Import failed: ${e.message}" + } + ui.post { + android.widget.Toast.makeText( + this, problem ?: "Imported ${name ?: "driver"}", + if (problem != null) android.widget.Toast.LENGTH_LONG else android.widget.Toast.LENGTH_SHORT, + ).show() + refreshDrivers() + } + }, "import-driver").start() + } + + private fun displayNameOf(uri: Uri): String? = try { + contentResolver.query(uri, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null) + ?.use { c -> if (c.moveToFirst()) c.getString(0) else null } + } catch (e: Exception) { + null + } + private fun refreshProtons() { protonRows = ProtonExtras.tools.map { ProtonRow(it.id, it.name, ProtonExtras.installed(this, it), ProtonExtras.queued(this, it)) } } @@ -227,5 +327,7 @@ class MainActivity : ComponentActivity() { companion object { private const val TAG = "MainActivity" + /** What the picker offers for a driver zip; some file apps label a zip as a plain stream. */ + private val ZIP_TYPES = arrayOf("application/zip", "application/octet-stream") } } diff --git a/app/src/main/java/com/steamdeck/launcher/gpu/LinuxVulkanDriver.java b/app/src/main/java/com/steamdeck/launcher/gpu/LinuxVulkanDriver.java new file mode 100644 index 0000000000..b076535d92 --- /dev/null +++ b/app/src/main/java/com/steamdeck/launcher/gpu/LinuxVulkanDriver.java @@ -0,0 +1,76 @@ +package com.steamdeck.launcher.gpu; + +import android.content.Context; +import android.util.Log; + +import java.util.ArrayList; +import java.util.List; + +/** + * The Vulkan driver a session draws with inside the runtime: in Steam mode the native client's + * own UI (OpenGL through the runtime's Zink), every game it launches (D3D through Proton's + * DXVK/VKD3D) and gamescope's compositing; in desktop mode every program on the desktop. One + * choice per mode covers all of it. + * + *

Distinct from the Android driver the app's compositor loads to put the finished frame on the + * screen ({@link TurnipDriver}), which every session ends in — and NOT interchangeable with it: + * these are glibc processes, that one is bionic. + * + *

"" (the default) means the driver the runtime was built with, at + * {@code usr/lib/libvulkan_freedreno.so} inside it — nothing is set and nothing is touched. + * Otherwise the value is an imported driver's id ({@link LinuxVulkanDriverManager}), and the + * session is handed that driver's ICD manifest in {@code BL_VK_DRIVER}: the session script points + * the Vulkan loader at it with {@code VK_DRIVER_FILES} after checking both the manifest and the + * library are readable from inside, so the runtime itself is never modified and the choice is + * reversible. Ported from Bannerlator's {@code LinuxVulkanDriver} (GPL-3.0); the choice lives in + * {@code SessionPrefs} per mode here rather than on a shortcut. + */ +public final class LinuxVulkanDriver { + private static final String TAG = "LinuxVulkanDriver"; + /** Env var the session reads; its value is an absolute ICD manifest path. */ + public static final String ENV = "BL_VK_DRIVER"; + + public static final String HELP_TEXT = + "The driver the Steam client, the games it launches and the desktop's programs render on, " + + "inside the Linux runtime. Imported \"-Linux\" Turnip zips only: these are Linux processes " + + "and cannot load an Android or Wayland driver. Frames still reach the screen through the " + + "display driver below. Takes effect at the next session start."; + + private LinuxVulkanDriver() {} + + /** Stored values in editor order: the runtime's own driver, then each imported one. */ + public static List optionValues(Context context) { + ArrayList values = new ArrayList<>(); + values.add(""); + values.addAll(new LinuxVulkanDriverManager(context).enumerateInstalledDrivers()); + return values; + } + + /** + * Label for a stored value. An id that is no longer installed says so — the launch path falls + * back to the runtime's own driver for it. + */ + public static String optionLabel(Context context, String value) { + if (value == null || value.isEmpty()) return "Runtime default (built into the runtime)"; + LinuxVulkanDriverManager m = new LinuxVulkanDriverManager(context); + if (!m.isInstalled(value)) return value + " (imported, missing — uses the runtime default)"; + String ver = m.getDriverVersion(value); + return m.getDriverName(value) + (ver.isEmpty() ? "" : " " + ver) + " (imported)"; + } + + /** + * The ICD manifest path to hand the session, or null to leave the runtime's own driver alone. + * An id whose import is gone resolves to null rather than failing the launch. + */ + public static String resolveIcdPath(Context context, String value) { + if (value == null || value.isEmpty()) return null; + LinuxVulkanDriverManager m = new LinuxVulkanDriverManager(context); + String icd = m.getIcdPath(value); + if (icd == null) { + Log.w(TAG, "imported Linux driver \"" + value + "\" is gone; using the runtime's own driver"); + return null; + } + Log.i(TAG, "Linux session draws with imported driver " + value + " (" + icd + ")"); + return icd; + } +} diff --git a/app/src/main/java/com/steamdeck/launcher/gpu/LinuxVulkanDriverManager.java b/app/src/main/java/com/steamdeck/launcher/gpu/LinuxVulkanDriverManager.java new file mode 100644 index 0000000000..0638d9b111 --- /dev/null +++ b/app/src/main/java/com/steamdeck/launcher/gpu/LinuxVulkanDriverManager.java @@ -0,0 +1,288 @@ +package com.steamdeck.launcher.gpu; + +import android.content.Context; +import android.net.Uri; +import android.util.Log; + +import com.steamdeck.launcher.core.FileUtils; + +import org.json.JSONObject; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +/** + * Imported LINUX Vulkan drivers: glibc Turnip ICDs ({@code Turnip-[-variant]-Linux.zip} from + * Banners-Turnip) for the runtime — the gamescope session that runs Valve's native ARM64 Steam + * client, and the labwc desktop beside it. This is the driver that DRAWS there: the client's own UI + * (OpenGL through the runtime's Zink), every game the client launches (D3D through Proton's + * DXVK/VKD3D) and everything on the desktop. Putting the frame on the screen stays the Android + * driver's job, in the app's compositor ({@link TurnipDriver}). + * + *

Not interchangeable with that one: the client and its games are glibc processes and cannot + * load a bionic object at all, and this one cannot be loaded by the app. The check that separates + * them is the libc the driver links against — {@code libc.so.6} here, {@code libc.so} there. + * + *

Layout (under the app's files dir, which the session sees by its full host path): + *

+ *   files/linux_vulkan_drivers/<id>/
+ *       libvulkan_freedreno.so   the driver
+ *       icd.json                 generated Vulkan ICD manifest; library_path = the .so's ABSOLUTE path
+ *       meta.json                name / driverVersion / minGlibc, our own schema
+ * 
+ * The session gets {@code icd.json}'s path in {@code BL_VK_DRIVER} and exports it as + * {@code VK_DRIVER_FILES}, so nothing inside the runtime is modified and the choice is reversible. + * + *

Ported from Bannerlator's {@code LinuxVulkanDriverManager} (GPL-3.0), unchanged in behaviour. + */ +public class LinuxVulkanDriverManager { + private static final String TAG = "LinuxVulkanDriver"; + public static final String DIR_NAME = "linux_vulkan_drivers"; + public static final String LIB_NAME = "libvulkan_freedreno.so"; + public static final String ICD_NAME = "icd.json"; + public static final String META_NAME = "meta.json"; + + private final Context context; + private final File rootDir; + + public LinuxVulkanDriverManager(Context context) { + this.context = context; + this.rootDir = new File(context.getFilesDir(), DIR_NAME); + if (!rootDir.exists()) rootDir.mkdirs(); + } + + public File getDriverDir(String id) { + return new File(rootDir, id); + } + + /** Installed = has the .so AND the generated manifest (a half-extracted dir is never offered). */ + public boolean isInstalled(String id) { + if (id == null || id.isEmpty() || id.contains("/") || id.contains("..")) return false; + File dir = getDriverDir(id); + return new File(dir, LIB_NAME).isFile() && new File(dir, ICD_NAME).isFile(); + } + + /** Absolute path of the driver's ICD manifest, or null when the id isn't installed. */ + public String getIcdPath(String id) { + return isInstalled(id) ? new File(getDriverDir(id), ICD_NAME).getAbsolutePath() : null; + } + + public List enumerateInstalledDrivers() { + ArrayList ids = new ArrayList<>(); + File[] dirs = rootDir.listFiles(); + if (dirs == null) return ids; + for (File d : dirs) if (d.isDirectory() && isInstalled(d.getName())) ids.add(d.getName()); + Collections.sort(ids); + return ids; + } + + private JSONObject readMeta(String id) { + try { + File meta = new File(getDriverDir(id), META_NAME); + if (!meta.isFile()) return null; + return new JSONObject(FileUtils.readString(meta)); + } catch (Exception e) { + return null; + } + } + + public String getDriverName(String id) { + JSONObject m = readMeta(id); + String name = m != null ? m.optString("name", "") : ""; + return name.isEmpty() ? id : name; + } + + public String getDriverVersion(String id) { + JSONObject m = readMeta(id); + return m != null ? m.optString("driverVersion", "") : ""; + } + + /** The glibc the driver asks for, as its zip recorded it ("" when the zip did not say). */ + public String getMinGlibc(String id) { + JSONObject m = readMeta(id); + return m != null ? m.optString("minGlibc", "") : ""; + } + + public void removeDriver(String id) { + if (id == null || id.isEmpty() || id.contains("/") || id.contains("..")) return; + Log.d(TAG, "removing imported Linux Vulkan driver " + id); + FileUtils.delete(getDriverDir(id)); + // A mode still set to this id falls back to the runtime's own driver at launch (logged there). + } + + /** + * Import a {@code -Linux.zip}. Returns the new driver id. + * @throws IllegalArgumentException with a user-facing reason when the zip is not an importable + * Linux driver; {@link IOException} on read/extract failures. + */ + public String installDriver(Uri zipUri, String displayName) throws IOException { + File tmpDir = new File(rootDir, ".tmp-" + System.currentTimeMillis()); + FileUtils.delete(tmpDir); + if (!tmpDir.mkdirs()) throw new IOException("cannot create " + tmpDir); + boolean keep = false; + try { + String soName = null; + JSONObject zipMeta = null; + try (InputStream is = context.getContentResolver().openInputStream(zipUri); + ZipInputStream zis = new ZipInputStream(is)) { + if (is == null) throw new IOException("cannot open " + zipUri); + ZipEntry entry; + while ((entry = zis.getNextEntry()) != null) { + if (entry.isDirectory()) continue; + // 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 + ")"); + else { + Files.copy(zis, new File(tmpDir, LIB_NAME).toPath(), StandardCopyOption.REPLACE_EXISTING); + soName = base; + } + } else if (base.equals(META_NAME)) { + try { + zipMeta = new JSONObject(new String(readAll(zis), StandardCharsets.UTF_8)); + } catch (Exception e) { + Log.w(TAG, "meta.json unreadable, ignoring: " + e.getMessage()); + } + } + // The zip's own freedreno_icd.aarch64.json is dropped on purpose: its + // library_path is relative to itself, and we write an absolute one below. + } + } + if (soName == null) { + throw new IllegalArgumentException("No libvulkan_freedreno*.so in this zip. An Android " + + "(AdrenoTools) or -Wayland Turnip zip is not a Linux runtime driver."); + } + File so = new File(tmpDir, LIB_NAME); + if (!isAarch64Elf(so)) { + throw new IllegalArgumentException(soName + " is not a 64-bit AArch64 ELF shared library."); + } + // The one check that actually separates this from the bionic builds. Both sonames + // are in the driver's .dynstr, so a byte scan is enough and needs no ELF parsing: + // glibc's is versioned ("libc.so.6"), bionic's is not ("libc.so"). + if (!containsAscii(so, "libc.so.6")) { + throw new IllegalArgumentException(soName + " is not a glibc driver — it links Android's libc. " + + "The Linux runtime needs a \"-Linux\" zip; a plain or \"-Wayland\" Turnip cannot be " + + "loaded by the Steam client at all."); + } + String kind = zipMeta != null ? zipMeta.optString("kind", "") : ""; + if (!kind.isEmpty() && !"linux-vulkan-icd".equals(kind)) { + Log.w(TAG, "meta.json says kind=" + kind + ", importing anyway (the binary is glibc)"); + } + + String name = zipMeta != null ? zipMeta.optString("name", "") : ""; + String version = zipMeta != null ? zipMeta.optString("driverVersion", "") : ""; + String minGlibc = zipMeta != null ? zipMeta.optString("minGlibc", "") : ""; + if (name.isEmpty()) { + name = displayName != null ? displayName : "linux-driver"; + if (name.toLowerCase().endsWith(".zip")) name = name.substring(0, name.length() - 4); + } + String id = uniqueId(sanitizeId(name)); + File dir = getDriverDir(id); + + // ICD manifest: absolute library_path, so the loader never depends on cwd and the guest + // reads it at the same path the app wrote (the files dir is bound into the session). + JSONObject icd = new JSONObject(); + icd.put("file_format_version", "1.0.0"); + JSONObject icdBody = new JSONObject(); + icdBody.put("library_path", new File(dir, LIB_NAME).getAbsolutePath()); + icdBody.put("api_version", "1.1.274"); + icd.put("ICD", icdBody); + if (!FileUtils.writeString(new File(tmpDir, ICD_NAME), icd.toString(2))) throw new IOException("cannot write icd.json"); + + JSONObject meta = new JSONObject(); + meta.put("schemaVersion", 1); + meta.put("kind", "linux-vulkan-icd"); + meta.put("name", name); + meta.put("driverVersion", version); + meta.put("libc", "glibc"); + meta.put("minGlibc", minGlibc); + meta.put("sourceLibraryName", soName); + meta.put("importedAt", System.currentTimeMillis()); + if (!FileUtils.writeString(new File(tmpDir, META_NAME), meta.toString(2))) throw new IOException("cannot write meta.json"); + + if (!tmpDir.renameTo(dir)) throw new IOException("cannot move into " + dir); + keep = true; + Log.i(TAG, "imported Linux Vulkan driver " + id + " (" + soName + ", minGlibc=" + minGlibc + ") -> " + dir); + return id; + } catch (org.json.JSONException e) { + throw new IOException("manifest write failed: " + e.getMessage()); + } finally { + if (!keep) FileUtils.delete(tmpDir); + } + } + + private String uniqueId(String base) { + String id = base; + int n = 2; + while (getDriverDir(id).exists()) id = base + "-" + (n++); + return id; + } + + static String sanitizeId(String name) { + String s = name.trim().replaceAll("[^A-Za-z0-9._-]+", "_").replaceAll("^[._]+", ""); + if (s.length() > 64) s = s.substring(0, 64); + return s.isEmpty() ? "linux-driver" : s; + } + + /** ELF magic, EI_CLASS = 64-bit, EI_DATA = little-endian, e_machine = 0xB7 (AArch64). */ + static boolean isAarch64Elf(File f) { + try (FileInputStream in = new FileInputStream(f)) { + byte[] h = new byte[20]; + int n = 0; + while (n < h.length) { + int r = in.read(h, n, h.length - n); + if (r < 0) break; + n += r; + } + if (n < 20) return false; + if (h[0] != 0x7f || h[1] != 'E' || h[2] != 'L' || h[3] != 'F') return false; + if (h[4] != 2 || h[5] != 1) return false; + int machine = (h[18] & 0xff) | ((h[19] & 0xff) << 8); + return machine == 0xB7; + } catch (IOException e) { + return false; + } + } + + private static byte[] readAll(InputStream in) throws IOException { + java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream(); + byte[] buf = new byte[8192]; + int r; + while ((r = in.read(buf)) > 0) bos.write(buf, 0, r); + return bos.toByteArray(); + } + + static boolean containsAscii(File f, String needle) { + byte[] nb = needle.getBytes(StandardCharsets.US_ASCII); + try (InputStream in = new FileInputStream(f)) { + byte[] buf = new byte[1 << 16]; + int carry = 0; + int r; + while ((r = in.read(buf, carry, buf.length - carry)) > 0) { + int len = carry + r; + for (int i = 0; i + nb.length <= len; i++) { + int j = 0; + while (j < nb.length && buf[i + j] == nb[j]) j++; + if (j == nb.length) return true; + } + // Keep the last needle-1 bytes so a match across a buffer boundary is still found. + carry = Math.min(nb.length - 1, len); + System.arraycopy(buf, len - carry, buf, 0, carry); + } + } catch (IOException e) { + return false; + } + return false; + } +} diff --git a/app/src/main/java/com/steamdeck/launcher/gpu/TurnipDriver.java b/app/src/main/java/com/steamdeck/launcher/gpu/TurnipDriver.java index 47ec03acec..0592723f44 100644 --- a/app/src/main/java/com/steamdeck/launcher/gpu/TurnipDriver.java +++ b/app/src/main/java/com/steamdeck/launcher/gpu/TurnipDriver.java @@ -1,24 +1,46 @@ package com.steamdeck.launcher.gpu; import android.content.Context; +import android.net.Uri; import android.os.Environment; import android.util.Log; import com.steamdeck.launcher.core.FileUtils; import com.steamdeck.launcher.core.TarZst; +import com.steamdeck.launcher.session.SessionPrefs; import org.json.JSONObject; import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; /** * The Vulkan driver the in-app compositor runs on. It has to be Turnip: the system Adreno driver * does not implement VK_EXT_image_drm_format_modifier, so importing the dma-bufs gamescope hands * over fails and the session renders nothing. Two builds ship in the apk, one per Adreno - * generation, and the GPU decides which is unpacked. + * generation, and the GPU decides which is unpacked — unless the user has imported an AdrenoTools + * zip of their own and chosen it, which then wins. * - *

The guest's own Turnip is a different copy entirely — a glibc build inside the rootfs, found - * through its ICD manifest. This one is the bionic build the app process loads through adrenotools. + *

The guest's own Turnip is a different copy entirely — a glibc build inside the rootfs, or an + * imported one ({@link LinuxVulkanDriverManager}). This one is the bionic build the app process + * loads through adrenotools, and it is what every session ends in: whatever draws inside the + * runtime, this is the driver that puts the frame on the panel. + * + *

Every driver, bundled or imported, lives under {@code files/graphics_driver//} with a + * {@code meta.json} whose {@code libraryName} names the .so beside it — the AdrenoTools layout. + * The import path is ported from Bannerlator's {@code AdrenotoolsManager} (GPL-3.0), including + * the refusal of zips that belong in the Linux runtime list: a "-Linux" (glibc) Turnip names no + * library on purpose, and installed here it would put the compositor on the system Vulkan — a + * black screen wearing a driver's name. */ public final class TurnipDriver { private static final String TAG = "TurnipDriver"; @@ -26,8 +48,19 @@ public final class TurnipDriver { 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 BUNDLED = Collections.unmodifiableList(Arrays.asList(DRIVER_A7XX, DRIVER_A8XX)); /** Overrides the pick, for a device we cannot reach: a7xx, a8xx or system. */ private static final String OVERRIDE_FILE = "Download/steamdeck-driver"; + /** Stored choice meaning "pick by GPU" — the default, and what a removed import falls back to. */ + public static final String AUTO = ""; + + public static final String HELP_TEXT = + "The driver the app's compositor puts frames on the screen with — the last step of every " + + "session, Steam or desktop. AdrenoTools zips only (vulkan.adXXXX.so): a \"-Linux\" Turnip " + + "belongs in the Linux runtime list above and is refused here. The compositor loads its " + + "driver once per app process, so a change takes effect after the app is fully closed and " + + "started again."; private final Context context; private final File contentDir; @@ -43,17 +76,161 @@ public final class TurnipDriver { } public String libraryName(String driverId) { + JSONObject meta = readMeta(driverId); + return meta != null ? meta.optString("libraryName", null) : null; + } + + /** meta.json's "name", or the id when it has none. */ + public String displayName(String driverId) { + JSONObject meta = readMeta(driverId); + String name = meta != null ? meta.optString("name", "") : ""; + return name.isEmpty() ? driverId : name; + } + + public String driverVersion(String driverId) { + JSONObject meta = readMeta(driverId); + return meta != null ? meta.optString("driverVersion", "") : ""; + } + + private JSONObject readMeta(String driverId) { + if (driverId == null || driverId.isEmpty() || driverId.contains("/") || driverId.contains("..")) return null; File meta = new File(new File(contentDir, driverId), "meta.json"); String content = FileUtils.readString(meta); if (content == null) return null; try { - return new JSONObject(content).optString("libraryName", null); + return new JSONObject(content); } catch (Exception e) { Log.w(TAG, "meta.json for " + driverId, e); return null; } } + /** An imported driver is installed when its meta.json names a library that is there. */ + public boolean isInstalled(String driverId) { + String library = libraryName(driverId); + return library != null && !library.isEmpty() && new File(new File(contentDir, driverId), library).isFile(); + } + + /** Imported drivers only — the bundled two are listed by {@link #BUNDLED}. */ + public List enumerateImported() { + ArrayList ids = new ArrayList<>(); + File[] dirs = contentDir.listFiles(); + if (dirs == null) return ids; + for (File d : dirs) { + String id = d.getName(); + if (d.isDirectory() && !BUNDLED.contains(id) && !id.startsWith(".") && isInstalled(id)) ids.add(id); + } + Collections.sort(ids); + return ids; + } + + /** The bundled build the GPU would pick on its own, for the "Auto" row's label. */ + public String autoId() { + String id = chooseByDevice(); + return id == null ? "system" : id; + } + + public void remove(String driverId) { + if (driverId == null || driverId.isEmpty() || BUNDLED.contains(driverId) + || driverId.contains("/") || driverId.contains("..")) return; + Log.d(TAG, "removing imported driver " + driverId); + FileUtils.delete(new File(contentDir, driverId)); + if (driverId.equals(SessionPrefs.androidDriver(context))) SessionPrefs.setAndroidDriver(context, AUTO); + } + + /** + * Import an AdrenoTools zip. Returns the new driver id. + * @throws IllegalArgumentException with a user-facing reason when the zip is not an AdrenoTools + * driver — including when it is a Linux runtime driver, which says which list it belongs in; + * {@link IOException} on read/extract failures. + */ + public String installFromZip(Uri zipUri, String displayName) throws IOException { + if (!contentDir.exists()) contentDir.mkdirs(); + File tmpDir = new File(contentDir, ".tmp-" + System.currentTimeMillis()); + FileUtils.delete(tmpDir); + if (!tmpDir.mkdirs()) throw new IOException("cannot create " + tmpDir); + boolean keep = false; + try { + try (InputStream is = context.getContentResolver().openInputStream(zipUri); + ZipInputStream zis = new ZipInputStream(is)) { + if (is == null) throw new IOException("cannot open " + zipUri); + ZipEntry entry; + while ((entry = zis.getNextEntry()) != null) { + if (entry.isDirectory()) continue; + // Flatten: adrenotools reads the .so beside meta.json, and a base name also + // defeats zip-slip paths. + String base = new File(entry.getName()).getName(); + if (base.isEmpty()) continue; + Files.copy(zis, new File(tmpDir, base).toPath(), StandardCopyOption.REPLACE_EXISTING); + } + } + String rejected = rejectionReason(tmpDir); + if (rejected != null) throw new IllegalArgumentException("Not an AdrenoTools driver: " + rejected); + + JSONObject meta = readMetaFile(new File(tmpDir, "meta.json")); + String name = meta != null ? meta.optString("name", "") : ""; + if (name.isEmpty()) { + name = displayName != null ? displayName : "adrenotools-driver"; + if (name.toLowerCase().endsWith(".zip")) name = name.substring(0, name.length() - 4); + } + String id = uniqueId(LinuxVulkanDriverManager.sanitizeId(name)); + File dir = new File(contentDir, id); + if (!tmpDir.renameTo(dir)) throw new IOException("cannot move into " + dir); + keep = true; + Log.i(TAG, "imported AdrenoTools driver " + id + " (" + (meta != null ? meta.optString("libraryName", "") : "?") + ") -> " + dir); + return id; + } finally { + if (!keep) FileUtils.delete(tmpDir); + } + } + + private static JSONObject readMetaFile(File metaFile) { + try { + return new JSONObject(FileUtils.readString(metaFile)); + } catch (Exception e) { + return null; + } + } + + /** + * Why a just-extracted zip is not something adrenotools can be pointed at, or null when it is. + * The kinds refused by name are the other driver lists' zips, which carry a meta.json too. + */ + private static String rejectionReason(File dir) { + File metaFile = new File(dir, "meta.json"); + if (!metaFile.isFile()) return "no meta.json"; + String libraryName, kind; + try { + JSONObject meta = new JSONObject(FileUtils.readString(metaFile)); + libraryName = meta.optString("libraryName", ""); + kind = meta.optString("kind", ""); + } catch (Exception e) { + return "meta.json is unreadable (" + e.getMessage() + ")"; + } + if ("linux-vulkan-icd".equals(kind)) + return "this is a Linux runtime driver (import it under \"Linux runtime driver\")"; + if ("wayland-game-driver".equals(kind)) + return "this is a Wayland game driver, which this app has no use for"; + if (libraryName.isEmpty()) + return "meta.json names no libraryName, so nothing could be handed to AdrenoTools"; + File library = new File(dir, libraryName); + if (!library.isFile()) + return "meta.json names " + libraryName + ", which is not in the zip"; + if (!LinuxVulkanDriverManager.isAarch64Elf(library)) + return libraryName + " is not a 64-bit AArch64 ELF shared library"; + // A glibc build that happens to carry a libraryName would load nothing in this process. + if (LinuxVulkanDriverManager.containsAscii(library, "libc.so.6")) + return libraryName + " links glibc — a \"-Linux\" Turnip, which belongs under \"Linux runtime driver\""; + return null; + } + + private String uniqueId(String base) { + String id = base; + int n = 2; + while (new File(contentDir, id).exists()) id = base + "-" + (n++); + return id; + } + /** * Unpacks the driver this device needs and returns its id, or null to fall back to the system * Vulkan loader (which means a black session on Adreno, but is better than refusing to start @@ -80,7 +257,28 @@ public final class TurnipDriver { return id; } + /** + * The user's choice first — an imported driver, or one of the bundled two pinned by hand — + * then the Downloads override, then the GPU. A chosen import that has since been removed logs + * and falls through, so a stale preference never blocks a session. + */ private String choose() { + String chosen = SessionPrefs.androidDriver(context); + if (chosen != null && !chosen.isEmpty()) { + if (BUNDLED.contains(chosen)) { + Log.i(TAG, "driver pinned by the user: " + chosen); + return chosen; + } + if (isInstalled(chosen)) { + Log.i(TAG, "imported driver chosen by the user: " + chosen); + return chosen; + } + Log.w(TAG, "chosen driver \"" + chosen + "\" is gone; picking by GPU"); + } + return chooseByDevice(); + } + + private String chooseByDevice() { File override = new File(Environment.getExternalStorageDirectory(), OVERRIDE_FILE); String forced = override.isFile() ? FileUtils.readString(override) : null; if (forced != null) { diff --git a/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt b/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt index 50970b1a72..b8c74fea84 100644 --- a/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt @@ -50,4 +50,25 @@ object SessionPrefs { fun setOscMode(context: Context, mode: String) { prefs(context).edit().putString("osc", mode).apply() } + + /** + * The imported glibc Turnip a mode draws with inside the runtime, keyed by + * SessionService.MODE_STEAM / MODE_DESKTOP so Steam and the desktop can differ; "" = the + * driver built into the runtime. Resolved by LinuxVulkanDriver at session start. + */ + fun linuxDriver(context: Context, mode: String): String = + prefs(context).getString("linuxDriver.$mode", "") ?: "" + + fun setLinuxDriver(context: Context, mode: String, id: String) { + prefs(context).edit().putString("linuxDriver.$mode", id).apply() + } + + /** The Android driver the compositor loads: "" = pick by GPU, else a bundled or imported id. */ + @JvmStatic + fun androidDriver(context: Context): String = prefs(context).getString("androidDriver", "") ?: "" + + @JvmStatic + fun setAndroidDriver(context: Context, id: String) { + prefs(context).edit().putString("androidDriver", id).apply() + } } diff --git a/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt b/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt index dec7d6c892..1261b469bf 100644 --- a/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt @@ -1,5 +1,7 @@ package com.steamdeck.launcher.session +import com.steamdeck.launcher.gpu.LinuxVulkanDriver + import android.app.Notification import android.app.NotificationChannel import android.app.NotificationManager @@ -106,6 +108,11 @@ class SessionService : Service() { guest.add("GALLIUM_DRIVER=zink") guest.add("LIBGL_KOPPER_DRI2=true") LinuxRuntime.vulkanIcd(this)?.let { guest.add("VK_ICD_FILENAMES=" + it.path) } + // An imported glibc Turnip for this mode, when the user chose one: the session script checks + // the manifest and its library from inside and points the loader at it with VK_DRIVER_FILES, + // so the runtime's own driver above stays untouched and is what a bad import falls back to. + LinuxVulkanDriver.resolveIcdPath(this, SessionPrefs.linuxDriver(this, SessionState.mode)) + ?.let { guest.add(LinuxVulkanDriver.ENV + "=" + it) } val pulse = PulseAudioComponent(this) pulse.setContext(this) diff --git a/app/src/main/java/com/steamdeck/launcher/ui/DriverDialog.kt b/app/src/main/java/com/steamdeck/launcher/ui/DriverDialog.kt new file mode 100644 index 0000000000..78ae3bc55c --- /dev/null +++ b/app/src/main/java/com/steamdeck/launcher/ui/DriverDialog.kt @@ -0,0 +1,140 @@ +package com.steamdeck.launcher.ui + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.AlertDialog +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.RadioButton +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import com.steamdeck.launcher.session.SessionService + +/** One driver as the dialog shows it. [removable] is false for the runtime's own and the bundled builds. */ +class DriverRow(val id: String, val name: String, val detail: String, val removable: Boolean) + +/** + * The two driver choices a session has, each its own list, because a zip for one cannot serve the + * other: the glibc Turnip the runtime draws with (chosen per mode — Steam and the desktop can + * differ), and the bionic Turnip the app's compositor puts the frame on the panel with. Imports + * are validated where they land, so a "-Linux" zip dropped in the Android list is refused with + * the reason rather than becoming a black session. + */ +@Composable +fun DriverDialog( + linuxRows: List, + linuxSteam: String, + linuxDesktop: String, + androidRows: List, + androidSelected: String, + onSelectLinux: (mode: String, id: String) -> Unit, + onImportLinux: () -> Unit, + onRemoveLinux: (String) -> Unit, + onSelectAndroid: (String) -> Unit, + onImportAndroid: () -> Unit, + onRemoveAndroid: (String) -> Unit, + onDismiss: () -> Unit, +) { + AlertDialog( + onDismissRequest = onDismiss, + title = { Text("Graphics drivers") }, + text = { + Column(modifier = Modifier.verticalScroll(rememberScrollState())) { + Text("Linux runtime driver", style = MaterialTheme.typography.titleSmall) + Text( + "What the Steam client, its games and the desktop's programs render on, inside the runtime. " + + "\"-Linux\" Turnip zips only — these are Linux processes and cannot load an Android driver. " + + "Applies at the next session start.", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + Spacer(Modifier.height(6.dp)) + Row(modifier = Modifier.fillMaxWidth()) { + Spacer(Modifier.weight(1f)) + Text("Steam", style = MaterialTheme.typography.labelSmall, modifier = Modifier.width(52.dp), fontWeight = FontWeight.Bold) + Text("Desktop", style = MaterialTheme.typography.labelSmall, modifier = Modifier.width(60.dp), fontWeight = FontWeight.Bold) + } + for (row in linuxRows) { + Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(vertical = 2.dp)) { + Column(modifier = Modifier.weight(1f)) { + Text(row.name, style = MaterialTheme.typography.bodyMedium) + if (row.detail.isNotEmpty()) Text( + row.detail, + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + if (row.removable) TextButton( + onClick = { onRemoveLinux(row.id) }, + contentPadding = androidx.compose.foundation.layout.PaddingValues(0.dp), + ) { Text("Remove", style = MaterialTheme.typography.labelSmall) } + } + RadioButton( + selected = row.id == linuxSteam, + onClick = { onSelectLinux(SessionService.MODE_STEAM, row.id) }, + modifier = Modifier.width(52.dp), + ) + RadioButton( + selected = row.id == linuxDesktop, + onClick = { onSelectLinux(SessionService.MODE_DESKTOP, row.id) }, + modifier = Modifier.width(60.dp), + ) + } + } + OutlinedButton(onClick = onImportLinux, modifier = Modifier.fillMaxWidth().padding(top = 4.dp)) { + Text("Import \"-Linux\" Turnip zip…") + } + + Spacer(Modifier.height(14.dp)) + HorizontalDivider() + Spacer(Modifier.height(10.dp)) + + Text("Display driver (Android)", style = MaterialTheme.typography.titleSmall) + Text( + "What the app's compositor puts frames on the screen with — the last step of every session. " + + "AdrenoTools zips only. The compositor loads its driver once per app process, so a change " + + "applies after the app is fully closed and opened again.", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + Spacer(Modifier.height(6.dp)) + for (row in androidRows) { + Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(vertical = 2.dp)) { + Column(modifier = Modifier.weight(1f)) { + Text(row.name, style = MaterialTheme.typography.bodyMedium) + if (row.detail.isNotEmpty()) Text( + row.detail, + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + if (row.removable) TextButton( + onClick = { onRemoveAndroid(row.id) }, + contentPadding = androidx.compose.foundation.layout.PaddingValues(0.dp), + ) { Text("Remove", style = MaterialTheme.typography.labelSmall) } + } + RadioButton( + selected = row.id == androidSelected, + onClick = { onSelectAndroid(row.id) }, + ) + } + } + OutlinedButton(onClick = onImportAndroid, modifier = Modifier.fillMaxWidth().padding(top = 4.dp)) { + Text("Import AdrenoTools zip…") + } + } + }, + confirmButton = { TextButton(onClick = onDismiss) { Text("OK") } }, + ) +} diff --git a/app/src/main/java/com/steamdeck/launcher/ui/MainScreen.kt b/app/src/main/java/com/steamdeck/launcher/ui/MainScreen.kt index f460ab8946..a51109338a 100644 --- a/app/src/main/java/com/steamdeck/launcher/ui/MainScreen.kt +++ b/app/src/main/java/com/steamdeck/launcher/ui/MainScreen.kt @@ -66,6 +66,7 @@ fun MainScreen( onRuntime: () -> Unit, onFrameGen: () -> Unit, onProtons: () -> Unit, + onDrivers: () -> Unit, onOffline: () -> Unit, onCredits: () -> Unit, ) { @@ -177,6 +178,10 @@ fun MainScreen( onClick = onProtons, modifier = Modifier.fillMaxWidth().padding(top = 5.dp * k).height(buttonHeight + 5.dp * k), ) { Text("Compatibility tools", fontSize = 13.sp * k) } + OutlinedButton( + onClick = onDrivers, + modifier = Modifier.fillMaxWidth().padding(top = 5.dp * k).height(buttonHeight + 5.dp * k), + ) { Text("Graphics drivers", fontSize = 13.sp * k) } Spacer(Modifier.height(10.dp * k)) Text( "by The412Banner and maxjivi05 · credits", diff --git a/tools/linuxfs/overlay/usr/local/bin/bannerlator-session b/tools/linuxfs/overlay/usr/local/bin/bannerlator-session index 9dbd0292c7..01c4136fd4 100755 --- a/tools/linuxfs/overlay/usr/local/bin/bannerlator-session +++ b/tools/linuxfs/overlay/usr/local/bin/bannerlator-session @@ -37,6 +37,33 @@ collect_steam_logs() { [ -f "$steam_root/steam.pid" ] && cp "$steam_root/steam.pid" "$BL_DEBUG_DIR/" 2>/dev/null echo "== steam logs copied to $BL_DEBUG_DIR" } +# The driver everything in this session draws with: gamescope's compositing, the client's UI +# (OpenGL through Zink), every game Proton launches, and in desktop mode every program on it. +# BL_VK_DRIVER names an imported driver's ICD manifest on the Android side, which is bound into the +# session at its own path; unset means the runtime keeps the Turnip it was built with. +# VK_DRIVER_FILES REPLACES the loader's search, so a manifest whose library is unreadable would +# leave the session with no Vulkan at all - check both before setting it, and say so in the log +# rather than fail silently half a minute later. +if [ -n "${BL_VK_DRIVER:-}" ]; then + bl_icd_lib=$(sed -n 's/.*"library_path"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$BL_VK_DRIVER" 2>/dev/null | head -1) + # JSON may escape the separator: org.json writes "\/data\/user\/0\/...". The Vulkan loader + # parses that correctly; this check has to as well, or an absolute path looks relative and gets + # glued onto the manifest's directory - which is exactly what happened the first time. + bl_icd_lib=$(printf '%s' "$bl_icd_lib" | sed 's|\\/|/|g') + case $bl_icd_lib in + /*) ;; + ?*) bl_icd_lib="$(dirname "$BL_VK_DRIVER")/$bl_icd_lib" ;; + esac + if [ -r "$BL_VK_DRIVER" ] && [ -n "$bl_icd_lib" ] && [ -r "$bl_icd_lib" ]; then + export VK_DRIVER_FILES="$BL_VK_DRIVER" + # Loaders older than 1.3.207 only know the old name; both are harmless together. + export VK_ICD_FILENAMES="$BL_VK_DRIVER" + echo "== vulkan driver: imported $bl_icd_lib (via $BL_VK_DRIVER)" + else + echo "== vulkan driver: IGNORING $BL_VK_DRIVER (manifest or ${bl_icd_lib:-library} unreadable); using the runtime's own" + fi + unset bl_icd_lib +fi export XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share} export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config} export XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}