Skip to content

Commit

Permalink
Merge pull request #501 from CodeChenL/main
Browse files Browse the repository at this point in the history
Optimize gpu switching documentation
  • Loading branch information
peterwang2050 authored Oct 23, 2024
2 parents 4ab252f + c0270b4 commit 865c25b
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 20 deletions.
9 changes: 9 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -337,3 +337,12 @@ static/img/rock5c/rk3588s2_blockdiagram.webp @vamrs-feng
i18n/en/docusaurus-plugin-content-docs/current/compute-module/cm3i/app-development/README.md @nascs
docs/compute-module/cm3/app-development/rtsp.md @nascs
i18n/en/docusaurus-plugin-content-docs/current/rock3/rock3b/getting-started/interface-usage/hdmi.md @nascs
docs/rock5/rock5a/getting-started/interface-usage/README.md @nascs
docs/rock5/rock5c/low-level-dev/README.md @vamrs-feng
docs/accessories/camera_8m_219.md @melooooooooooo
static/img/accessories/penta/case/case-2.webp @u7985
static/img/general-tutorial/rknn/rkllm_1.webp @vamrs-feng
docs/sophon/airbox/local-ai-deploy/ai-tools/memory_allocate.md @peterwang2050
i18n/en/docusaurus-plugin-content-docs/current/rock3/rock3b/radxa-os/backup.md @nascs
docs/common/radxa-os/_mali-gpu.mdx @CodeChenL
i18n/en/docusaurus-plugin-content-docs/current/docs/common/radxa-os/_mali-gpu.mdx @CodeChenL
86 changes: 76 additions & 10 deletions docs/common/radxa-os/_mali-gpu.mdx
Original file line number Diff line number Diff line change
@@ -1,29 +1,44 @@
ROCK 5 系列在 Debian 12 (Bookworm) 版本默认使用 Panthor GPU 驱动,您可根据需求依据下方教程操作进行 GPU 驱动切换。
搭载 RK3588(不包含 RK3582)系列 SOC 的产品在使用 Debian 12 (Bookworm) 版本系统时默认使用 Panthor GPU 驱动,您可根据需求依据下方教程操作进行 GPU 驱动切换。

| Driver | OpenGL | OpenGL ES | OpenCL |
| :-----: | :----: | :-------: | :----: |
| Mali ||||
| Panthor ||||
:::warning
本文档仅适用于搭载 RK3588(不包含 RK3582)系列 SOC 的产品。
:::

| Driver | OpenGL | OpenGL ES | OpenCL | 8K HDMI |
| :-----: | :----: | :-------: | :----: | :-----: |
| Mali |||||
| Panthor |||||

<Tabs queryString="Driver">

<TabItem value="Mali">

## 使用 Rockchip 专有 xorg-xserver 版本

添加 `/etc/apt/preferences.d/mali` 文件,内容为:
1. 添加 `/etc/apt/preferences.d/mali` 文件,内容为:

```bash
Package: *xserver*
Pin: release a=rk3588-bookworm
Pin-Priority: 1001

Package: *xserver*
Pin: release a=rk3588-bookworm-test
Pin-Priority: 1001

Package: *xserver*
Pin: release a=rk3588s2-bookworm
Pin-Priority: 1001

Package: *xserver*
Pin: release a=rk3588s2-bookworm-test
Pin-Priority: 1001
```

