6.8 KiB
Integrating with GPU
Introduction
The graphics stack on Linux has had a long evolution.
Initially, graphics applications on Linux mainly used the old SVGALib
;
the Linux kernel did not provide any driver for graphics or GPU.
In 2000s, the Linux kernel introduced the frame buffer driver to support
the various graphics devices. However, the frame buffer driver did not provide
a good implementation to support modern GPUs. If a software want to use
the powerful GPU functions to render 3D objects, it has to write a lot of
code for a specific GPU in application space. For desktop systems,
it is not a problem, because the XFree86 project provided a complete
graphics stack for 2D/3D rendering. But it is a nightmare for embedded systems.
Around 2010, the Free Destkop project introduced a new graphics stack for Linux system called DRI (Direct Rendering Infrastructure). As the name suggests, DRI provides applications with the ability to directly access the GPU for 2D/3D rendering. With or without X Window, applications can get the direct GPU rendering capabilities through DRI. This greatly improves the performance and user experience of Linux desktop systems.
After more than ten years of development, DRI technology has matured. Now, Linux-based desktop systems have switched from the traditional frame buffer driver to DRI. And the Linux-based embedded systems are switching from frame buffer to DRI.
Therefore, we introduced the support DRI in MiniGUI version 4.0.4, and developed the EGL implementation for MiniGUI based on Mesa, also the MiniGUI backend for Cairo.
Now, it is very easy to integrate MiniGUI with your GPU. Your MiniGUI app can exploit the GPU accelerated functions to render 2D/3D objects.
Architecture and Infrastructure
In practice, MiniGUI and the software which are used to integrated with GPU constitute the graphics stack of HybridOS.
HybridOS is a totally new open source operating system designed for smart IoT devices and cloud computing environment. FMSoft Technologies, who is the developer of MiniGUI, initiated HybridOS project in 2018.
HybridOS uses MiniGUI as the underlying windowing system, and the members of HybridOS project are now maintaining the graphics stack.
The following chart shows the graphics stack of HybridOS:
-----------------------------------------------
| MiniGUI/HybridOS Apps |
|-----------------------------------------------|
| | (Graphics Stack) |
| | ---------------------|
| | | hiMesa |
| | hiCairo | ------------------|
| | MiniGUI | | EGL for MiniGUI |
| C++ libs | hiDRMDrivers | | GL, GLES, VG |
| C libs | hiDRM | | GPU drivers |
|-----------------------------------------------|
| Linux Kernel |
| -----------------------------------|
| | DRI and DRI Drivers |
-----------------------------------------------
As shown in the chart above, the HybridOS graphics stack consists of the following software:
- hiDRM is the LibDRM derivative for HybridOS.
- hiDRMDrivers contains the drivers for MiniGUI DRM engine.
- hiMesa is the Mesa derivative
for HybridOS. It contains the following components:
- The OpenGL, OpenGL ES v2, OpenGL ES v3 APIs and implementations.
- The EGL implementation for MiniGUI platform.
- The drivers for various GPUs.
- hiCairo is the Cairo derivative for HybridOS. Cairo is the 2D vector graphics library for Gtk. We provide support for MiniGUI backend in hiCairo.
You can use the following script to fetch the source code of above software:
#!/bin/bash
# Use this if you want to visit GitHub via HTTPS
REPO_URL=https://github.com/FMSoftCN
# Use this one if you can visit GitHub via SSH
#REPO_URL=git@github.com:FMSoftCN
# Use this one if you are a developer of MiniGUI/HybridOS
#REPO_URL=git4os@gitlab.fmsoft.cn:hybridos
git clone $REPO_URL/hidrm -b hybridos
git clone $REPO_URL/hidrmdrivers
git clone $REPO_URL/hicairo -b minigui-backend
git clone $REPO_URL/himesa -b minigui-backend
The software all ship with the GNU autotools building scripts or the meson building scripts. You can refer to the README file for the instructions to build and install the software to your system.
NOTE The above fetching script may changed in the future.
The EGL Implementation for MiniGUI
3D Rendering on MiniGUI
Cairo and MiniGUI
<< Using mGPlus for Vector Graphics | Table of Contents | Using mGEff for Visual Effects and Animations >>