Skip to content

Out of order flip IRQ fix#4183

Draft
Kravickas wants to merge 3 commits intoshadps4-emu:mainfrom
Kravickas:IRQv5
Draft

Out of order flip IRQ fix#4183
Kravickas wants to merge 3 commits intoshadps4-emu:mainfrom
Kravickas:IRQv5

Conversation

@Kravickas
Copy link
Copy Markdown
Contributor

Crash:
ASSERT_MSG(port->buffer_labels[buf_id] == 1, "Out of order flip IRQ")

Main:
sceVideoOutSubmitEopFlip pushes a callback into a FIFO (RegisterOnce). The callback has buf_id baked in. When GPU finishes, Signal(GfxFlip) grabs the first one in line. With multiple flips queued, that's not necessarily the one that belongs to the submission that just finished — buffer_labels[buf_id] isn't set for it, assert crashes.

PR:
PatchFlipRequest still writes buf_id and flip_arg into the NOP data block in the command buffer. But instead of pushing a callback into the FIFO via RegisterOnce, the flip data is passed to SubmitGfx as optional and stored alongside the task in Liverpool's submission queue. When a submission completes (task.done()), Liverpool checks if that specific submission has a flip attached. If it does, it calls EnqueueFlip with that submission's own buf_id and flip_arg — not whatever happens to be at the front of a shared queue.

Main: NHL 19 - playing for ~10min - ooof IRQ assert.
PR: NHL 19 - playing for 1h 50min - no crash.

Thoughts ?
Players can try to break it.

@tochnonechelovek
Copy link
Copy Markdown

No regressions in my titles.

@Okanox
Copy link
Copy Markdown

Okanox commented Mar 29, 2026

Repost of previously deleted comment:
This may entirely be on my end only, posting it just in case.

It took a while but after about an hour of testing i encountered a silent crash, testing with NHL 18: #4125
CUSA07569.log

Apart from that i believe the IRQ flip to be fixed for this game after multiple tests i haven't encountered other "Out of order flip IRQ" from this PR. 👍

@Parotaku
Copy link
Copy Markdown

Parotaku commented Apr 4, 2026

This seems to fix Dark Souls 3 random crashes (or I was very lucky!).
So that's a big + for me...

EDIT:
Yup, just beat the crystal sages (a long fight which always crashed sooner or later before) so that's definately helped...
It does not however fix the 'outofdevicememory' crash (when too much environnement assets are loaded too fast) but it's OK as it's a totaly different problem...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants