BUG Report: Mikmodlib svnrev 2254 incompatibility with VFPU

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

BUG Report: Mikmodlib svnrev 2254 incompatibility with VFPU

Post by KickinAezz »

Just this simple line:

PSP_MAIN_THREAD_ATTR(THREAD_ATTR_VFPU);

Prevents any sound coming/playing.... By removing it everything is fine without using the VFPU I wouldn't be able to do much optimization!

I have tested it THRICE with Wavloader[by Insomnaic197 i.e I_W_N]. Try it with the included samples.
----


Please help.
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

are you sure you are not using the vfpu thruout more than one thread ?
if you do you might just be trashing the vfpu state and so try to keep
most if not ALL uses of vfpu into a single thread and then have that thread
export any functions to allow other threads access to the vfpu thread functions
10011011 00101010 11010111 10001001 10111010
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

AFAIK not using THREAD_ATTR_VFPU leads to an exception when running VFPU instructions, else between threads the VFPU state is saved/restored. So i would expect two possibilities :

1)
- Entering a NO VFPU thread would save VFPU state in the old thread and disable coprocessor 2 (VFPU).
- Entering a VFPU thread would enable coprocessor and restore VFPU state for the new thread.

2)
- Entering a NO VFPU thread would disable coprocessor 2 (VFPU).
- Entering a VFPU thread would enable coprocessor and save VFPU state in the old VFPU owner thread and restore VFPU state for the new VFPU thread.

the 2) would be better because if you have only one VFPU thread you don't need to save/restore VFPU state.

If not, it would be a very bad design comming from SONY engineers !
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

Oh i DO remember one thing we check with [MrMrIce] :

you CANNOT use VFPU in callback functions, especially when they use their own thread. We tried a GE callback but we failed because it seems the callback is executed in a different thread (a protected one ? the current thread which can be a NO VFPU thread when the callback is called ?).

So, just a question, do you use VFPU in a callback function for sound ?
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

welcome back hlide ..sux to here you have no net at your home ...bummer
10011011 00101010 11010111 10001001 10111010
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

well...

Post by KickinAezz »

I wish I knew such complicated things....

Would it help if I post what I am doing? [I was trying to use MrMrice's Psp Math lib.]
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Well. Caught the culprit...

Post by KickinAezz »

It Happens only in Kernel Mode not in User mode.

The above phenomenon happens.

Files Attached below.

http://www.sendspace.com/file/l0z79a --- WAV player w/out VFPU usage works totally fine.

http://www.sendspace.com/file/d7dhdy -- VFPU attr --- The actual problems in this -- Doesn't play the sound at all.

Mikmodlib needs to installed for this to work.
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

huh i'm no net at home so i cannot dl them :///

my internet box is not working and i'm still waiting for an hypothetical exchange (two weeks and still they didn't send a new one as promised)

*sigh*

as i said : if you are running VFPU in a callback, this may be a problem.

you may need to have a VFPU thread which waits for an event. Your callback should send an event to wake up this thread instead of VFPUing directly. Sure, it sucks...

So you say this happens at kernel mode ? hummm... should a callback have a different behavior ? maybe a callback needs a special context when in kernel mode lest a callback function should mess up and endanger the operating system (like a Blue Screen Of Death or freezing) ???
not clear...
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

Ok, Would it help if I put the source code in CODE tags... ?
Post Reply