Skip to content

Commit 41310ef

Browse files
committed
desktops: enable panthor-gpu DT overlay on rk3588 vendor-kernel desktops
Ports armbian/build extensions/mesa-vpu.sh 'extension_prepare_config__3d' into module_desktops install so the overlay is enabled at the desktop-install layer rather than only at image-build time. Mesa's panthor driver needs the panthor-gpu DT overlay to claim the rk3588 Mali-G610 via the vendor kernel's kbase interface. Without the overlay, GL / Vulkan / GBM run as llvmpipe software. build's extensions/mesa-vpu.sh set the overlay by appending panthor-gpu to DEFAULT_OVERLAYS at extension_prepare_config time. That covers image-built desktops but not desktops installed on top of a minimal image via armbian-config. Add _module_desktops_add_3d_overlay to module_desktops.sh with the same gating upstream has: BOARDFAMILY in {rockchip-rk3588, rk35xx} BRANCH == vendor release not in {bookworm, bullseye, buster, focal, jammy} tier != minimal de not in {xfce, i3-wm} (X11-only, no GBM path) All conditions match → delegate to the existing module_devicetree_overlays install overlays=panthor-gpu. That module already handles the atomic armbianEnv.txt rewrite, validates the name against the discovered .dtbo set, keeps a .bak, and is idempotent. No reimplementation needed. BOARDFAMILY + BRANCH are trusted as already-sourced globals — module_env_init.sh sources /etc/armbian-release at configng init time, before any module_* function runs. armbian-base-files (which ships the file) is installed before module_desktops on every build path, so the file is present in the chroot during mode=build. Call site: right after _module_desktops_configure_networking in the install pipeline, so both build-mode and runtime installs converge on the same overlay set that image-built desktops already have.
1 parent 27eea9b commit 41310ef

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

tools/modules/desktops/module_desktops.sh

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,86 @@ function _module_desktops_write_apt_pin() {
101101
return 0
102102
}
103103

104+
#
105+
# Enable the panthor-gpu DT overlay on Rockchip RK3588-family boards
106+
# running the vendor kernel, when a Wayland-capable desktop is being
107+
# installed. Mirrors the old extensions/network/… no, wait — mirrors
108+
# armbian/build's extensions/mesa-vpu.sh 'extension_prepare_config__3d'
109+
# hook so that install-on-minimal converges on the same overlay set
110+
# an image-built desktop would have.
111+
#
112+
# panthor-gpu is the Mesa panthor-kbase GPU driver overlay: required
113+
# for hardware-accelerated GL / Vulkan / GBM on rk3588 under Mesa +
114+
# vendor kernel, unused (and ignored) on everything else.
115+
#
116+
# Gating mirrors the upstream hook:
117+
# - Skip on pre-bookworm / bookworm / jammy / older releases —
118+
# panthor kernel bits didn't land there in a usable shape.
119+
# - Skip on tier=minimal — the overlay is only useful with a
120+
# compositor stack (Mesa/Vulkan loaders) that mid/full pulls in.
121+
# - Skip on xfce / i3-wm — these are X11-only in our default
122+
# configuration and don't benefit from a GBM GPU path.
123+
# - Only fire on BOARDFAMILY rockchip-rk3588 / rk35xx and
124+
# BRANCH=vendor.
125+
#
126+
# BOARDFAMILY + BRANCH are globals set at configng init time by
127+
# module_env_init.sh (which sources /etc/armbian-release); present
128+
# in the chroot under mode=build because armbian-base-files is
129+
# installed before module_desktops. Delegates the actual
130+
# armbianEnv.txt write to module_devicetree_overlays (atomic
131+
# temp+mv, .bak preserved, validates name against the discovered
132+
# .dtbo set, idempotent).
133+
#
134+
function _module_desktops_add_3d_overlay() {
135+
# Board/branch gate.
136+
if [[ ! "${BOARDFAMILY:-}" =~ ^(rockchip-rk3588|rk35xx)$ ]]; then
137+
debug_log "_module_desktops_add_3d_overlay: BOARDFAMILY='${BOARDFAMILY:-}' — not rk3588-family, skipping"
138+
return 0
139+
fi
140+
if [[ "${BRANCH:-}" != "vendor" ]]; then
141+
debug_log "_module_desktops_add_3d_overlay: BRANCH='${BRANCH:-}' — not vendor, skipping"
142+
return 0
143+
fi
144+
145+
# Release gate — old releases ship kernels that don't have the
146+
# panthor driver, or have a non-working version.
147+
case "${DISTROID:-}" in
148+
bookworm|bullseye|buster|focal|jammy)
149+
debug_log "_module_desktops_add_3d_overlay: release '${DISTROID}' predates usable panthor, skipping"
150+
return 0
151+
;;
152+
esac
153+
154+
# Tier gate — minimal doesn't install the Mesa/Vulkan stack that
155+
# would use the overlay.
156+
if [[ "${tier:-}" == "minimal" ]]; then
157+
debug_log "_module_desktops_add_3d_overlay: tier=minimal, skipping"
158+
return 0
159+
fi
160+
161+
# X11-only DEs — no Wayland compositor, no GBM path.
162+
case "${de:-}" in
163+
xfce|i3-wm)
164+
debug_log "_module_desktops_add_3d_overlay: de=${de} is X11-only, skipping"
165+
return 0
166+
;;
167+
esac
168+
169+
# Delegate to the existing DT overlays module. It reads/writes
170+
# /boot/armbianEnv.txt atomically, keeps a .bak, and silently
171+
# no-ops if 'panthor-gpu' is already enabled. 'install' also
172+
# validates the name against the .dtbo set discovered on the
173+
# running / in-chroot system, so if the overlay isn't shipped
174+
# (e.g. kernel without panthor), we get a loud error instead of
175+
# a silently broken image.
176+
display_alert "Enabling panthor-gpu DT overlay" "BOARDFAMILY=${BOARDFAMILY} BRANCH=vendor" "info" 2>/dev/null \
177+
|| echo "Enabling panthor-gpu DT overlay (BOARDFAMILY=${BOARDFAMILY} BRANCH=vendor)"
178+
module_devicetree_overlays install overlays=panthor-gpu || \
179+
echo "Warning: failed to enable panthor-gpu overlay (see above)" >&2
180+
181+
return 0
182+
}
183+
104184
#
105185
# Switch the host from systemd-networkd (the Armbian minimal image
106186
# baseline) to NetworkManager so the freshly-installed desktop's
@@ -401,6 +481,15 @@ function module_desktops() {
401481
# even though the machine is online.
402482
_module_desktops_configure_networking
403483

484+
# Enable panthor-gpu DT overlay on rk3588-family boards
485+
# running the vendor kernel when a Wayland-capable
486+
# desktop is installed. No-op on every other board /
487+
# branch / release / tier / DE combination. Mirrors
488+
# armbian/build's extensions/mesa-vpu.sh 'Hook 1' so
489+
# runtime-installed desktops converge on the same
490+
# overlay set an image-built desktop would have.
491+
_module_desktops_add_3d_overlay
492+
404493
# add user to desktop groups
405494
# User-specific setup: group membership, skel propagation,
406495
# display manager start + autologin. Skipped in build mode

0 commit comments

Comments
 (0)