Skip to content

Conversation

@bramoosterhuis
Copy link
Contributor

@bramoosterhuis bramoosterhuis commented Oct 10, 2025

Fix DRM framebuffer creation with modifiers on armv7

Problem

drmModeAddFB2WithModifiers failed on armv7 (BPI M2+, RPi 3/4) but worked on aarch64 (RPi 3/4/5). The kernel rejected framebuffers with error -22: "non-zero modifier for unused plane".

Root Cause

Code was setting modifiers for all 4 planes, but kernel requires unused planes to have modifier = 0:

modifiers.fill(buffer->Modifier());  // ❌ Sets ALL 4 planes

Fix

Initialize to zero and only set modifiers for used planes:

std::array<uint64_t, 4> modifiers = { 0, 0, 0, 0 };
modifiers[nPlanes] = bufferModifier;  // ✅ Only used planes

Changes

  • DRM.cpp: Fix modifier array initialization, improve error handling/logging
  • README.md: Add DRM debugging documentation (debugfs, kernel logs)
  • Tests: Enhanced tracing, replaced printf with TRACE macros

Testing

✅ Tested on: RPi 3/4/5 (aarch64), BPI M2+ (armv7), RPi 3/4 (armv7)

@pwielders pwielders merged commit 801ee2a into master Oct 12, 2025
48 checks passed
@pwielders pwielders deleted the development/picky-gpus branch October 12, 2025 07:48
@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants