mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-25 11:34:55 +00:00
video_out: using mutex and lockguard to prevent race conditions, updating buffer labels and adding buffer id for flip sumission error.
This commit is contained in:
parent
c09e463b8e
commit
61ce2c4294
@ -67,7 +67,7 @@ void VideoOutDriver::Close(s32 handle) {
|
||||
ASSERT(main_port.flip_events.empty());
|
||||
}
|
||||
|
||||
VideoOutPort* VideoOutDriver::GetPort(int handle) {
|
||||
VideoOutPort* VideoOutDriver::GetPort(s32 handle) {
|
||||
if (handle != 1) [[unlikely]] {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -339,13 +339,25 @@ s32 sceVideoOutSubmitEopFlip(s32 handle, u32 buf_id, u32 mode, u32 arg, void** u
|
||||
return ORBIS_VIDEO_OUT_ERROR_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
Platform::IrqC::Instance()->RegisterOnce(
|
||||
Platform::InterruptId::GfxFlip, [=](Platform::InterruptId irq) {
|
||||
ASSERT_MSG(irq == Platform::InterruptId::GfxFlip, "An unexpected IRQ occured");
|
||||
ASSERT_MSG(port->buffer_labels[buf_id] == 1, "Out of order flip IRQ");
|
||||
const auto result = driver->SubmitFlip(port, buf_id, arg, true);
|
||||
ASSERT_MSG(result, "EOP flip submission failed");
|
||||
});
|
||||
static std::mutex irq_mutex;
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(irq_mutex);
|
||||
|
||||
Platform::IrqC::Instance()->RegisterOnce(
|
||||
Platform::InterruptId::GfxFlip, [=](Platform::InterruptId irq) {
|
||||
ASSERT_MSG(irq == Platform::InterruptId::GfxFlip, "Unexpected IRQ occurred");
|
||||
ASSERT_MSG(port->buffer_labels[buf_id] == 1, "Out-of-order flip IRQ");
|
||||
|
||||
const auto result = driver->SubmitFlip(port, buf_id, arg, true);
|
||||
if (!result) {
|
||||
LOG_ERROR(Lib_VideoOut, "EOP flip submission failed for buffer {}", buf_id);
|
||||
return;
|
||||
}
|
||||
|
||||
port->buffer_labels[buf_id] = 0;
|
||||
});
|
||||
}
|
||||
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user