Skip to content

Fix Rosalina menu freeze caused by race condition with GSP/GPU#2232

Open
RedShyGuy wants to merge 1 commit intoLumaTeam:masterfrom
RedShyGuy:bugfix/fixFreezingIssues
Open

Fix Rosalina menu freeze caused by race condition with GSP/GPU#2232
RedShyGuy wants to merge 1 commit intoLumaTeam:masterfrom
RedShyGuy:bugfix/fixFreezingIssues

Conversation

@RedShyGuy
Copy link
Copy Markdown

The Rosalina menu open/close used svcKernelSetState(0x10000, 2 | 1) to freeze both game threads and GSP simultaneously.
This sometimes caused freezes because GSP could be mid-command when frozen. Any pending GPU completions were never delivered, leaving the game in a deadlocked state on resume, forcing the user to force shut down the system.

Changes (menu.c):

menuEnter: Split the single atomic freeze into a 3-phase sequence:

  • freeze game threads first (flag 1) to stop new GPU command submissions
  • busy-wait loop (up to 8 iterations) for GPU engines (PSC0, PSC1, Transfer, Cmdlist) to drain, with sleeps between checks to let GSP process its FIFO
  • freeze GSP (flag 2) only after GPU is confirmed idle
  • on framebuffer allocation failure also now uses the correct sequenced unfreeze

menuLeave:

  • unfreeze GSP first with a 2ms delay so it can process any pending hardware interrupts before game threads resume and read the queue

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.

1 participant