Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adelyser/4e31409cd9c99ba4cb78a31fa9d12bb1 to your computer and use it in GitHub Desktop.
Save adelyser/4e31409cd9c99ba4cb78a31fa9d12bb1 to your computer and use it in GitHub Desktop.
CB1 3d Acceleration running Armbian Bookworm

This is a quick guide for optimizing the 3D acceleration for the Bigtreetech CB1 running Armbian Bookworm. Armbian already has the proper drivers installed, so disregard my previous guide.

**NOTE: The best perorming UI with panfrost is Gnome Wayland##

To optimize the drivers, only a few things are needed:

  1. Install the boot overlays to enable the cpu and gpu governors.
  2. Set the governors in the OS.
  3. Optional: Run the benchmark (glmark2 or kmscube)

Install boot overlays

  1. Copy the 2 dts files (below) to your CB1. You will need SSH access to install them.
  2. SSH into your CB1 and run the following commands:
$> sudo armbian-add-overlay sun50i-h616-cpu-opp.dts
$> sudo armbian-add-overlay sun50i-h616-gpu-opp.dts
  1. Create a file /etc/default/cpufrequtils with exactly these contents:
ENABLE=false
MIN_SPEED=480000
MAX_SPEED=1512000
GOVERNOR=ondemand
  1. Add the overlays to the armbian environment:
$> echo "user_overlays=sun50i-h616-gpu-opp sun50i-h616-cpu-opp" | sudo tee -a /boot/armbianEnv.txt
  1. Reboot your CB1 for the overlays to take effect.

Set the governors to performance:

  1. Run these commands to set the governor to performance:
$> echo performance | sudo tee /sys/devices/platform/soc/1800000.gpu/devfreq/1800000.gpu/governor
$> echo performance | sudo tee /sys/devices/system/cpu/cpufreq/policy0/scaling_governor

Run the benchmark

Depending on your UI installation, install and run glmark2 for some benchmark numbers. For Gnome Wayland, you would isntall glmark2-es2-wayland and run it from the terminal.

/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h616";
fragment@0 {
target-path = "/";
__overlay__ {
cpu_opp_table: opp-table-cpu {
compatible = "operating-points-v2";
opp-shared;
opp-480000000 {
opp-hz = /bits/ 64 <480000000>;
opp-microvolt = <820000>;
clock-latency-ns = <244144>; /* 8 32k periods */
};
opp-600000000 {
opp-hz = /bits/ 64 <600000000>;
opp-microvolt = <820000>;
clock-latency-ns = <244144>; /* 8 32k periods */
};
opp-792000000 {
opp-hz = /bits/ 64 <792000000>;
opp-microvolt = <860000>;
clock-latency-ns = <244144>; /* 8 32k periods */
};
opp-1008000000 {
opp-hz = /bits/ 64 <1008000000>;
opp-microvolt = <900000>;
clock-latency-ns = <244144>; /* 8 32k periods */
};
opp-1200000000 {
opp-hz = /bits/ 64 <1200000000>;
opp-microvolt = <960000>;
clock-latency-ns = <244144>; /* 8 32k periods */
};
opp-1512000000 {
opp-hz = /bits/ 64 <1512000000>;
opp-microvolt = <1100000>;
clock-latency-ns = <244144>; /* 8 32k periods */
};
};
};
};
fragment@2 {
target=<&cpu0>;
__overlay__ {
operating-points-v2 = <&cpu_opp_table>;
};
};
fragment@3 {
target=<&cpu1>;
__overlay__ {
operating-points-v2 = <&cpu_opp_table>;
};
};
fragment@4 {
target=<&cpu2>;
__overlay__ {
operating-points-v2 = <&cpu_opp_table>;
};
};
fragment@5 {
target=<&cpu3>;
__overlay__ {
operating-points-v2 = <&cpu_opp_table>;
};
};
};
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h616";
fragment@0 {
target=<&reg_dcdc3>;
__overlay__ {
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <1220000>;
};
};
fragment@1 {
target-path = "/";
__overlay__ {
gpu_opp_table: opp-table-1 {
compatible = "operating-points-v2";
opp-200000000 {
opp-hz = /bits/ 64 <200000000>;
opp-microvolt = <1100000>;
};
opp-312000000 {
opp-hz = /bits/ 64 <312000000>;
opp-microvolt = <1100000>;
};
opp-432000000 {
opp-hz = /bits/ 64 <432000000>;
opp-microvolt = <1100000>;
};
opp-528000000 {
opp-hz = /bits/ 64 <528000000>;
opp-microvolt = <1100000>;
};
opp-650000000 {
opp-hz = /bits/ 64 <650000000>;
opp-microvolt = <1100000>;
};
};
};
};
fragment@2 {
target=<&gpu>;
__overlay__ {
operating-points-v2 = <&gpu_opp_table>;
};
};
};
@Dids
Copy link

Dids commented Apr 22, 2024

Quick note on the GPU voltages: bigtreetech/CB1-Kernel@09c4723

Long story short: the values you currently have here are effectively overvolting the GPU, and should probably be updated and lowered accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment