White screen problem with Kivy on Raspberry Pi 3 solved

I have developed an application in Python which uses the Kivy framework to implement the user interface. When I tried my application on my Raspberry Pi 3 the result wasn’t what I expected. The screen just turned white. Now the thing is my Raspberry Pi is running with the screen rotated 90 degrees (i.e. display_rotate=3 in /boot/config.sys). So I turned off the screen rotation and tried again. This time it worked and my application started alright. But I needed the screen to be turned 90 degrees. Problem!

I verified the issue with the 3Drendering example that comes with Kivy. Same problem: the example worked fine with no rotation, but resulted in a white screen when the display was turned 90 degrees. Stumped I turned to Google for a solution but to no avail. I had to crack this one myself.

I thought the problem was related to the Kivy framework, since Kivy is what drives the actual UI. But everything looked alright and the logs didn’t show anything noteworthy. In the end it turned out I was right in a way, but the fix was actually on the Raspberry Pi level: I had to increase the GPU memory setting. Increasing from 64 MB to 65 MB was enough to solve the issue for me. Both Kivy’s 3Drendering example and my own application worked as expected and I celebrated my small victory with a cup of black tea.

pi-65mb-gpu-mem

UPDATE: I had to increase the GPU memory even more after encountering the dreaded white screen again. 80 MB is my current bet.

2 Comments

  1. Lomax

    Thank you! I had an issue with a list of kivy labels, where the texts would turn into a black rectangle part way down the list. Spent hours trying to solve it based with the assumption that it was caused by the text overflowing the calculated bounds of the labels – tried everything including changing font, font-size, parent layout type, size, text_size, size_hint, etc, etc, etc. Then suddenly I got the white screen problem you encountered, which led me to your post – to my amazement increasing the video RAM to 128mb not only fixed the white screen problem, but my list of labels now render the text correctly all the way down. Phew!

Leave a Reply