Files
PS5_RetroArch/tests/display_modes_ps5_test.cpp
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

57 lines
2.3 KiB
C++

/* The display modes test on the host, through the Khronos loader: argv[1] is a
* scratch directory. Unarmed, it must do nothing. The pattern must have its
* border and its halves. With a driver to run on (argv[2] = "armed", and
* VK_DRIVER_FILES naming a build of RADV with the VideoOut WSI, whose host
* model presents at once), every mode must present. */
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include "../src/display_modes_ps5.cpp"
void ps5::debug::mark(const char *step) noexcept
{
std::printf("trace: %s\n", step);
}
void ps5::debug::mark_value(const char *step, long long value) noexcept
{
std::printf("trace: %s %lld\n", step, value);
}
int main(int argc, char **argv)
{
assert(argc >= 2);
const std::string dir = argv[1];
const std::string arm = dir + "/display-modes-test.txt",
results = dir + "/display-modes-test.jsonl";
// Unarmed: no device, no record.
assert(!ps5::display_modes::run_test(arm, results));
assert(std::fopen(results.c_str(), "rb") == nullptr);
// The pattern: a white border, then the size's two shades either side of the middle.
const VkExtent2D extent{1280, 720};
std::vector<uint32_t> pixels(size_t(extent.width) * extent.height);
ps5::display_modes::fill_pattern(pixels.data(), extent);
assert(pixels[0] == 0xffffffffu && pixels.back() == 0xffffffffu);
assert(pixels[size_t(360) * 1280 + 12] == 0xffffffffu);
assert(pixels[size_t(360) * 1280 + 13] == 0xffffff00u);
assert(pixels[size_t(360) * 1280 + 639] == 0xffffff00u);
assert(pixels[size_t(360) * 1280 + 640] == 0xff808000u);
const std::string line = ps5::display_modes::mode_line({{1920, 1080}, 59940}, 3, 3, 0.05, "");
assert(line == "{\"width\":1920,\"height\":1080,\"refresh_millihertz\":59940,\"frames\":3,"
"\"images\":3,\"seconds\":0.050,\"result\":\"ok\"}");
if (argc > 2 && std::string(argv[2]) == "armed")
{
std::FILE *file = std::fopen(arm.c_str(), "wb");
std::fputs("3\n", file);
std::fclose(file);
const bool passed = ps5::display_modes::run_test(arm, results);
std::printf("display_modes_ps5 armed run: %s\n", passed ? "PASS" : "FAIL");
return passed ? 0 : 1;
}
std::puts("display_modes_ps5: unarmed, pattern and record PASS");
return 0;
}