mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-26 12:04:47 +00:00
avoiding deadlocks
This commit is contained in:
parent
8a4eb9ef7a
commit
8beb7a792a
@ -311,18 +311,23 @@ void VideoOutDriver::PresentThread(std::stop_token token) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Flip(request);
|
Flip(request);
|
||||||
|
// add second request to avoid potential deadlocks
|
||||||
|
const auto second = receive_request();
|
||||||
|
if (second) {
|
||||||
|
Flip(second);
|
||||||
{
|
{
|
||||||
std::scoped_lock lock{request.port->port_mutex};
|
std::scoped_lock lock{second.port->port_mutex};
|
||||||
request.port->flip_status.flip_pending_num--;
|
second.port->flip_status.flip_pending_num--;
|
||||||
if (request.eop) {
|
if (second.eop) {
|
||||||
request.port->flip_status.gc_queue_num--;
|
second.port->flip_status.gc_queue_num--;
|
||||||
}
|
}
|
||||||
request.port->vo_cv
|
second.port->vo_cv
|
||||||
.notify_one(); // this wake up threads waiting to submit more flips
|
.notify_all(); // wake up threads waiting to submit more flips
|
||||||
}
|
}
|
||||||
FRAME_END;
|
FRAME_END;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Needs lock here as can be concurrently read by `sceVideoOutGetVblankStatus`
|
// Needs lock here as can be concurrently read by `sceVideoOutGetVblankStatus`
|
||||||
|
Loading…
Reference in New Issue
Block a user