mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-26 03:55:37 +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());
|
ASSERT(main_port.flip_events.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoOutPort* VideoOutDriver::GetPort(int handle) {
|
VideoOutPort* VideoOutDriver::GetPort(s32 handle) {
|
||||||
if (handle != 1) [[unlikely]] {
|
if (handle != 1) [[unlikely]] {
|
||||||
return nullptr;
|
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;
|
return ORBIS_VIDEO_OUT_ERROR_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform::IrqC::Instance()->RegisterOnce(
|
static std::mutex irq_mutex;
|
||||||
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");
|
std::lock_guard<std::mutex> lock(irq_mutex);
|
||||||
const auto result = driver->SubmitFlip(port, buf_id, arg, true);
|
|
||||||
ASSERT_MSG(result, "EOP flip submission failed");
|
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;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user