Graphical front panel display

One approach discussed previously, using pygame and libSDL to render on a framebuffer-based display, seems to be in a bit of disarray. The following is a 2019 post regarding woes getting pygame/SDL1.2.x working as one would find on any number of web pages:

Issue using Python3/pygame to output to /dev/fb1 targeting a 2.8" TFT screen

Why not using pygame/SDL1.2.x as instructed in many forums and the adafruit TFT manual?

First, it doesn’t work, at all. I have tried a gazillion versions of libsdl and its dependencies and they all failed consistently. I’ve tried forcing some libsdl versions downgrades, same with pygame version, just to try to get back to what the software was when my TFT screen was released (~2014). Then I aslo tried switching to C and handle SDL2 primitives directly.

Furthermore, SDL1.2 is getting old and I believe it is bad practice to build new code on top of old one. That said, I am still using pygame-1.9.4…

So why not SDL2? Well, they have stopped (or are about to stop) supporting framebuffers. I have not tried their alternative to framebuffers, EGL, as it got more complex the further I digged and it did not look too engaging (so old it felt like necro-browsing). Any fresh help or advice on that would be greatly appreciated BTW.

I thought I would be able to very quickly get WeatherPi_TFT going, but it too depends on just being able to “point” SDL to the framebuffer:

Line 100 in WeatherPiTFT.py:

if config['DISPLAY']['FRAMEBUFFER'] is not False:
    # using the dashboard on a raspberry with TFT displays might make this necessary
    os.putenv('SDL_FBDEV', config['DISPLAY']['FRAMEBUFFER'])
    os.environ["SDL_VIDEODRIVER"] = "fbcon"

A bit of an obstacle there…

I did find lots of interesting things to try on the framebuffer display, based on this Feb 2020 presentation by Nicolas Caramelli (PDF of the slides is available on the page):

Back to the Linux Framebuffer! Linux Framebuffer support in free software
https://archive.fosdem.org/2020/schedule/event/fbdev/

It took me a while to figure out the right incantation for mplayer to get the video sent to /dev/fb1. If anyone wants to try, I had luck with

sudo mplayer -vf scale=320:180 -vo fbdev2:/dev/fb1 <video.mp4>

The right scale to use is a function of the display’s size and the video’s aspect ratio. Video playback was pretty smooth with the SPI interface running at 32 MHz. (I think the C4 might need whatever performance increase awesometic figured out recently.)

I’d still like to figure out how to get WeatherPi_TFT going. Given the much slower speed that it or kodi_panel need for screen updates, I think either would be fine just using python-based copying into the framebuffer.

Cheers,
Matt