gx: fix application hang on GPU FIFO overflow#264
Closed
mardy wants to merge 1 commit intodevkitPro:masterfrom
Closed
gx: fix application hang on GPU FIFO overflow#264mardy wants to merge 1 commit intodevkitPro:masterfrom
mardy wants to merge 1 commit intodevkitPro:masterfrom
Conversation
This fixes a bug which began to manifest itself after the switch to Tuxedo, though we haven't been able to find anything wrong with Tuxedo's implementation -- we cannot even rule out that this is due to a compiler / toolkit update, though this seems less likely. The bug happens when the FIFO gets full and both the overflow and underflow status bits are set: the overflow handler suspends (with LWP_SuspendThread()) the graphical thread, which often is the application main thread, after which the underflow handler is never invoked anymore, so the graphical thread remains stopped. Other threads continue to work (wiimotes do connect to the Wii). Why exactly the underflow handler is not invoked anymore is unclear. The solution (or rather workaround) is to clear both the FIFO overflow bit (obviously) and the underflow one, despite the fact that this should have already been done by the underflow handler. Another workaround which has been shown to be working is adding an `else` before the check for the overflow bits, in order not to immediately invoke the overflow handler if we just invoked the underflow one. Should we for some reason need to revert this commit, that is another path that could be taken. Fixes: devkitPro#262
Member
|
As discussed privately, we are still actively trying to locate and fix the real cause of the problem. I found and fixed a relevant threading issue, however it still doesn't seem to be enough. Users who run into this GX FIFO overflow issue should consider instead increasing the size of the GX FIFO buffer (or optimizing their command usage), which is generally a better idea for performance if you're running into GX FIFO overflows in the first place. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes a bug which began to manifest itself after the switch to Tuxedo, though we haven't been able to find anything wrong with Tuxedo's implementation -- we cannot even rule out that this is due to a compiler / toolkit update, though this seems less likely.
The bug happens when the FIFO gets full and both the overflow and underflow status bits are set: the overflow handler suspends (with LWP_SuspendThread()) the graphical thread, which often is the application main thread, after which the underflow handler is never invoked anymore, so the graphical thread remains stopped. Other threads continue to work (wiimotes do connect to the Wii). Why exactly the underflow handler is not invoked anymore is unclear.
The solution (or rather workaround) is to clear both the FIFO overflow bit (obviously) and the underflow one, despite the fact that this should have already been done by the underflow handler.
Another workaround which has been shown to be working is adding an
elsebefore the check for the overflow bits, in order not to immediately invoke the overflow handler if we just invoked the underflow one. Should we for some reason need to revert this commit, that is another path that could be taken.Fixes: #262