mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 21:32:50 +00:00
Workaround segfaults in Vulkan enumeration thread (#9935)
* Workaround segfaults in Vulkan enumeration thread
This commit is contained in:
parent
a4fdbf0a88
commit
52a0b38379
@ -36,7 +36,7 @@ render_creator::render_creator(QObject *parent) : QObject(parent)
|
||||
|
||||
static QStringList compatible_gpus;
|
||||
|
||||
std::thread enum_thread = std::thread([&]
|
||||
auto enum_thread_v = new named_thread("Vulkan Device Enumeration Thread"sv, [&]()
|
||||
{
|
||||
thread_ctrl::scoped_priority low_prio(-1);
|
||||
|
||||
@ -61,6 +61,7 @@ render_creator::render_creator(QObject *parent) : QObject(parent)
|
||||
cond.notify_all();
|
||||
});
|
||||
|
||||
std::unique_ptr<std::remove_pointer_t<decltype(enum_thread_v)>> enum_thread(enum_thread_v);
|
||||
{
|
||||
std::unique_lock lck(mtx);
|
||||
cond.wait_for(lck, std::chrono::seconds(10), [&] { return !thread_running; });
|
||||
@ -68,6 +69,8 @@ render_creator::render_creator(QObject *parent) : QObject(parent)
|
||||
|
||||
if (thread_running)
|
||||
{
|
||||
enum_thread.release(); // Detach thread (destructor is not called)
|
||||
|
||||
cfg_log.error("Vulkan device enumeration timed out");
|
||||
const auto button = QMessageBox::critical(nullptr, tr("Vulkan Check Timeout"),
|
||||
tr("Querying for Vulkan-compatible devices is taking too long. This is usually caused by malfunctioning "
|
||||
@ -75,7 +78,6 @@ render_creator::render_creator(QObject *parent) : QObject(parent)
|
||||
"Selecting ignore starts the emulator without Vulkan support."),
|
||||
QMessageBox::Ignore | QMessageBox::Abort, QMessageBox::Abort);
|
||||
|
||||
enum_thread.detach();
|
||||
if (button != QMessageBox::Ignore)
|
||||
{
|
||||
abort_requested = true;
|
||||
@ -88,7 +90,7 @@ render_creator::render_creator(QObject *parent) : QObject(parent)
|
||||
{
|
||||
supports_vulkan = device_found;
|
||||
vulkan_adapters = std::move(compatible_gpus);
|
||||
enum_thread.join();
|
||||
enum_thread.reset(); // Join thread
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user