Files
AnyPS5/core/libs/prx/libSceVideoOut/tests/HdrProbe.cpp
T
Gjon Gojcevic 4e27d8d753 fix(videoout): keep the output SDR on hosts without a monitor HDR report
A Vulkan surface can offer HDR10 formats while the display is not in
HDR (KDE Wayland with RADV lists them with the output's HDR disabled),
so on hosts other than Windows the probe now reports an SDR monitor and
HDR output stays off until an output-state signal exists. A probe test
checks that a window without a Windows monitor report reads as SDR with
an HDR10 surface.

The HDR10 present test now also changes the monitor's luminance while
presenting HDR10, and the presenter logs the HDR metadata it sets.

AI-assisted: yes
2026-10-14 08:55:18 -04:00

38 lines
1.3 KiB
C++

#include "prx/libSceVideoOut/include/HostHdrProbe.hpp"
#include "prx/libSceAgcDriver/Execution/include/HostHdr.hpp"
#include <cstdio>
#include <cstdlib>
#include <string>
#undef main
int main() {
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
std::printf("skipped, no SDL video driver: %s\n", SDL_GetError());
return 77;
}
SDL_Window* window = SDL_CreateWindow("HDR probe test", 0, 0, 64, 64, SDL_WINDOW_HIDDEN);
if (window == nullptr) {
std::printf("skipped, no SDL window: %s\n", SDL_GetError());
SDL_QuitSubSystem(SDL_INIT_VIDEO);
return 77;
}
const std::string driver = SDL_GetCurrentVideoDriver() != nullptr ? SDL_GetCurrentVideoDriver() : "unknown";
AgcDriverSetSurfaceHdr10_nid_postfix(true);
int result = 0;
{
HostHdrProbe probe;
probe.Poll(window);
probe.Poll(window);
const auto host = AgcDriver::CurrentHostHdr();
if (host.display.hdr || host.available) {
std::fprintf(stderr, "FAIL: a window without a Windows HDR monitor report reads as HDR although only the surface offers HDR10 (driver %s)\n", driver.c_str());
result = 1;
}
}
SDL_DestroyWindow(window);
SDL_QuitSubSystem(SDL_INIT_VIDEO);
if (result == 0) std::printf("HDR probe tests passed (driver %s)\n", driver.c_str());
return result;
}