Merge pull request #1225 from Pedroj-64/fix/video-out-present-shutdown-failure

fix(videoout): report GPU driver shutdown failure from the present thread at Shutdown
This commit is contained in:
Adrià 2026-10-10 01:10:19 +02:00 committed by GitHub
commit 58706dc2d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 27 additions and 2 deletions

View File

@ -31,6 +31,21 @@ target_include_directories(video_out_flip_tests PRIVATE ${LIBS_INCLUDE_DIR} ${CM
target_link_libraries(video_out_flip_tests PRIVATE libSceVideoOut libSceAgcDriver libkernel libc)
set_target_properties(video_out_flip_tests PROPERTIES CXX_EXTENSIONS OFF)
configure_windows_unwind(video_out_flip_tests)
if(BUILD_TESTING)
set_target_properties(video_out_flip_tests PROPERTIES EXCLUDE_FROM_ALL OFF)
foreach(flipMode IN ITEMS lifetime decode controls)
if(flipMode STREQUAL "lifetime")
add_test(NAME video_out_flip_${flipMode} COMMAND video_out_flip_tests)
else()
add_test(NAME video_out_flip_${flipMode} COMMAND video_out_flip_tests ${flipMode})
endif()
set_tests_properties(video_out_flip_${flipMode} PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77 ENVIRONMENT "SDL_VIDEODRIVER=offscreen")
if(WIN32)
set_tests_properties(video_out_flip_${flipMode} PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
endif()
endforeach()
endif()
if(BUILD_TESTING)
add_test_executable(pad_sdl_tests tests/PadSdl.cpp)

View File

@ -576,7 +576,12 @@ void VideoOutDriver::presentLoop(std::stop_token token, std::promise<void>& star
cancelled.swap(flipQueue->requests);
}
}
AgcDriverShutdown_nid_postfix();
try {
AgcDriverShutdown_nid_postfix();
} catch (...) {
std::lock_guard lock(flipQueue->mutex);
if (!flipQueue->failure) flipQueue->failure = std::current_exception();
}
window.Destroy();
}

View File

@ -13,6 +13,9 @@
#include <chrono>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <filesystem>
#include <fstream>
#include <initializer_list>
#include <string>
#include <limits>
@ -542,6 +545,8 @@ void testOneDevice() {
int main(int argc, char** argv) {
try {
std::filesystem::create_directories("app0/sce_sys");
std::ofstream("app0/sce_sys/param.json", std::ios::binary) << R"({"titleId":"PPSA00000","localizedParameters":{"en-US":{"titleName":"Example"}},"downloadDataSize":0})";
if (argc == 2 && std::string(argv[1]) == "decode") testDecode();
else if (argc == 2 && std::string(argv[1]) == "controls") testControls();
else if (argc == 2 && std::string(argv[1]) == "present") testPresentation();
@ -558,6 +563,7 @@ int main(int argc, char** argv) {
std::fprintf(stderr, "%s\n", error.what());
try { LibcRunShutdown_nid_postfix(); }
catch (const std::exception& shutdown) { std::fprintf(stderr, "shutdown: %s\n", shutdown.what()); }
if (std::string(error.what()).find("Vulkan support") != std::string::npos && !std::getenv("ANYPS5_REQUIRE_DISPLAY")) return 77;
return 1;
}
}

View File

@ -7,7 +7,6 @@ TEST_OUTPUT = r"tests[\\/]"
KNOWN_UNRUN = {
"agc_driver_recorder_tests",
"video_out_flip_tests",
}