Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay singlecore gpu interrupts; Fixes Bomberman Jetters in single core mode. #10244

Merged
merged 1 commit into from Dec 2, 2021

Conversation

phire
Copy link
Member

@phire phire commented Nov 24, 2021

Fixes Bomberman Jetters in single core mode.

When single core mode pauses the CPU to execute the GPU
FIFO it greedily executes the whole thing. Before this commit,
Finish and Token interrupts would happen instantly, not even
taking into account how long the current FIFO window has
taken to execute. The interrupts would be effectively backdated
to the start of this execution window.

This commit does two things: It pipes the current FIFO window
execution time though to the interrupt scheduling and it enforces
a minimum delay of 500 cycles before an interrupt will be fired.

Fixes Bomberman Jetters in single core mode.

When single core mode pauses the CPU to execute the GPU
FIFO it greedily executes the whole thing. Before this commit,
Finish and Token interrupts would happen instantly, not even
taking into account how long the current FIFO window has
taken to execute. The interrupts would be effectively backdated
to the start of this execution window.

This commit does two things: It pipes the current FIFO window
execution time though to the interrupt scheduling and it enforces
a minimum delay of 500 cycles before an interrupt will be fired.
// games time to setup any interrupt state
cycles = std::max(500, cycles_into_future);
}
CoreTiming::ScheduleEvent(cycles, et_SetTokenFinishOnMainThread, 0, from);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm noticing a pre-existing bug here, which I fear I'm making worse.

There is no synchronisation, so if there are many finish or tokens close to each other in the FIFO, they will stomp over each other. The cpu thread will only see a single interrupt, and the token will jump straight to the final value.

This can happen in dual-core mode, randomly if the gpu thread is fast, or the cpu thread is slow.
Before this PR, this can happen in single core mode, but only within a single FIFO window (or if multiple gather-pipe bursts happen within the same JIT block)
After this PR, this can also happen when multiple gather-pipe bursts happen to within 500 cycles of each other.

I fear that this bug needs be fixed before merging this fix, otherwise we risk causing more regressions.

@JMC47
Copy link
Contributor

JMC47 commented Nov 24, 2021

Fixes Resident Evil 3 and Bomberman Jetters in Single Core.

Fixes Advance Game Port and other Datel Loaders that use the same era loader. Requires MMU to be off.

@JMC47
Copy link
Contributor

JMC47 commented Dec 2, 2021

We're going to merge this to see if it breaks anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants