I am interested in using an SPI Display with the Rasperry Pi in assembly(such as the PITFT from Adafruit). I think I could work out how to get it working using the CPU, but is there a way of getting the GPU to output screen data over SPI? And what would this involve?

What do you expect from involving the GPU ? Do you need 3D acceleration ?

ghans

• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

I would want to use the GPU to free up power on the CPU for processing. I was under the impression that it would take up quite a bit of CPU time to run the screen off it. Am I wrong in thinking that? Would the CPU still be able to carry out processor intensive tasks without much loss of speed?
And to answer your question, no, I'm not planning on using 3D graphics.

I think you will be fine . If Linux and fbtft managed it with around 50 17 % CPU usage on the single-core models , so should you.
Getting the GPU involved will complicate things extremely.

ghans

Last edited by ghans on Tue Dec 12, 2017 8:31 am, edited 1 time in total.

• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

I was looking for a way to do exactly the same thing. On a single core Zero Adafruit's userspace tftcp uses about 17% CPU. The only workaround I see is that whatever you write to the tft stays there until you write something else so it doesn't need continuous updates, certainly not 30 times per second.

Actually after some Googling for ILI9341 commands it seems these are quite common, sold by several companies. You can find the bare display on Aliexpress for about $12 delivered (possibly without the touch part). Adafruit did some valid work on them, they sell them for Arduinos too. So it's good to buy at least 1 from Adafruit but if I get this working the way I want I'll probably pick up a few more through Aliexpress. There's now an spidev Linux kernel driver.

There is mention that the display also has an 18 bit color mode, 6 each for rgb. Not sure if it's worth using but I never liked rgb565 or whatever. There's a ton of documentation out there. Some of the ILI9341 commands used in the Adafruit code I can't find documented as to what they do.

Can the GPU access the GPIO? I would think that could be a bottleneck since the SPI is really a few pins of the GPIO. If the CPU has to relay everything that doesn't sound like much of a speedup.

The fbtft and fbcp programs are generalized to work with any program which outputs to a framebuffer and translate that into a reasonable way to talk to an SPI connected LCD. The performance hit is because fbcp constantly copies the entire framebuffer to the virtual framebuffer created by fbtft (even if nothing changes on the display). This is very wasteful if your code can specify when and where you want to draw on the display. I wrote a simpler and faster way to access SPI LCD displays (https://github.com/bitbank2/SPI_LCD). It requires your code to explicitly call functions to draw text, pixels and bitmaps. If your app doesn't need to do frequent updates to the display, you'll use very little CPU. This task doesn't make any sense for a GPU to do.

Given that the focus of this forum is on bare metal development and all of the solutions presented so far focus on Linux , here is an Ultibo example of rendering OpenGL ES on the GPU and outputting the result on an SPI display (HX8357 TFT LCD) completely without Linux.

This uses the Asphyre/PXL framework which has been ported to Ultibo and makes doing OpenGL ES a lot more friendly, but you could also do the same with standard GLES functions and direct access to the TFT framebuffer.

Just to show it can be done without that L word

Ultibo.org | Make something amazing
https://ultibo.org

Threads, multi-core, OpenGL, Camera, FAT, NTFS, TCP/IP, USB and more in 3MB with 2 second boot!