Fall back automatically on Qualcomm drivers with fewer capabilities

Older Adreno drivers such as the 8 Gen 2's 0.676.1 lack
VK_EXT_external_memory_dma_buf, DRM modifiers and calibrated timestamps.
They failed device creation in the WSI layer, failed Proton games on the
zero-copy path, and corrupted the Steam UI under GPU compositing.

- WSI patch 0005 makes the Wayland platform optional per device, so a
  device without its extensions stays usable for X11 swapchains instead
  of failing vkCreateDevice.
- droiddeck-qualcomm-caps checks DMA-BUF export and import, the swapchain
  extensions and Gamescope's linux-dmabuf once per session; Proton games
  use the zero-copy WSI path only when it passes and stay on X11 SHM
  otherwise. The session log records the verdict.
- The Steam browser uses software compositing when Zink offers less than
  OpenGL 4.0, with BL_STEAM_CEF_SOFTWARE as the manual override.

Verified on the Adreno 740 (falls back to SHM and software compositing,
UI correct) and the Adreno 840 (zero-copy and GPU compositing unchanged).

(cherry picked from commit d8d0b10cced1f21a1e9bc7dca00efd89b389adb3)
(cherry picked from commit 00775f0511)
This commit is contained in:
K11MCH1 authored and The412Banner committed 2026-10-25 23:09:14 +00:00
1 parent 8abb0b8e8c
commit 9c987fa92e
10 files changed
+525 -10

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
import os
from pathlib import Path
import subprocess
import tempfile
import unittest
SESSION = (Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin/droiddeck-session").read_text()
GATE = SESSION[SESSION.index("bl_qualcomm_browser_gpu() {"):SESSION.index("reap_orphans() {")]
class QualcommBrowserTest(unittest.TestCase):
def gate(self, glxinfo=None, **extra):
with tempfile.TemporaryDirectory() as directory:
env = dict(os.environ)
for name in ("DROIDDECK_SYSTEM_QUALCOMM", "BL_STEAM_CEF_SOFTWARE"):
env.pop(name, None)
if glxinfo is not None:
stub = Path(directory) / "glxinfo"
stub.write_text("#!/bin/sh\necho 'touched' > \"$0.ran\"\n" + glxinfo, newline="\n")
stub.chmod(0o755)
env["PATH"] = directory + os.pathsep + env["PATH"]
env.update(extra)
result = subprocess.run(["bash", "-c", GATE + "\nbl_qualcomm_browser_gpu; echo \"rc=$?\""],
env=env, capture_output=True, text=True)
ran = glxinfo is not None and (Path(directory) / "glxinfo.ran").exists()
return result.stdout.strip(), ran
def test_zink_below_opengl_4_selects_software_compositing(self):
out, _ = self.gate("printf ' Max core profile version: 3.2\\n'\n", DROIDDECK_SYSTEM_QUALCOMM="1")
self.assertIn("browser software compositing (Zink offers OpenGL 3.2; GPU compositing needs 4.0)", out)
self.assertTrue(out.endswith("rc=1"))
def test_zink_at_opengl_4_keeps_gpu_compositing(self):
out, _ = self.gate("printf ' Max core profile version: 4.6\\n'\n", DROIDDECK_SYSTEM_QUALCOMM="1")
self.assertIn("browser GPU compositing on (Zink OpenGL 4.6)", out)
self.assertTrue(out.endswith("rc=0"))
def test_an_unreadable_version_selects_software_compositing(self):
out, _ = self.gate("exit 1\n", DROIDDECK_SYSTEM_QUALCOMM="1")
self.assertIn("Zink offers OpenGL unknown", out)
self.assertTrue(out.endswith("rc=1"))
def test_an_explicit_override_and_other_drivers_skip_the_probe(self):
for extra in ({"DROIDDECK_SYSTEM_QUALCOMM": "1", "BL_STEAM_CEF_SOFTWARE": "0"},
{"DROIDDECK_SYSTEM_QUALCOMM": "1", "BL_STEAM_CEF_SOFTWARE": "1"},
{"DROIDDECK_SYSTEM_QUALCOMM": "0"}, {}):
with self.subTest(extra=extra):
out, ran = self.gate("printf ' Max core profile version: 3.2\\n'\n", **extra)
self.assertEqual(out, "rc=0")
self.assertFalse(ran)
def test_the_steam_launch_applies_the_gate(self):
self.assertIn("bl_qualcomm_browser_gpu || steam_cef_gpu=0", SESSION)
if __name__ == "__main__":
unittest.main()
+39
View File
@@ -0,0 +1,39 @@
from pathlib import Path
import runpy
import unittest
CAPS = runpy.run_path(str(Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin/droiddeck-qualcomm-caps"))
decide = CAPS["decide"]
REQUIRED = set(CAPS["REQUIRED"])
CAPABLE = {"extensions": REQUIRED | {"VK_EXT_image_drm_format_modifier"}, "linear_export": True,
"linear_import": True, "export_fd": True, "gamescope_dmabuf": True}
class QualcommCapsTest(unittest.TestCase):
def test_a_driver_with_working_dma_buf_export_enables_zero_copy(self):
self.assertEqual(decide(CAPABLE), (True, []))
def test_adreno_740_without_dma_buf_keeps_shm(self):
extensions = REQUIRED - {"VK_EXT_external_memory_dma_buf"}
enabled, reasons = decide({"extensions": extensions, "gamescope_dmabuf": False})
self.assertFalse(enabled)
self.assertEqual(reasons, ["missing VK_EXT_external_memory_dma_buf", "Gamescope offers no linux-dmabuf"])
def test_every_check_must_pass(self):
for key, reason in (("linear_export", "LINEAR DMA-BUF images are not exportable"),
("linear_import", "LINEAR DMA-BUF images are not importable"),
("export_fd", "DMA-BUF export failed"),
("gamescope_dmabuf", "Gamescope offers no linux-dmabuf")):
with self.subTest(key=key):
self.assertEqual(decide(dict(CAPABLE, **{key: False})), (False, [reason]))
self.assertEqual(decide(dict(CAPABLE, export_fd=False, export_error="vkGetMemoryFdKHR failed (-1)")),
(False, ["vkGetMemoryFdKHR failed (-1)"]))
def test_a_failed_probe_never_enables_zero_copy(self):
self.assertEqual(decide({"error": "vkCreateInstance returned -9"}),
(False, ["probe failed: vkCreateInstance returned -9"]))
self.assertFalse(decide({})[0])
if __name__ == "__main__":
unittest.main()
+22 -5
View File
@@ -8,22 +8,31 @@ BIN = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin"
COMPAT = runpy.run_path(str(BIN / "steam-compatibility"))
SHOW = 'echo "DISABLE_GAMESCOPE_WSI=${DISABLE_GAMESCOPE_WSI-unset} WSI_X11_FORCE_SHM=${WSI_X11_FORCE_SHM-unset}"\n'
SESSION_DEFAULT = "DISABLE_GAMESCOPE_WSI=1 WSI_X11_FORCE_SHM=1"
ZERO_COPY = "DISABLE_GAMESCOPE_WSI=unset WSI_X11_FORCE_SHM=unset"
class QualcommPresentTest(unittest.TestCase):
def present(self, **extra):
env = dict(os.environ, DISABLE_GAMESCOPE_WSI="1", WSI_X11_FORCE_SHM="1")
env.pop("DROIDDECK_SYSTEM_QUALCOMM", None)
env.pop("BL_QUALCOMM_SHM", None)
for name in ("DROIDDECK_SYSTEM_QUALCOMM", "DROIDDECK_QUALCOMM_ZERO_COPY", "BL_QUALCOMM_SHM"):
env.pop(name, None)
env.update(extra)
script = COMPAT["BL_PRESENT_SETUP"] + "\nbl_present\n" + SHOW
return subprocess.run(["bash", "-c", script], env=env, capture_output=True, text=True, check=True).stdout.strip()
def test_qualcomm_games_present_through_gamescope_wsi(self):
self.assertEqual(self.present(DROIDDECK_SYSTEM_QUALCOMM="1"), "DISABLE_GAMESCOPE_WSI=unset WSI_X11_FORCE_SHM=unset")
def test_qualcomm_games_present_zero_copy_when_the_probe_passed(self):
self.assertEqual(self.present(DROIDDECK_SYSTEM_QUALCOMM="1", DROIDDECK_QUALCOMM_ZERO_COPY="1"), ZERO_COPY)
def test_drivers_without_a_passing_probe_keep_the_session_default(self):
for extra in ({"DROIDDECK_SYSTEM_QUALCOMM": "1"},
{"DROIDDECK_SYSTEM_QUALCOMM": "1", "DROIDDECK_QUALCOMM_ZERO_COPY": "0"},
{"DROIDDECK_SYSTEM_QUALCOMM": "1", "DROIDDECK_QUALCOMM_ZERO_COPY": ""}):
with self.subTest(extra=extra):
self.assertEqual(self.present(**extra), SESSION_DEFAULT)
def test_turnip_sessions_and_the_shm_override_keep_the_session_default(self):
for extra in ({}, {"DROIDDECK_SYSTEM_QUALCOMM": "0"}, {"DROIDDECK_SYSTEM_QUALCOMM": "1", "BL_QUALCOMM_SHM": "1"}):
for extra in ({}, {"DROIDDECK_SYSTEM_QUALCOMM": "0", "DROIDDECK_QUALCOMM_ZERO_COPY": "1"},
{"DROIDDECK_SYSTEM_QUALCOMM": "1", "DROIDDECK_QUALCOMM_ZERO_COPY": "1", "BL_QUALCOMM_SHM": "1"}):
with self.subTest(extra=extra):
self.assertEqual(self.present(**extra), SESSION_DEFAULT)
@@ -37,6 +46,14 @@ class QualcommPresentTest(unittest.TestCase):
for index in launches:
self.assertIn("bl_present", lines[max(0, index - 6):index])
def test_the_qualcomm_session_exports_the_probe_result(self):
session = (BIN / "droiddeck-session").read_text()
block = session[session.index('if [ "${DROIDDECK_SYSTEM_QUALCOMM:-0}" = 1 ]; then\n export VK_LAYER_PATH'):]
block = block[:block.index("\nfi\n")]
self.assertIn("DROIDDECK_QUALCOMM_ZERO_COPY=0", block)
self.assertIn("droiddeck-qualcomm-caps", block)
self.assertIn("export DROIDDECK_QUALCOMM_ZERO_COPY", block)
if __name__ == "__main__":
unittest.main()