OpenVG is great for embedded 2D graphics apps

August 30, 2017 Matteo Muratori

OpenVG is an API designed by the Khronos Group for accelerating 2D vector graphics. It helps manufacturers create more attractive user interfaces by offloading computationally intensive graphics processing from the CPU onto a GPU to save energy. It can be used across many platforms, including a number of embedded applications.

OpenVG handles two types of drawing objects, bitmap and vector. For bitmap, a memory organization is used to store an image. Each pixel is assigned an alpha, red, green, and blue (ARGB) value. Thus, the storage requirement for a 300- by 150-pixel image would be 300×150 times the number of bytes/pixel. Bitmaps are particularly useful for photorealistic graphics. An application that makes great use of bitmaps is a coverflow-like song/movie browser.

Vector is a mathematical formulation for graphics that requires control points. Depending on how those points are connected, additional parameters may be required, such as handlers, arc radiuses, and angles. This feature makes a vector fully scalable, as it doesn’t rely on per-pixel data to represent an image. Vector graphics represent the real power of the OpenVG API and are suited for embedded platforms like automotive, set-top-boxes, mobile handsets, where supporting different resolutions is mandatory.

OpenGL can accomplish many graphical tasks, such as 3D texture models, 3D GUIs and HMI. However, its strength lies in convex polygons and texture pushing power. OpenGL is bitmap-oriented, and simple graphics can take precious time from that powerful OpenGL core. OpenVG closes the gap on graphical needs providing for great applications, and in combination with OpenGL, it can manage fonts, vectors, and most 2D and pseudo 3D elements, while an OpenGL core dedicates its time to doing what it does best. When you need straight 2D graphics, OpenVG is very handy and doesn't require all the knowledge you need to master OpenGL and OpenGL ES.

Many embedded video processors have a working OpenVG driver. For example, Broadcom VC4 (that equips Raspberry Pi) comes with a fully working OpenVG implementation, and ARM Mali and others have an OpenVG driver too.

But not all embedded video chips offer OpenVG support, and even when they do, they can’t cover all the operating systems, which is where OpenVG implementations like AmanithVG can help. AmanithVG implements the OpenVG 1.1 API and supports Linux (and other OSs) as a first-class citizen, as well as several embedded processor architectures (arm, arm-v6hf, arm-v7a, aarch64, mipsel, mips64el, pppc64el, x86, x86_64). The public SDK is freely available on GitHub, along with a set of ten tutorials covering several OpenVG API features. For Linux developers in particular, because OpenVG related stuff was kicked from Mesa, it could be an interesting experiment using the OpenVG API through AmanithVG implementation, as it remains consistent across several platforms.

Matteo Muratori is the CTO of Mazatech S.r.l., an Italian startup that develops technologies for real-time vector graphics.

Previous Article
RTOS debugging, part 2: Your tasks need that CPU; don’t starve them of it

In embedded systems using multitasking, you may run into a situation where some of your tasks run slowly or...

Next Article
RTOS debugging, part 1: Dealing with timing issues
RTOS debugging, part 1: Dealing with timing issues

There are several reasons that debugging an RTOS system is different from debugging a single-threaded “supe...