From d6789f7b61725284e44a778b6c52efc5bcf6be5f Mon Sep 17 00:00:00 2001 From: The412Banner Date: Sun, 20 Sep 2026 03:36:09 -0400 Subject: [PATCH] Desktop: composite the shell with pixman MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../launcher/runtime/DesktopCatalog.kt | 23 ++++++++++++++++++- .../launcher/session/SessionService.kt | 11 +++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/steamdeck/launcher/runtime/DesktopCatalog.kt b/app/src/main/java/com/steamdeck/launcher/runtime/DesktopCatalog.kt index 351f5b4115..7c3fd7f095 100644 --- a/app/src/main/java/com/steamdeck/launcher/runtime/DesktopCatalog.kt +++ b/app/src/main/java/com/steamdeck/launcher/runtime/DesktopCatalog.kt @@ -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. 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 2eef3fb2bc..b612d98a74 100644 --- a/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt @@ -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)