ps2dev / gsKit

gsKit is a C interface to the PS2 Graphics Synthesizer
Other
103 stars 27 forks source link

Bugfixes #14

Closed rickgaiser closed 7 years ago

rickgaiser commented 7 years ago

The 12 year old bug causes a memory leak for persistent queues when transferring textures. Most applications don't use persistent queues, and if they do they don't use it for transferring textures. Unfortunately hires mode only uses persistent queues and it made some hires applications crash after a while.

There was also a strange issue with semaphore polling. The semaphores used can be max 1, but somehow I need to poll the semaphore more than once to make it go 0.

sp193 commented 7 years ago

For the EE kernel, SignalSema can cause the semaphore's count to exceed its maximum count (there is no runtime check).

You have a few ways to solve this, IMO: you can either poll sema until you get an error, or invoke SignalSema only when the semaphore's count is 0 (you can check this with ReferSema). Or if you somehow can, make it so that this problem won't occur in the first place. Do you still want me to merge this pull request?

rickgaiser commented 7 years ago

Thank you for the info. If that's how SignalSema works then I think this is a good solution. If you're ok with the solution too then go ahead and merge.

lenoregilbert commented 7 years ago

Hi Guys! This is Chris Gilbert (the original author) and thank you so much for continuing to fix this ancient code, I hope it's still useful to someone :)

If I recall correctly, the Sema stuff was added after I stopped maintaining the project but if you have any other questions please don't hesitate to ask and I will do my best to remember... :)

PS: Please add yourselves to the AUTHORS file!

sp193 commented 7 years ago

Thank you @lancegilbert for your contribution of gsKit!

SignalSema works this way, probably since the first EE kernel version was implemented as such and so SONY just kept all versions that way for backward and forward compatibility. This lack of an explicit check on the semaphore's maximum count before incrementation is only one of the things that don't work in the EE kernel anyway. :P

rickgaiser commented 7 years ago

@lancegilbert sorry for the late reply. gsKit is still being actively used. Just want to thank you for stopping by your old project and creating it in the first place.