mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
Merge pull request #72 from boykopovar/fix/stop-if-window-closed
fix(video): terminate process on gpu and presentation thread failures Now, any expression that reaches the handlers of a GPU worker, presentation thread, or vblank calls std::terminate() and terminates the entire process. A closed window is just one of these cases. Previously, the handlers stored and propagated the error, which allowed the process to continue. The normal shutdown with stopping all guest threads is not implemented.
This commit is contained in:
@@ -6144,12 +6144,8 @@ private:
|
||||
} catch (...) {
|
||||
std::fprintf(stderr, "[gpu] worker failed with a non-standard exception\n");
|
||||
}
|
||||
for (const auto& [offset, flip] : submission.flips) flip->Fail(error);
|
||||
ReportFailure(error);
|
||||
{
|
||||
std::lock_guard gpuLock(GuestMemory::GpuMutex());
|
||||
device.reset();
|
||||
}
|
||||
std::fflush(stderr);
|
||||
std::terminate();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <chrono>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <exception>
|
||||
#include <thread>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
@@ -508,31 +509,14 @@ void VideoOutDriver::presentLoop(std::stop_token token) {
|
||||
auto error = std::make_exception_ptr(std::runtime_error("VideoOut: pending flip cancelled during shutdown"));
|
||||
for (auto& request : cancelled) request->Fail(error);
|
||||
}
|
||||
} catch (const std::exception& error) {
|
||||
std::fprintf(stderr, "[videoout] presentation failed: %s\n", error.what());
|
||||
std::fflush(stderr);
|
||||
std::terminate();
|
||||
} catch (...) {
|
||||
auto error = std::current_exception();
|
||||
if (!error) std::terminate();
|
||||
// The driver learns first: the worker no longer waits for the presenter, so a title (or test)
|
||||
// that sees the failed flip's counters must already find the failure in the driver.
|
||||
AgcDriverReportFailure_nid_postfix(error);
|
||||
PadReportInputFailure_nid_postfix(error);
|
||||
if (current) current->Fail(error);
|
||||
std::list<std::shared_ptr<FlipRequest>> failed;
|
||||
{
|
||||
std::lock_guard lock(flipQueue->mutex);
|
||||
flipQueue->failure = error;
|
||||
failed.swap(flipQueue->requests);
|
||||
}
|
||||
for (auto& request : failed) request->Fail(error);
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
for (auto& cfg : contexts) {
|
||||
if (!cfg) continue;
|
||||
std::lock_guard cfgLock(cfg->mutex);
|
||||
if (!cfg->failure) cfg->failure = error;
|
||||
cfg->vblankCond.notify_all();
|
||||
}
|
||||
}
|
||||
flipQueue->changed.notify_all();
|
||||
std::fprintf(stderr, "[videoout] presentation failed with a non-standard exception\n");
|
||||
std::fflush(stderr);
|
||||
std::terminate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,7 +533,13 @@ void VideoOutDriver::vblankLoop(std::stop_token token) {
|
||||
}
|
||||
vblankEnd();
|
||||
}
|
||||
} catch (const std::exception& error) {
|
||||
std::fprintf(stderr, "[videoout] vblank failed: %s\n", error.what());
|
||||
std::fflush(stderr);
|
||||
std::terminate();
|
||||
} catch (...) {
|
||||
AgcDriverReportFailure_nid_postfix(std::current_exception());
|
||||
std::fprintf(stderr, "[videoout] vblank failed with a non-standard exception\n");
|
||||
std::fflush(stderr);
|
||||
std::terminate();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user