Files
AnyPS5/core/libs/tests/GuestVideoOutResolutionStatus.cpp
T
Adrià Franch df270d59eb fix(ci): skip the VideoOut window tests without a display, as check_skips expects
Main's Linux job fails since #1028 and #1714: guest_video_out_resolution_status aborts when SDL's offscreen
driver has no Vulkan window, and check_skips.py rejects the skips of guest_video_out_wqhd_detection and the
flip tests because "no display" is not among the device limitations it accepts.

The resolution status test now skips with code 77 like its wqhd sibling, the flip tests print the same skip
reason, and check_skips.py accepts "no display" as a device limitation. ANYPS5_REQUIRE_DISPLAY still turns
the skip into a failure.
2026-10-10 02:20:49 +02:00

62 lines
2.1 KiB
C++

#include "SceTypes.hpp"
#include "prx/libc/include/Shutdown.hpp"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <stdexcept>
extern "C" {
int APS5_VABI sceVideoOutOpen(int userId, int busType, int index, const void* param);
int APS5_VABI sceVideoOutClose(int handle);
int APS5_VABI sceVideoOutGetOutputStatus(int handle, VideoOutOutputStatus* status);
int APS5_VABI sceVideoOutGetResolutionStatus(int handle, VideoOutResolutionStatus* status);
}
static constexpr int SYSTEM_USER = 255;
static constexpr int MAIN_BUS = 0;
static constexpr int NEVER_OPENED_HANDLE = 2;
static void Require(bool value) { if (!value) std::abort(); }
static bool Rejects(int handle, VideoOutResolutionStatus* status) {
try {
sceVideoOutGetResolutionStatus(handle, status);
} catch (const std::runtime_error&) {
return true;
}
return false;
}
int main() {
int handle = 0;
try {
handle = sceVideoOutOpen(SYSTEM_USER, MAIN_BUS, 0, nullptr);
} catch (const std::runtime_error& error) {
if (std::getenv("ANYPS5_REQUIRE_DISPLAY") != nullptr) throw;
std::printf("skipped, no display or Vulkan device: %s\n", error.what());
return 77;
}
Require(handle > 0);
VideoOutResolutionStatus status;
std::memset(&status, 0xff, sizeof(status));
Require(sceVideoOutGetResolutionStatus(handle, &status) == 0);
Require(status.fullWidth == 1920 && status.fullHeight == 1080);
Require(status.paneWidth == status.fullWidth && status.paneHeight == status.fullHeight);
Require(status.screenSizeInInch == 0.0f && status.flags == 0 && status.reserved0 == 0);
Require(status.reserved1[0] == 0 && status.reserved1[1] == 0 && status.reserved1[2] == 0);
VideoOutOutputStatus output{};
Require(sceVideoOutGetOutputStatus(handle, &output) == 0);
Require(status.refreshRate == output.refreshRate);
Require(Rejects(handle, nullptr));
Require(Rejects(0, &status));
Require(Rejects(-1, &status));
Require(Rejects(NEVER_OPENED_HANDLE, &status));
Require(sceVideoOutClose(handle) == 0);
Require(Rejects(handle, &status));
LibcRunShutdown_nid_postfix();
}