mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
fix: use SteamVR compositor on Quest
This commit is contained in:
1 parent
59f752c70d
commit
92f2696a0c
16 files changed
+793
-26
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import json
|
||||
import shutil
|
||||
import socket
|
||||
import subprocess
|
||||
@@ -83,11 +84,39 @@ class SteamVrHelperTest(unittest.TestCase):
|
||||
'"${DROIDDECK_VR_PRESENT:-unset}" "${DROIDDECK_VR_PRODUCER_LEASE:-unset}"')
|
||||
return self.start().read_text().strip()
|
||||
|
||||
def test_quest_receiver_automatically_enables_retained_producer_ownership(self):
|
||||
def test_quest_receiver_uses_normal_compositor_and_excludes_unsupported_frame_backend(self):
|
||||
self.runtime.mkdir()
|
||||
cvp = self.steamvr / 'drivers/cv/bin/linuxarm64/libArcturusPerception.so'
|
||||
cvp.parent.mkdir(parents=True)
|
||||
cvp.write_bytes(b'frame-only backend')
|
||||
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as receiver:
|
||||
receiver.bind(str(self.runtime / 'droiddeck-xr-frames'))
|
||||
self.assertIn('present=questframes lease=1', self.lease_log())
|
||||
self.assertIn('present=questwsi lease=unset', self.lease_log())
|
||||
settings = json.loads((self.home / '.local/share/Steam/config/steamvr.vrsettings').read_text())
|
||||
self.assertEqual(settings['steamvr'], {'enableLinuxVulkanAsync': True, 'motionSmoothing': False})
|
||||
self.assertFalse(cvp.exists())
|
||||
self.assertEqual(Path(str(cvp) + '.droiddeck-disabled').read_bytes(), b'frame-only backend')
|
||||
|
||||
def test_quest_settings_preserve_other_preferences_and_start_is_idempotent(self):
|
||||
self.environment['DROIDDECK_VR_PRESENT'] = 'questwsi'
|
||||
path = self.home / '.local/share/Steam/config/steamvr.vrsettings'
|
||||
path.parent.mkdir(parents=True)
|
||||
path.write_text(json.dumps({'steamvr': {'somePreference': 42}, 'dashboard': {'somePreference': True}}))
|
||||
self.start()
|
||||
self.start()
|
||||
settings = json.loads(path.read_text())
|
||||
self.assertEqual(settings['steamvr']['somePreference'], 42)
|
||||
self.assertEqual(settings['dashboard'], {'somePreference': True})
|
||||
|
||||
def test_quest_refuses_to_overwrite_malformed_settings(self):
|
||||
self.environment['DROIDDECK_VR_PRESENT'] = 'questwsi'
|
||||
path = self.home / '.local/share/Steam/config/steamvr.vrsettings'
|
||||
path.parent.mkdir(parents=True)
|
||||
path.write_text('invalid json')
|
||||
result = subprocess.run(['sh', str(self.helper), 'start'], env=self.environment,
|
||||
capture_output=True, text=True, timeout=5)
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertEqual(path.read_text(), 'invalid json')
|
||||
|
||||
def test_explicit_quest_presenter_enables_the_lease(self):
|
||||
self.environment['DROIDDECK_VR_PRESENT'] = 'questframes'
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
|
||||
@unittest.skipUnless(shutil.which('g++'), 'needs a Linux C++ compiler')
|
||||
class VrWsiTest(unittest.TestCase):
|
||||
def test_compositor_handoff_and_frame_transport(self):
|
||||
repository = Path(__file__).resolve().parents[2]
|
||||
headers = next((p for p in (Path('/usr/include'), repository / 'build/vr/include')
|
||||
if (p / 'vulkan/vulkan.h').is_file()), None)
|
||||
if headers is None:
|
||||
self.skipTest('needs Vulkan headers')
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
for name in ('test_wsi_capture', 'test_xr_shared', 'test_xr_frames'):
|
||||
with self.subTest(name=name):
|
||||
executable = Path(directory) / name
|
||||
subprocess.run(['g++', '-std=c++17', '-O2', '-pthread', '-Wall', '-Wextra', '-Werror',
|
||||
'-Wno-missing-field-initializers', '-I' + str(headers),
|
||||
str(repository / 'tools/vr/tests' / (name + '.cpp')), '-o', str(executable)], check=True)
|
||||
subprocess.run([str(executable)], check=True, timeout=20)
|
||||
Reference in new issue
Block a user