mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
Graphics drivers: choose and import the Linux runtime driver and the display driver
Ported from Bannerlator's driver selection so the standalone stops being pinned to whatever Turnip the runtime image was built with (Mesa 26.2.2 today, while Bannerlator already runs 26.3.0 in the same role). Linux runtime driver: LinuxVulkanDriverManager imports a "-Linux" (glibc) Turnip zip under files/linux_vulkan_drivers/<id>/ with a generated ICD manifest whose library_path is absolute, validated by the libc the driver links against (libc.so.6, never libc.so) and by its ELF header. The choice is per mode, so Steam and the desktop can differ. SessionService hands the session BL_VK_DRIVER, and the session script — staged from the apk at every launch, so no runtime re-host — checks the manifest and its library from inside before exporting VK_DRIVER_FILES; the runtime's own driver is what anything unreadable falls back to. That block is Bannerlator's, verbatim. Display driver: TurnipDriver now also imports AdrenoTools zips beside the two bundled builds and honours a chosen id ahead of the GPU pick, with the same refusals as Bannerlator's AdrenotoolsManager — a zip with no libraryName, a Linux runtime driver, or a glibc library dressed as one is refused with the list it belongs in, never installed as a black session. One dialog on the main screen carries both lists; a removed import falls back at once. Documented in the README.
This commit is contained in:
1 parent
54417dd3a7
commit
539fd692ed
10 files changed
+886
-4
No files matched your search
@@ -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<DriverRow>,
|
||||
linuxSteam: String,
|
||||
linuxDesktop: String,
|
||||
androidRows: List<DriverRow>,
|
||||
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") } },
|
||||
)
|
||||
}
|
||||
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user