Files
PS5_RetroArch/tests/test_display_modes_ps5.py
T
Mihawk d200efa4c6 Prove the driver's display sizes on the console with a display modes test
The Vulkan driver's display (RADV's VideoOut WSI, PS5_Mesa dc82d01, pinned by
PS5_Vulkan ab37acd) now offers 3840x2160, 2560x1440 and 1920x1080 instead of
4K alone. src/display_modes_ps5.cpp, armed by /app0/display-modes-test.txt
(tools/run-title.sh --display-modes-test[=frames]), makes a device on the
title's driver before RetroArch does and presents every mode in turn, then the
first again, each with a pattern a person can judge: two shades of one colour a
size split at the middle and a white border on every edge. Each mode's result
is a line of /app0/display-modes-test.jsonl; RetroArch then starts as usual.
RetroArch's default (the largest mode) is unchanged; video_fullscreen_x/y
selects a smaller one.

Verified:
  TMPDIR=build/tmp bash tools/verify.sh -> PASS (format unit build integration
    evidence), building against PS5_Vulkan's archive at dc82d01 (build
    8128ea84...); the host test also ran armed against a host build of the
    WSI (PS5_WSI_MODES_ICD): every mode presented.
  tools/run-title.sh --no-build --display-modes-test=180 --watch 60 on the
    base PS5 (13.40, 1080p screen), build ce576f3d (same driver revision):
    sets 0-2 registered (buffers 0-14), 180 frames each in 2.96-3.00 s,
    3840x2160 again from set 0, PASS. The owner saw each size fill the TV,
    border on all four edges and split centred, and RetroArch steady after.
  A first run (PS5_Mesa 3321f8f) also offered 1280x720: VideoOut refused its
    set at buffers 15-19 (0x80290001) and RetroArch flickered after it, not
    alone; the size was left out of the merged driver.
Evidence: evidence/display-modes/ (python3 tools/evidence.py compare)
2026-10-04 14:22:07 -04:00

39 lines
1.8 KiB
Python

"""The display modes test's pattern, record and unarmed path; with PS5_WSI_MODES_ICD naming a
host build of RADV with the VideoOut WSI (its loader manifest), also an armed run on it."""
from pathlib import Path
import json
import os
import shutil
import subprocess
import tempfile
import unittest
ROOT = Path(__file__).resolve().parent.parent
class DisplayModesPs5(unittest.TestCase):
def test_pattern_record_and_armed_run(self):
if not any(Path(p).exists() for p in ('/usr/lib/libvulkan.so', '/usr/lib64/libvulkan.so',
'/usr/lib/x86_64-linux-gnu/libvulkan.so')):
self.skipTest('no Vulkan loader on this host')
with tempfile.TemporaryDirectory() as td:
binary = str(Path(td) / 'display-modes-test')
subprocess.run(['c++', '-std=c++17', '-O1', '-Wall', '-Wextra', '-Werror', '-Ivendor/retroarch',
'tests/display_modes_ps5_test.cpp', '-lvulkan', '-o', binary], cwd=ROOT, check=True)
subprocess.run([binary, td], cwd=ROOT, check=True, timeout=30)
icd = os.environ.get('PS5_WSI_MODES_ICD')
if not icd:
return
env = dict(os.environ, VK_DRIVER_FILES=icd, VK_LOADER_LAYERS_DISABLE='~all~')
subprocess.run([binary, td, 'armed'], cwd=ROOT, check=True, timeout=300, env=env)
rows = [json.loads(line) for line in (Path(td) / 'display-modes-test.jsonl').read_text().splitlines()]
self.assertEqual(rows[-1], {'result': 'PASS'})
sizes = [(row['width'], row['height']) for row in rows[:-1]]
self.assertIn((1920, 1080), sizes)
self.assertEqual(sizes[0], sizes[-1])
shutil.rmtree(td, ignore_errors=True)
if __name__ == '__main__':
unittest.main()