Closed shengwen-tw closed 1 month ago
Interesting!
The "AR24" format used by default in the DRM/KMS system module is historical but the "XR24" format should probably be preferred (the primary layer is the bottom one in general so an opaque format might make more sense).
During the development of our RISC-V system emulator, semu, we encountered an issue where DirectFB2 failed to work with DRM mode, producing the following error:
Upon investigation, we found that the virtio-gpu driver (for GPU virtualization) in the Linux kernel allocates two planes: a PRIMARY plane using the
XRGB8888
format and a CURSOR plane using theARGB8888
format.However, the DRM subsystem in DirectFB2 adopts a policy of using an
ARGB
plane as the main plane if possible. This caused DirectFB2 to incorrectly select the CURSOR plane, instead of the PRIMARY plane, when running on semu with the virtio-gpu driver.Currently, Linux DRM allows using multiplane overlay (MPO) model for power-saving. The plane types consist of PRIMARY, CURSOR, and OVERLAY. However, only the PRIMARY plane supporting operations like
modesetting
,flipping
, etc. This is unlike the older DRM design, which treated all planes as universal.This commit resolves the issue by introducing plane type checking, ensuring DirectFB2 does not mistakenly select non-PRIMARY planes as the main plane.
Reference: [1] Multiplane Overlay (MPO) - The Linux kernel