Desktop: composite the shell with pixman

labwc died at "unable to create allocator": wlroots allocates through gbm on a
DRM render node, and ours is a KGSL stand-in gbm cannot use — the wall the
freedreno spike hit, which gamescope only clears with its own Vulkan-WSI path.
pixman uses a shm allocator and no DRM at all, so the desktop boots; clients
on it pay a CPU copy. steamdeck-wlr-renderer in Downloads overrides the
choice for a device with a real node.
This commit is contained in:
The412Banner committed 2026-09-20 03:36:09 -04:00
1 parent 2e3196788e
commit d6789f7b61
2 files changed
+33 -1

No files matched your search

@@ -75,7 +75,10 @@ object DesktopCatalog {
"appimage" -> {
val dir = File(root, "opt/appimages").apply { mkdirs() }
val target = File(dir, "${entry.id}.AppImage")
if (!download.renameTo(target)) return "Could not place the AppImage"
// Some projects zip the AppImage (melonDS); the one file inside is what we want.
val placed = if (entry.url.endsWith(".zip", ignoreCase = true)) unzipAppImage(download, target)
else download.renameTo(target)
if (!placed) return "Could not place the AppImage"
target.setExecutable(true, false)
FileUtils.writeString(File(root, "usr/share/applications/steamdeck-${entry.id}.desktop"),
"[Desktop Entry]\nType=Application\nName=${entry.name}\n" +
@@ -94,6 +97,24 @@ object DesktopCatalog {
}
}
private fun unzipAppImage(zip: File, target: File): Boolean {
try {
java.util.zip.ZipInputStream(java.io.BufferedInputStream(java.io.FileInputStream(zip))).use { zin ->
var entry = zin.nextEntry
while (entry != null) {
if (!entry.isDirectory && entry.name.endsWith(".AppImage", ignoreCase = true)) {
java.io.FileOutputStream(target).use { out -> FileUtils.copy(zin, out) }
return true
}
entry = zin.nextEntry
}
}
} catch (e: Exception) {
Log.w(TAG, "unzip ${zip.name}", e)
}
return false
}
/**
* Removes an appimage package outright. A tar package is spread through the rootfs and is
* not tracked file by file; only its marker is dropped, which offers it again.
@@ -139,6 +139,17 @@ class SessionService : Service() {
}
SessionState.fakeInputDir = fakeInputDir
}
// The desktop is wlroots (labwc), and wlroots allocates its buffers through gbm on a real
// DRM render node. Ours is a KGSL stand-in that gbm cannot use — labwc dies at "unable to
// create allocator" — so the desktop shell is composited by pixman (software, a shm
// allocator, no DRM). Accelerated clients on it pay a CPU copy; a 2D emulator does not
// notice, a demanding one does. steamdeck-wlr-renderer in Downloads (pixman/vulkan/gles2)
// overrides it, for trying acceleration on a device that has a real node.
if (SessionState.mode == MODE_DESKTOP) {
val override = File(Environment.getExternalStorageDirectory(), "Download/steamdeck-wlr-renderer")
.takeIf { it.isFile }?.let { FileUtils.readString(it)?.trim() }
guest.add("BL_WLR_RENDERER=" + (override?.takeIf { it.isNotEmpty() } ?: "pixman"))
}
guest.add(LinuxRuntime.SESSION_SCRIPT)
guest.add(SessionState.mode)