然后参考[使用 `rsetup` 进行系统升级](./rsetup#system-update)来重新安装 Rockchip 专有软件包。
2. <div className="red">
**然后参考[使用 `rsetup` 进行系统升级](./rsetup#system-update)来重新安装**
**Rockchip 专有软件包,如果不执行此步骤会导致桌面闪退或者颜色翻转。**
</div>

## 安装 Mali 用户层驱动

Expand All @@ -42,13 +57,16 @@ sudo apt-get install libmali-valhall-g610-g13p0-x11-gbm

## 恢复使用 Debian 官方打包的主线 xorg-xserver 版本

删除 `/etc/apt/preferences.d/mali` 文件:
1. 删除 `/etc/apt/preferences.d/mali` 文件:

```bash
sudo rm /etc/apt/preferences.d/mali
```

然后参考[使用 `rsetup` 进行系统升级](./rsetup#system-update)来重新安装 Debian 官方软件包。
2. <div className="red">
**然后参考[使用 `rsetup` 进行系统升级](./rsetup#system-update)来重新安装**
**Debian 官方软件包,如果不执行此步骤会导致桌面闪退或者颜色翻转。**
</div>

## 卸载 Mali 用户层驱动,并安装上游 Mesa 驱动

Expand All @@ -68,6 +86,54 @@ sudo apt-get install mesa-utils mesa-utils-extra libglx-mesa0 libgl1-mesa-dri

## 重启系统

```
```bash
sudo reboot
```

## 验证 GPU 驱动

### 验证内核驱动

查看是否有对应的 GPU 驱动加载信息:

```bash
# mali
rock@radxa-cm5-io:~$ lsmod | grep bifrost_kbase
bifrost_kbase 1015808 3

# Panthor
rock@radxa-cm5-io:~$ lsmod | grep panthor
panthor 98304 1
drm_gpuvm 24576 1 panthor
drm_exec 16384 2 drm_gpuvm,panthor
drm_shmem_helper 20480 1 panthor
gpu_sched 36864 1 panthor
```

### 验证 xorg-xserver 版本

运行以下命令,查看当前 `[installed,automatic]` 对应的 xorg-xserver 来源。使用 mali 驱动时,为 `rk3588*-bookworm`,使用 Panthor 驱动时,为 `stable`

```bash
rock@radxa-cm5-io:~$ sudo apt list -a xserver-common xserver-xorg-core xserver-xorg-legacy
Listing... Done
xserver-common/stable-security,stable 2:21.1.7-3+deb12u7 all
xserver-common/rk3588s2-bookworm,rk3588s2-bookworm,now 2:21.1.7-3+deb12u2 all [installed,automatic]

xserver-xorg-core/stable-security,stable 2:21.1.7-3+deb12u7 arm64
xserver-xorg-core/rk3588s2-bookworm,now 2:21.1.7-3+deb12u2 arm64 [installed,automatic]

xserver-xorg-legacy/stable-security,stable 2:21.1.7-3+deb12u7 arm64
xserver-xorg-legacy/rk3588s2-bookworm,now 2:21.1.7-3+deb12u2 arm64 [installed,automatic]
```

### 验证用户层驱动

运行以下命令,使用 mali 驱动则为 `[installed]` 字样,使用 Panthor 则没有 `[installed]` 字样:

```bash
rock@radxa-cm5-io:~$ sudo apt list libmali-valhall-g610-g13p0-x11-gbm
Listing... Done
libmali-valhall-g610-g13p0-x11-gbm/rk3588s2-bookworm,now 1.9-1 arm64 [installed]
rock@radxa-cm5-io:~$
```
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
ROCK 5 series uses Panthor GPU driver by default in Debian 12 (Bookworm) version, you can follow the tutorial to switch GPU driver according to your needs.
Products equipped with RK3588 (excluding RK3582) series SOCs use Panthor GPU driver by default when using Debian 12 (Bookworm) version system, you can follow the tutorial below to switch GPU driver according to your needs.

| Driver | OpenGL | OpenGL ES | OpenCL |
| :-----: | :----: | :-------: | :----: |
| Mali ||||
| Panthor ||||
:::warning
This document applies only to products equipped with the RK3588 (excluding RK3582) series SOC.
:::

| Driver | OpenGL | OpenGL ES | OpenCL | 8K HDMI |
| :-----: | :----: | :-------: | :----: | :-----: |
| Mali |||||
| Panthor |||||

<Tabs queryString="Driver">

<TabItem value="Mali">

## Use Rockchip's proprietary xorg-xserver version

Add `/etc/apt/preferences.d/mali` file with the following contents:
1. Add `/etc/apt/preferences.d/mali` file with the following contents:

```bash
Package: *xserver*
Expand All @@ -23,7 +27,12 @@ Pin: release a=rk3588s2-bookworm
Pin-Priority: 1001
```

Then refer to [System Upgrade Using `rsetup`](./rsetup#system-update) to reinstall Rockchip proprietary packages.
2. <div className="red">
<!-- prettier-ignore -->
**Then refer to [System Upgrade Using `rsetup`](./rsetup#system-update) to**
**reinstall the Rockchip proprietary software packages, if you don't**
**perform this step it will crash the desktop or flip the colors.**
</div>

## Installing the Mali User Level Driver

Expand All @@ -42,13 +51,17 @@ Refer to [Overlay opening tutorial](./rsetup#overlays),enable `Enable Arm Mali

## Revert to using Debian's officially packaged version of mainline xorg-xserver

Remove `/etc/apt/preferences.d/mali` file:
1. Remove `/etc/apt/preferences.d/mali` file:

```bash
sudo rm /etc/apt/preferences.d/mali
```

Then refer to [System Upgrade Using `rsetup`](./rsetup#system-update) to reinstall Debian's officially packages.
2. <div className="red">
**Then refer to [System Upgrade Using `rsetup`](./rsetup#system-update)
to** **reinstall the Debian's officially packages, if you don't perform
this** **step it will crash the desktop or flip the colors.**
</div>

## Uninstall the Mali user level driver and install the upstream Mesa driver

Expand All @@ -68,6 +81,54 @@ Refer to [Overlay opening tutorial](./rsetup#overlays),disable `Enable Arm Mal

## Reboot system

```
```bash
sudo reboot
```

## Verify GPU drivers

### Verify the kernel driver

Check if the corresponding GPU driver is loaded:

```bash
# mali
rock@radxa-cm5-io:~$ lsmod | grep bifrost_kbase
bifrost_kbase 1015808 3

# Panthor
rock@radxa-cm5-io:~$ lsmod | grep panthor
panthor 98304 1
drm_gpuvm 24576 1 panthor
drm_exec 16384 2 drm_gpuvm,panthor
drm_shmem_helper 20480 1 panthor
gpu_sched 36864 1 panthor
```

### Verify the xorg-xserver version

Run the following command to see the current xorg-xserver source for `[installed,automatic]`. This is `rk3588*-bookworm` when using the mali driver, or `stable` when using the Panthor driver.

```bash
rock@radxa-cm5-io:~$ sudo apt list -a xserver-common xserver-xorg-core xserver-xorg-legacy
Listing... Done
xserver-common/stable-security,stable 2:21.1.7-3+deb12u7 all
xserver-common/rk3588s2-bookworm,rk3588s2-bookworm,now 2:21.1.7-3+deb12u2 all [installed,automatic]

xserver-xorg-core/stable-security,stable 2:21.1.7-3+deb12u7 arm64
xserver-xorg-core/rk3588s2-bookworm,now 2:21.1.7-3+deb12u2 arm64 [installed,automatic]

xserver-xorg-legacy/stable-security,stable 2:21.1.7-3+deb12u7 arm64
xserver-xorg-legacy/rk3588s2-bookworm,now 2:21.1.7-3+deb12u2 arm64 [installed,automatic]
```

### Verify the user level driver

Run the following command with the word `[installed]` for mali drivers and without the word `[installed]` for Panthor:

```bash
rock@radxa-cm5-io:~$ sudo apt list libmali-valhall-g610-g13p0-x11-gbm
Listing... Done
libmali-valhall-g610-g13p0-x11-gbm/rk3588s2-bookworm,now 1.9-1 arm64 [installed]
rock@radxa-cm5-io:~$
```

0 comments on commit 865c25b

Please sign in to comment.