|
| 1 | +# libmali-rockchip |
| 2 | + |
| 3 | +Mali GPU userspace driver binaries for Rockchip SoCs, with a meson build system that wraps them with standard library interfaces (GBM, EGL, GLESv1, GLESv2, Wayland EGL, OpenCL, Vulkan). |
| 4 | + |
| 5 | +## Supported SoCs |
| 6 | + |
| 7 | +| GPU | SoCs | |
| 8 | +|-----|------| |
| 9 | +| valhall-g610 | rk3588 | |
| 10 | +| bifrost-g52 | rk3566, rk3568, rk3562, rk3576 | |
| 11 | +| bifrost-g31 | px30, rk3326 | |
| 12 | +| midgard-t86x | rk3399, rk3399pro | |
| 13 | +| midgard-t76x | rk3288 | |
| 14 | +| utgard-450 | rk3328, rk3528 | |
| 15 | +| utgard-400 | px3se, rk3036, rk3032, rk312x, rk3128h | |
| 16 | + |
| 17 | +## Dependencies |
| 18 | + |
| 19 | +```bash |
| 20 | +sudo apt install meson pkg-config \ |
| 21 | + libdrm-dev libx11-dev libx11-xcb-dev \ |
| 22 | + libxcb-dri2-0-dev libwayland-dev |
| 23 | +``` |
| 24 | + |
| 25 | +## Building |
| 26 | + |
| 27 | +### Configure |
| 28 | + |
| 29 | +```bash |
| 30 | +meson setup build \ |
| 31 | + -Dgpu=valhall-g610 \ |
| 32 | + -Dversion=g24p0 \ |
| 33 | + -Dplatform=x11-wayland-gbm \ |
| 34 | + -Darch=aarch64 |
| 35 | +``` |
| 36 | + |
| 37 | +### Build |
| 38 | + |
| 39 | +```bash |
| 40 | +ninja -C build |
| 41 | +``` |
| 42 | + |
| 43 | +### Install to staging directory (for packaging) |
| 44 | + |
| 45 | +```bash |
| 46 | +DESTDIR=$(pwd)/pkg ninja -C build install |
| 47 | +``` |
| 48 | + |
| 49 | +### Install to system |
| 50 | + |
| 51 | +```bash |
| 52 | +sudo ninja -C build install |
| 53 | +``` |
| 54 | + |
| 55 | +## Meson Options |
| 56 | + |
| 57 | +| Option | Default | Description | |
| 58 | +|--------|---------|-------------| |
| 59 | +| `arch` | auto | Target architecture: `aarch64`, `arm`, `armhf`, etc. | |
| 60 | +| `gpu` | midgard-t86x | GPU name (see table above) | |
| 61 | +| `version` | r18p0 | Driver version (e.g. `g24p0`, `g29p1`, `r18p0`) | |
| 62 | +| `subversion` | none | Driver subversion, or `all` to match any | |
| 63 | +| `platform` | gbm | Display platform(s): `gbm`, `x11-gbm`, `wayland-gbm`, `x11-wayland-gbm`, `dummy`, etc. | |
| 64 | +| `optimize-level` | O3 | Optimization level: `O0`–`O3`, `Os`, `Ofast`, `Og` | |
| 65 | +| `hooks` | true | Enable GBM hook library for extended format support | |
| 66 | +| `wrappers` | auto | Build wrapper shared libraries (EGL, GLESv2, etc.) | |
| 67 | +| `vendor-package` | false | Install wrappers to `lib/mali/` vendor subdirectory | |
| 68 | +| `opencl-icd` | true | Install OpenCL as ICD (`libMaliOpenCL`) instead of `libOpenCL` | |
| 69 | +| `wayland-egl` | true | Install `libwayland-egl` wrapper | |
| 70 | +| `firmware-dir` | /lib/firmware | Destination for GPU firmware (valhall-g610 only) | |
| 71 | +| `with-overlay` | false | Install init overlay scripts (utgard/midgard only) | |
| 72 | +| `khr-header` | false | Install `khrplatform.h` header | |
| 73 | + |
| 74 | +## Available Library Variants |
| 75 | + |
| 76 | +The library filename encodes the configuration: |
| 77 | + |
| 78 | +``` |
| 79 | +libmali-<gpu>-<version>[-<subversion>]-<platform>.so |
| 80 | +``` |
| 81 | + |
| 82 | +Examples: |
| 83 | +- `libmali-valhall-g610-g29p1-x11-wayland-gbm.so` — G610, g29p1, X11 + Wayland + GBM |
| 84 | +- `libmali-valhall-g610-g24p0-dummy.so` — G610, g24p0, no display (headless/compute) |
| 85 | +- `libmali-bifrost-g52-g24p0-wayland-gbm.so` — G52, g24p0, Wayland + GBM |
| 86 | + |
| 87 | +Binaries live under `lib/<multiarch>/` and `optimize_3/<multiarch>/` (O3-optimized, preferred). |
| 88 | + |
| 89 | +## Building a .deb Package |
| 90 | + |
| 91 | +### Single package (manual) |
| 92 | + |
| 93 | +```bash |
| 94 | +# 1. Configure and build |
| 95 | +meson setup build -Dgpu=valhall-g610 -Dversion=g29p1 -Dplatform=x11-wayland-gbm -Darch=aarch64 |
| 96 | +ninja -C build |
| 97 | + |
| 98 | +# 2. Stage the install |
| 99 | +DESTDIR=$(pwd)/build/pkg ninja -C build install |
| 100 | + |
| 101 | +# 3. Write control file |
| 102 | +mkdir -p build/pkg/DEBIAN |
| 103 | +cat > build/pkg/DEBIAN/control << EOF |
| 104 | +Package: libmali-valhall-g610-g29p1-x11-wayland-gbm |
| 105 | +Version: 29 |
| 106 | +Architecture: arm64 |
| 107 | +Maintainer: Your Name <you@example.com> |
| 108 | +Provides: libmali |
| 109 | +Conflicts: libmali |
| 110 | +Replaces: libmali |
| 111 | +Depends: libdrm2, libwayland-client0, libwayland-server0, libx11-6, libxcb1, libxcb-dri2-0 |
| 112 | +Description: Mali GPU User-Space Binary Drivers |
| 113 | + Mali Valhall G610 g29p1 userspace driver with X11, Wayland and GBM support. |
| 114 | +EOF |
| 115 | + |
| 116 | +# 4. Build the .deb |
| 117 | +dpkg-deb --build build/pkg libmali-valhall-g610-g29p1-x11-wayland-gbm_29_arm64.deb |
| 118 | +``` |
| 119 | + |
| 120 | +### All packages via debhelper |
| 121 | + |
| 122 | +```bash |
| 123 | +# Regenerate debian/targets and debian/control from all libs in lib/ |
| 124 | +scripts/update_debian.sh |
| 125 | + |
| 126 | +# Build all binary packages |
| 127 | +dpkg-buildpackage -b --no-sign |
| 128 | +``` |
| 129 | + |
| 130 | +To add a new library blob to the debian packaging: |
| 131 | + |
| 132 | +1. Place the `.so` in `lib/<multiarch>/` (and optionally `optimize_3/<multiarch>/`) |
| 133 | +2. Filename must follow the convention: `libmali-<gpu>-<version>-<platform>.so` |
| 134 | +3. Run `scripts/update_debian.sh` to regenerate `debian/targets` and `debian/control` |
| 135 | +4. Build with `dpkg-buildpackage -b --no-sign` |
| 136 | + |
| 137 | +## Adding a New Driver Blob |
| 138 | + |
| 139 | +1. Copy the `.so` into `lib/aarch64-linux-gnu/` (rename to strip any arch suffix) |
| 140 | +2. Optionally also place it in `optimize_3/aarch64-linux-gnu/` for the O3 build path |
| 141 | +3. Run `scripts/update_debian.sh` to register it in `debian/targets` and `debian/control` |
| 142 | +4. Build the deb as shown above |
0 commit comments