Writing to the XFB -- when is it doable properly? March 23, 2013 06:00PM | Registered: 10 years ago Posts: 16 |
Re: Writing to the XFB -- when is it doable properly? March 24, 2013 12:58AM | Moderator Registered: 13 years ago Posts: 686 |
Re: Writing to the XFB -- when is it doable properly? March 24, 2013 04:47AM | Registered: 12 years ago Posts: 19 |
Re: Writing to the XFB -- when is it doable properly? March 24, 2013 12:51PM | Registered: 10 years ago Posts: 16 |
I considered it. Only issue is that it'd take about 614K of RAM, and I want my debug screen code to be the smallest possible, to not steal too much RAM to the game itself.Quote
tueidj
If it's for a crash log only, why not use a different area of memory to create your blue screen of death and then put the address in the XFB register when it's ready for display?
I didn't think about the CPU cache, and hey it makes a whole lot of sense. I'm going to try with an uncached address.Quote
Extrems
It sounds like you're using the cached address.
Re: Writing to the XFB -- when is it doable properly? March 25, 2013 01:24AM | Moderator Registered: 13 years ago Posts: 686 |
But if it's for a crash dump the memory doesn't need to be held in reserve, it can be taken from plenty of places since the game is no longer going to run...Quote
Mega_Mario
I considered it. Only issue is that it'd take about 614K of RAM, and I want my debug screen code to be the smallest possible, to not steal too much RAM to the game itself.
One possibility, however, would be to take from the game's heap...
You definitely don't want to disable either cache (instruction or data). Nearly all wii games use identical cache/BAT setup and libogc copied it so it shouldn't be an issue.Quote
I didn't think about the CPU cache, and hey it makes a whole lot of sense. I'm going to try with an uncached address.
I might also want to look into how to disable the cache, as I'm not sure that SMG2 uses the same cache setup as libogc...
You can only use 32-bit writes with uncached memory unless you really know what you're doing - basically any writes smaller than 32 bits will get repeated within their 8-byte region. It's also horribly slow.Quote
Edit- I changed my code to add 0xC0000000 to the physical XFB address instead of 0x80000000. The screen was properly filled, but not the right color, and the characters were half broken. As if the writes were still failing 1/4 of the time or something....
I figured that perhaps 8-bit writes don't work that well, and changed the code to use 32-bit writes. That resulted in a black screen.
Re: Writing to the XFB -- when is it doable properly? March 25, 2013 08:35PM | Registered: 10 years ago Posts: 16 |
Right. I could take it, say, at the end of the game heap...Quote
tueidjBut if it's for a crash dump the memory doesn't need to be held in reserve, it can be taken from plenty of places since the game is no longer going to run...Quote
Mega_Mario
I considered it. Only issue is that it'd take about 614K of RAM, and I want my debug screen code to be the smallest possible, to not steal too much RAM to the game itself.
One possibility, however, would be to take from the game's heap...
Indeed. I figured I wasn't going to take unneeded overcomplication unless SMG2 used a different cache/memory setup than other games. I was just considering it as one of the last-resort options.Quote
tueidjYou definitely don't want to disable either cache (instruction or data). Nearly all wii games use identical cache/BAT setup and libogc copied it so it shouldn't be an issue.Quote
I didn't think about the CPU cache, and hey it makes a whole lot of sense. I'm going to try with an uncached address.
I might also want to look into how to disable the cache, as I'm not sure that SMG2 uses the same cache setup as libogc...
That seems like a perfect idea! I'm going to try it out.Quote
tueidjYou can only use 32-bit writes with uncached memory unless you really know what you're doing - basically any writes smaller than 32 bits will get repeated within their 8-byte region. It's also horribly slow.Quote
Edit- I changed my code to add 0xC0000000 to the physical XFB address instead of 0x80000000. The screen was properly filled, but not the right color, and the characters were half broken. As if the writes were still failing 1/4 of the time or something....
I figured that perhaps 8-bit writes don't work that well, and changed the code to use 32-bit writes. That resulted in a black screen.
Write to XFB cached memory then use DCFlushRange (when you've completed the entire XFB) to make sure the physical memory is updated.