Solution for " White Screen of Death "
-
I've been working hard on this over the last couple of days. I wasn't happy with the jerkiness that is introduced when the memory limit is reached, especially as we have some CPU cores sitting there idle.
After some experimentation, I determined it would be too hard to make the current TextureResource load in a background thread so I've done some fairly extensive surgery on this area to tidy the code up, provide a maximum VRAM limit as before but reload images from disk when needed in a separate worker thread, instead displaying a placeholder image whilst it's loading.
I've just got it to the stage where I can try it out on a RPi3 and I'm pleased to say it runs as smoothly as anything. I've still got some work to do (SVGs often render upside down, add some more thread safety and I would like to blend from the transition image to the loaded image rather than just 'jumping') but it's looking good.
-
@fieldofcows sounds great :)
-
@fieldofcows I second what @BuZz said- sounds great! Let me know when you have another version that you'd like me to test, or if you'd like some help on the dev side.
-
Thanks guys - I was very wary of submitting the previous fix. I can just imagine new users that have never seen a WSOD saying "I've added 20 systems and ES has gone slow and jerky". Hopefully the new fix will solve all that.
-
@fieldofcows impressive work!
-
@fieldofcows said in Solution for " White Screen of Death ":
I can just imagine new users that have never seen a WSOD saying "I've added 20 systems and ES has gone slow and jerky".
That level of consideration is much appreciated. Thanks for all your hard work!
-
The threading is working really well. Everything runs really smoothly with late-loading images fading into view when ready without too much distraction for the user. I'm not quite ready to say it's finished yet but if anyone wants to try it they can get it here:
https://github.com/fieldofcows/EmulationStation/releases/tag/v0.3-RPi-2
Same instructions as I provided in a previous post.
This release is for testing only and has some known issues:
- Textures are not always rendered after changing themes
- Sometimes carousel images are rendered the wrong size (observed only once)
- Opacity of loading image is sometimes incorrect
In addition, more testing needs to be applied to the following areas:
- Launching and resuming from a game
- Video preview - as yet completely untested but has been reworked
- General stability
Adding threading to something that was not designed for it is always a daunting task so the more testers the better :)
-
Just in case anyone else is following the same steps as in the earlier post, don't forget to delete the old emulationstation file you downloaded previously (if you tested the previous version using the same steps). I forgot to do that the first time and then wondered why it looked the same...
@fieldofcows this version is much smoother. The loading hiccup is basically gone now. Thank you! I also really like the new fade-in effect for background images (I tested with both a slide and fade transition as well). I was able to get it to where some background images didn't load, however (just the white screen as the background). I was trying to scroll through the carousel as rapidly as possible, and eventually some just decided never to load again. I noticed when this happened that the VRAM was well above my 100mb cutoff (at about 150-160 of the 167.26 theoretical max displayed). If I drilled into a system, it did seem to flush the excess down, and then scrolling through the carousel until another image had to be unloaded seemed to get it working as it should again.
Interestingly, sometimes the backgrounds would be already loaded, but the system name in the center of the gray carousel bar had to be loaded, which is an interesting visual effect with the fade in when it loads. Personally, I think I like having that center name portion not fade in, so I'd prefer to have them all loaded before the background images, but I'm sure others will feel differently. I have not been able to replicate the "image being rendered the wrong size" issue you mentioned. Images to the left and right of the center are drawn slightly smaller than the center system name, and at a different opacity, but once in the center, they always looked normal to me.
When switching themes, I did see that background textures often didn't load at first. Drilling into a system and back out helped fix this (drilling in appears to cause the VRAM to be purged back below the threshold I set, default of 100mb). I did also notice some corrupted text graphics in the menu after switching themes as well. All first-level menu text was fine, but drilling into any menu item showed odd symbols in place of some text controls (but not all).
The video preview stuff appears to be having problems. Although I haven't scraped my videos the way the OldRoom theme expects it, videos played there, but were interlaced with black frames. After switching back to my modified tronkyfran theme (without specific video support, but where videos still used to display just fine), looking at a game with a video actually froze the Pi and required a reboot. While shutting down (I use an ATXRasPi for power control), I noticed an error message (I think three of them) about a buffer underrun, but wasn't able to see enough of it to provide more details. If you can point me to the relevant log files, I can paste them, upload them, or email them to you, whichever you prefer.
After a clean reboot, I did some "normal" testing instead of trying to break things. Video previews played just fine, at least for a little while. After scrolling through several games with video previews, the videos stopped loading, and I got a white texture instead, although I was hearing the audio of the video play. If I started a game and then exited, videos showed with a black screen, but audio for them played normally.
As far as launching games goes, I have not noticed any problems with launching games or playing games. I tested about a dozen games on several different systems, all seemed normal to me.
All in all, an improvement over the previous patch, but definitely a few kinks to iron out. If You've got ideas for other tests you'd like me to me run, let me know.
-
@MWGemini Thanks a lot for this testing. That really saves me a load of time.
I'm not surprised at the video playback issues as I basically haven't even tried that yet and it takes a different code path to the other images. I'd guess it's not freeing the previous texture on every frame so it (silently) consumes the video RAM. Shouldn't be hard to fix.
Using the 'slide' transition is really pushing the Pi when it is swapping textures. I'm surprised it works as well as it does but yes, there is an issue there where some textures either get stuck in the queue or lost. I think it's related to the theme change issue and just needs hunting down. There are a couple of queues and a number of states each texture can be in now so the logic is fairly tricky to get right without killing performance.
With regards to the carousel, I agree these should be prioritised and loaded up front. It did make a change to make that happen but it doesn't seem to be working 100%. It's only a suggestion to the loader to prioritise those textures so they can be (and it seems they are being) swapped out.
As I said though, this is an early build with known issues. Once these are ironed out I don't see why this can't fix the WSOD problem once and for all.
-
@fieldofcows I actually use the "slide" transition type by default, as I like the way it looks with the tronkyfran theme more than the fade, so it appears I just naturally picked the hardest things for the Pi to do. Figures. :)
As for the video playback, it's quite possible that my videos are not "good", in the sense that I only scraped a few, using an older version of the UXS scraper, and I apparently put the videos in the wrong place, and my themes are not built to support it. That being said, there's definitely a behavior change from stock ES to your dev patch for me, but my configuration might be part of the problem, so having someone else test it would be great.
Either way, I think the WSOD issue is already fixed. It's no longer the "white screen of death", just white textures in certain situations. Maybe we can call it the "white screen of annoyance" now. Much better than death :).
-
I have another version to try. With luck this will be the final version :)
https://github.com/fieldofcows/EmulationStation/releases/tag/v0.3-RPi-3
This fixes all known issues but introduces one very minor one which I'll try to address:
- Maximum possible texture memory is sometimes reported incorrectly
I've tested on my RPi3. Video previews work fine, transitions are smooth using both slide and fade although when sliding fast you just get blank textures until they load. If the theme fits in the allocated VRAM then now on-demand loading should take place.
I worked around a pre-existing bug too where changing themes often resulted in a white screen that was unrelated to RAM.
-
@fieldofcows I will pull that down sometime in the next 36 to 48 hours and run through as thorough a test as I can. A bit busy with work at the moment, so not exactly sure when I will get to it, but definitely within 36 to 48, probably sooner.
-
@fieldofcows Unfortunately I can't help you to test this, I would need to build it for windows, and anyway seems that I don't have WSOD on windows so difficult to help here...
-
Decided to try/test your latest version out... just loaded up the TronyFran theme and noticed an issue. If you go and play a game, exit out, and then go back to the system menus... the system logos don't show up, they are just white boxes (sometimes they are replaced with some box art from the gamelist I was on). All the background images are still there and I can scroll thru them fine but the system logo's essentially disappear. I am using an RPI3 on the latest version of Retropie.
Hope that helps!
-
@sglavach @fieldofcows I can confirm the missing system logos problem (all systems) after exiting a game (from any system). Switching to a different theme fixes this, but that's the only fix I have found so far. When the screen saver kicks in, I can see boxes where the images should be that are a different color than the surrounding carousel bar, but I'm not sure if that means anything to you. I did not experience the box art in place of system logos bug, however.
Other than that, I can't find any flaws. I repeated all of my previous tests, and more. Multiple themes, video previews, entering/exiting games, different transition styles, rapid transitions, slow transitions, etc. I've tried to test both the easiest and most common use cases, and also tried to break it in as many ways I could think of. It's looking pretty solid to me. Great work!
-
-
@fieldofcows Happy to help! If there's more I can do, just ask.
-
Here's another build that fixes the white squares on the system logos after launching a game. I think that was the only remaining issue so hopefully this fix is now complete.
I've given this one a good shake down - in and out of games, changing themes, small themes, large themes, etc. and it is behaving well now.
I've prepared a branch for a PR in the RetroPie fork but it's a BIG change so I would appreciate as many people testing it as possible.
The build for RPi 3 (and I think 2) is here:
https://github.com/fieldofcows/EmulationStation/releases/tag/v0.3-RPi-4
Thanks!
-
@fieldofcows Stick a fork in it, it's done! Ship it! I can't find any flaws or errors or strange behavior. Always happy to try to replicate issues that other users see, and I will also continue to do more testing, but as of right now, it's looking good.
I also tested with one of @Nismo 's older OldRoom themes. Without your code changes, it would've taken 861mb to display. With your changes, it was in the high 90s to low 110s, and every transition was smooth. No dropped textures, no hiccups, no problems at all. Same thing with my modified tronkyfran theme, although the max number on that was only about 168mb.
-
Same results here. No issues to be found as of yet. Looks good!
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.