diff --git a/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java b/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java index e67834f70b..92ab3af574 100644 --- a/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java +++ b/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java @@ -364,11 +364,16 @@ public final class LinuxRuntime { public static String gpuStandIn(Context context) { return gpuStandIn(path -> new File(path).exists(), - () -> com.droiddeck.launcher.core.DeviceSupport.INSTANCE.openDriverActive(context) - || com.droiddeck.launcher.session.VenusComponent.wanted(context), + () -> maliGuestDriver(com.droiddeck.launcher.core.DeviceSupport.INSTANCE.openDriverActive(context), + () -> com.droiddeck.launcher.session.VenusComponent.wanted(context), + com.droiddeck.launcher.session.SessionState.INSTANCE.getMode()), () -> com.droiddeck.launcher.core.DeviceSupport.INSTANCE.vkBridge(context)); } + static boolean maliGuestDriver(boolean openDriver, java.util.function.BooleanSupplier venus, String sessionMode) { + return openDriver || (com.droiddeck.launcher.session.SessionService.MODE_DESKTOP.equals(sessionMode) && venus.getAsBoolean()); + } + static String gpuStandIn(java.util.function.Predicate exists, java.util.function.BooleanSupplier maliGuestDriver, java.util.function.BooleanSupplier bridge) { if (exists.test(KGSL_DEVICE)) return KGSL_DEVICE; diff --git a/app/src/test/java/com/droiddeck/launcher/runtime/LinuxRuntimeGpuStandInTest.kt b/app/src/test/java/com/droiddeck/launcher/runtime/LinuxRuntimeGpuStandInTest.kt index 28956166d2..d6255ba0b3 100644 --- a/app/src/test/java/com/droiddeck/launcher/runtime/LinuxRuntimeGpuStandInTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/runtime/LinuxRuntimeGpuStandInTest.kt @@ -1,8 +1,11 @@ package com.droiddeck.launcher.runtime import android.app.Application +import com.droiddeck.launcher.session.SessionService import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse import org.junit.Assert.assertNull +import org.junit.Assert.assertTrue import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @@ -43,4 +46,23 @@ class LinuxRuntimeGpuStandInTest { LinuxRuntime.gpuStandIn({ it == kgsl }, { asked = true; true }, { asked = true; true }) assertEquals(false, asked) } + + @Test fun venusGetsTheMaliNodeOnlyOnDesktop() { + assertTrue(LinuxRuntime.maliGuestDriver(false, { true }, SessionService.MODE_DESKTOP)) + assertFalse(LinuxRuntime.maliGuestDriver(false, { true }, SessionService.MODE_STEAM)) + assertFalse(LinuxRuntime.maliGuestDriver(false, { true }, SessionService.MODE_RUN)) + assertFalse(LinuxRuntime.maliGuestDriver(false, { false }, SessionService.MODE_DESKTOP)) + } + + @Test fun openDriverPairGetsTheMaliNodeInEveryMode() { + for (mode in listOf(SessionService.MODE_STEAM, SessionService.MODE_DESKTOP, SessionService.MODE_RUN)) { + assertTrue(LinuxRuntime.maliGuestDriver(true, { false }, mode)) + } + } + + @Test fun venusIsNotAskedOutsideDesktop() { + var asked = false + LinuxRuntime.maliGuestDriver(false, { asked = true; true }, SessionService.MODE_STEAM) + assertFalse(asked) + } } diff --git a/docs/development/mali-venus.md b/docs/development/mali-venus.md index b030dddd72..492819394a 100644 --- a/docs/development/mali-venus.md +++ b/docs/development/mali-venus.md @@ -155,6 +155,8 @@ The SPIR-V version the driver gets: When the driver reports no render node, the layer reports the stand-in node's numbers (`DD_DRM_STANDIN=/dev/mali0`, bound into the guest as `/dev/dri/renderD`). The extension stays unlisted, and the layer is off in gamescope, so gamescope keeps its no-DRM path. + Venus gets the stand-in node only in Desktop sessions. Steam and program sessions keep running + without one, so their Xwayland, Zink and gamescope paths stay as they were. Files: - `layer.c`: loader plumbing, feature and limit reporting, device creation, the hook table. diff --git a/tools/desktop-kde/README.md b/tools/desktop-kde/README.md index 74d76eeebd..7b6bb89836 100644 --- a/tools/desktop-kde/README.md +++ b/tools/desktop-kde/README.md @@ -45,7 +45,7 @@ Zink for KWin 6.8, which removed QPainter. Older packages retain their software KWin runs without Gallium's threaded context and without overlay layers. With the threaded context, KWin crashed uploading windows' shared-memory buffers by reading past their end, and the host shows only a single buffer. On Android the launcher explicitly selects the GPU's render node (KGSL, or `/dev/mali0` as a -stand-in for the Mali open driver and Venus); the nested backend can use it when the host's dmabuf +stand-in for the Mali open driver, and for Venus in Desktop sessions); the nested backend can use it when the host's dmabuf feedback cannot name a DRM device. Without one, KWin 6.8 has no compositor and the desktop stays black. Games and emulators from the menu go through `droiddeck-gpu`, and Steam goes back to the app as a Steam session.