AFBC display corruption on Rockpro64 (RK3399) 4K output
System information
System: Host: rockpro64 Kernel: 6.1.1-danc aarch64 bits: 64 compiler: gcc v: 9.5.0 Desktop: sway 1.7 dm: N/A
Distro: NixOS 22.11 (Raccoon)
CPU: Info: 6-Core model: N/A variant-1: cortex-a53 variant-2: cortex-a72 bits: 64 type: MCP arch: ARMv8 rev: 4
features: Use -f option to see features bogomips: 0
Speed: 600 MHz min/max: 408/1416:1800 MHz Core speeds (MHz): 1: 408 2: 408 3: 408 4: 408 5: 600 6: 600
Graphics: Device-1: display-subsystem driver: rockchip_drm v: N/A bus-ID: N/A chip-ID: rockchip:display-subsystem
Device-2: rk3399-dw-hdmi driver: dwhdmi_rockchip v: N/A bus-ID: N/A chip-ID: rockchip:ff940000
Device-3: rk3399-mali driver: panfrost v: kernel bus-ID: N/A chip-ID: rockchip:ff9a0000
Display: wayland server: N/A compositor: sway driver: loaded: panfrost note: n/a (using device driver)
resolution: <missing: xdpyinfo>
OpenGL: renderer: Mali-T860 (Panfrost) v: 3.1 Mesa 22.3.1 direct render: Yes
Describe the issue
I have a Rockpro64 (RK3399-based SBC) connected to a 4K monitor over HDMI. The output looks good and Panfrost acceleration seems fine with glmark2-drm
(and kmscon
and plain linux VT).
However when I start a Wayland compositor with the exact same DRM mode, the right-hand portion of the display shows sparkling static-like display corruption. See attached photo. Tested with weston, sway, cage, and river.
I compared drm_info
output for the plain linux VT (no corruption) vs. sway (with corruption) and notice that the difference seems to be sway is using AFBC for its primary plane. The good and bad drm_info
outputs are attached.
The bad one has:
│ │ ├───Format: ARGB8888 (0x34325241)
│ │ ├───Modifier: ARM_AFBC(BLOCK_SIZE = 16x16, YTR, SPARSE) (0x800000000000051)
The good one has:
│ │ ├───Format: XRGB8888 (0x34325258)
│ │ ├───Modifier: DRM_FORMAT_MOD_LINEAR (0x0)
Eventually I found PAN_MESA_DEBUG=noafbc
and tried that. It avoids the problem, at the expense of much lower performance according to glmark2. So it definitely must be AFBC-related.
Tested with mesa 22.3.1 (mesa 22.2.3 also has the same issue). I'm using kernel 6.1.1 plus out-of-tree patches from Libreelec:
https://github.com/LibreELEC/LibreELEC.tv/tree/5fc1868d8610dadb91c380a88997583d554d97d8/projects/Rockchip/patches/linux/default
The kernel patches are necessary to get 4K output on this board. The mainline kernel is still only capable of outputting 1920x1080. It's quite possible this bug is in the Rockchip DRM code and maybe even in those patches.
Regression
I never had working 4K output on this board before so I'm not sure if it's a regression. Probably it isn't.
Log files as attachment
- Output of
drm_info
for linux VT (no corruption) - Output of
drm_info
running sway (with corruption) - Output of
dmesg