MIT-Licensed V3DLib Aims to Simplify Access to the Raspberry Pi's VideoCore GPUs

Built on the earlier QPULib project, V3DLib lets you write programs to run on both the earlier VideoCore IV and the new VideoCore VI.

Developer Wim Rijnders has released a library, V3DLib, which aims to make harnessing the power of the VideoCore graphics processors on Raspberry Pi single-board computers (SBCs) as easy as possible — and it's now compatible with the latest VideoCore VI on the Raspberry Pi 4 and Raspberry Pi 400.

"It hurts me to see the VideoCore GPU so underutilized. There is plenty of GFLOP power available for the price of a RPi," Rijnders writes of the motivation behind his work. "This project, V3dLib, makes programming for the GPU more accessible. It builds upon a previous project, QPULib, and adds support for the Pi 4, which has a different GPU model than its predecessors. Resulting programs can run on any Pi."

Matthew Naylor's earlier QPULib served as the base for V3DLib, but only supported the VideoCore IV GPU found in the Raspberry Pi 3+ family and below — not the significantly more powerful VideoCore VI of the Raspberry Pi 4 and Raspberry Pi 400. With QPULib development ceased, Rijnders forked the project and set about making it compatible with all Raspberry Pi models — an effort which has now reached fruition.

"V3DLib compiles and assembles for both versions of the VideoCore GPU," Rijnders explains. "Kernel programs compile dynamically, so that a given program can run unchanged on any version of the Raspberry Pi. The kernels are generated inline and offloaded to the GPUs at runtime."

"However, there are caveats. There are some parts which will compile perfectly but not run properly; notably the Mandelbrot demo will run sometimes on a VideoCore VI, and otherwise hang. There are also some unit tests which have the same problem, these are disabled when running on VideoCore VI. I haven't been able to resolve these issues and I am waiting for a kernel update with fixes. All code for the VideoCore IV compiles and runs fine."

The library comes complete with a high-level programming language designed to ease development, which can take place directly on the Raspberry Pi with no cross-compilation environment required. Rijnders warns, however, that the initial build of the project can take a long time, "especially on older Pis."

V3DLib is now available on Rijnders' GitHub repository, under the permissive MIT license.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles