Compare commits

...
5 changed files with 37 additions and 7 deletions

No files matched your search

@@ -1036,9 +1036,13 @@ class SessionService : Service() {
if (!bridge && !venus && SystemVulkanDriver.usesDefault(linuxDriverId)) {
SystemVulkanDriver.addEnvironment(this, guest)
}
com.droiddeck.launcher.wayland.WaylandCompositor.nativeSetDisplayBufferDriver(
!bridge && !venus && LinuxVulkanDriverManager(this).rendersToDisplayBuffers(linuxDriverId),
)
val displayBuffers = !bridge && !venus && LinuxVulkanDriverManager(this).rendersToDisplayBuffers(linuxDriverId)
com.droiddeck.launcher.wayland.WaylandCompositor.nativeSetDisplayBufferDriver(displayBuffers)
if (displayBuffers) {
guest.add("vk_wsi_override_min_image_count=$DISPLAY_BUFFER_IMAGES")
guest.add("GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT=1")
Log.i(TAG, "display buffers: swapchains default to $DISPLAY_BUFFER_IMAGES images")
}
(if (bridge || venus) null else LinuxVulkanDriver.resolveIcdPath(this, linuxDriverId))
?.let { guest.add(LinuxVulkanDriver.ENV + "=" + it) }
// DroidDeck-Bionic games load an Android driver build; this is the one the display uses, for a runtime driver
@@ -2643,6 +2647,7 @@ class SessionService : Service() {
companion object {
private const val TAG = "SessionService"
private const val TRACER_NICE = -6
private const val DISPLAY_BUFFER_IMAGES = 4
private const val MIC_RELEASE_TIMEOUT_MS = 5_000L
private const val TU_DEBUG_SWITCH = "Download/droiddeck-tu-debug"
private const val GAME_PREFIX = "DROIDDECK_GAME_"
+11 -3
View File
@@ -205,12 +205,20 @@ same WSI layer, and with eight images and no frame limit it drew flat out
(about 240 frames a second at 120 Hz) and heated the device. Values set in the
launch options or the environment editor are kept.
When the driver renders straight into display buffers (zero-copy presentation),
the session sets `vk_wsi_override_min_image_count=4` and
`GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT=1`. A display buffer comes back only once
the display releases it, about two refreshes after it is replaced, so the Steam
client's three-image swapchains ran at 40 fps on a 60 Hz panel. Gamescope's WSI
layer reads `GAMESCOPE_WSI_MIN_IMAGE_COUNT` first, so a game launch keeps its
eight images.
DOOM (2016) is the exception (`DOOMx64vk.exe` beside the launched program, which
is `DOOMx64.exe` for a GOG install). It asks for exactly two images and stops with
`FATAL ERROR: getSwapchainImagesKHR failed with error (VK_SUCCESS)` when it gets
more, so its fix removes both variables, also from its launch options, and sets
`vk_x11_strict_image_count=true`, the option Mesa's driconf gives the game. A
per-game value in the environment editor still wins.
more, so its fix removes all three image-count variables, also from its launch
options, and sets `vk_x11_strict_image_count=true`, the option Mesa's driconf
gives the game. A per-game value in the environment editor still wins.
Dragon Quest Monsters 4 does not draw slime bodies at its default monster mesh
detail, leaving only their tips. Before each launch, DroidDeck sets
@@ -197,6 +197,7 @@ def doom_2016_swapchain_images(game):
images = {
"GAMESCOPE_WSI_MIN_IMAGE_COUNT": None,
"GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT": None,
"vk_wsi_override_min_image_count": None,
"vk_x11_strict_image_count": "true",
}
return images, [], "DOOM (2016): the swapchain keeps the image count the game asks for"
+8 -1
View File
@@ -1785,16 +1785,19 @@ class GameEnvironmentTest(unittest.TestCase):
images = {
"GAMESCOPE_WSI_MIN_IMAGE_COUNT": None,
"GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT": None,
"vk_wsi_override_min_image_count": None,
"vk_x11_strict_image_count": "true",
}
for exe in ("DOOMx64.exe", "DOOMx64vk.exe"):
env, extra, notes = MODULE["engine_fixes"](str(game / exe), [])
self.assertEqual((env, extra), (images, []))
self.assertTrue(notes)
launched = {"GAMESCOPE_WSI_MIN_IMAGE_COUNT": "8", "GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT": "1"}
launched = {"GAMESCOPE_WSI_MIN_IMAGE_COUNT": "8", "GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT": "1",
"vk_wsi_override_min_image_count": "4"}
result = MODULE["apply_config"](launched, {"version": 1}, "3566086475", env)
self.assertNotIn("GAMESCOPE_WSI_MIN_IMAGE_COUNT", result)
self.assertNotIn("GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT", result)
self.assertNotIn("vk_wsi_override_min_image_count", result)
self.assertEqual(result["vk_x11_strict_image_count"], "true")
config = {"version": 1, "games": {"3566086475": {"GAMESCOPE_WSI_MIN_IMAGE_COUNT": "3"}}}
self.assertEqual(MODULE["apply_config"](launched, config, "3566086475", env)["GAMESCOPE_WSI_MIN_IMAGE_COUNT"], "3")
@@ -1882,6 +1885,10 @@ class GameEnvironmentTest(unittest.TestCase):
self.assertTrue(MODULE["game_images"](game))
self.assertEqual(game["GAMESCOPE_WSI_MIN_IMAGE_COUNT"], "8")
self.assertEqual(game["GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT"], "1")
session = {"STEAM_COMPAT_DATA_PATH": "/steam/compatdata/945360", "vk_wsi_override_min_image_count": "4",
"GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT": "1"}
self.assertTrue(MODULE["game_images"](session))
self.assertEqual(session["GAMESCOPE_WSI_MIN_IMAGE_COUNT"], "8")
own = {"STEAM_COMPAT_DATA_PATH": "/steam/compatdata/945360", "GAMESCOPE_WSI_MIN_IMAGE_COUNT": "3"}
MODULE["game_images"](own)
self.assertEqual(own["GAMESCOPE_WSI_MIN_IMAGE_COUNT"], "3")
@@ -54,6 +54,15 @@ class SessionGuestCommandTest(unittest.TestCase):
["DROIDDECK_BWRAP_SOCKET=" + package + ".bwrap"],
result.stdout.splitlines())
def test_display_buffer_sessions_raise_the_default_image_count_below_games(self):
source = SERVICE.read_text()
branch = source.split("if (displayBuffers) {", 1)[1].split("}", 1)[0]
self.assertIn('guest.add("vk_wsi_override_min_image_count=$DISPLAY_BUFFER_IMAGES")', branch)
self.assertIn('guest.add("GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT=1")', branch)
self.assertNotIn("GAMESCOPE_WSI_MIN_IMAGE_COUNT=", branch)
self.assertRegex(source, r"const val DISPLAY_BUFFER_IMAGES = 4\b")
self.assertIn("nativeSetDisplayBufferDriver(displayBuffers)", source)
if __name__ == "__main__":
unittest.main()