Files
DroidDeck/tools/tests/test_qualcomm_caps.py
T
K11MCH1 9c987fa92e 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)
2026-10-25 23:09:14 +00:00

40 lines
1.9 KiB
Python

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()