Skip to contentSkip to conversation

drm/vc4: plane: Don't log LBM and UPM allocation failures as errors

PATCH New Roy 1 participant 1 message Nov 26

Subsystems (3)
lore
Share & tools
lore

Roy

author
#0 lore raw

PATCH 1/1 drm/vc4: plane: Don't log LBM and UPM allocation failures as errors

vc4_plane_allocate_lbm() and vc6_plane_allocate_upm() run from the plane's atomic_check. When the line buffer memory or the BCM2712's unified pixel memory can't fit a new state, they return -ENOSPC, which is the expected way to reject a configuration that needs more of a limited resource than is free. They also print it with drm_err().

That lets the DRM master fill the kernel log with error messages just by testing configurations with DRM_MODE_ATOMIC_TEST_ONLY, as a compositor or an igt test probing plane limits does. On a Raspberry Pi 5, 1000 TEST_ONLY commits of 18 full-screen planes add 1000 "*ERROR* Failed to allocate UPM entry: -28" records, and the same with the planes upscaled 2x adds 1000 "Failed to allocate LBM entry: -28" records.

Use drm_dbg_kms() for both, as is already done for running out of UPM handles in the same function. The messages are still there with drm.debug=0x04.

Tested on a Raspberry Pi 5 (Raspberry Pi OS kernel 6.18.39, with this change applied to its vc4 driver), counting /dev/kmsg records around 1000 TEST_ONLY commits that fail with -ENOSPC:
- UPM: 1000 records before, 0 after
- LBM: 1000 records before, 0 after
- with drm.debug=0x04, both messages are printed from vc4_plane_atomic_check

This change and its description were written with the help of an AI coding assistant (Claude); the testing above was done on real hardware.

---
 drivers/gpu/drm/vc4/vc4_plane.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_plane.c +2 -2
index 20c9fc9..81df567 100644
@@ -958,7 +958,7 @@ static int vc4_plane_allocate_lbm(struct drm_plane_state *state)
 		spin_unlock_irqrestore(&vc4->hvs->mm_lock, irqflags);
 
 		if (ret) {
-			drm_err(drm, "Failed to allocate LBM entry: %d\n", ret);
+			drm_dbg_kms(drm, "Failed to allocate LBM entry: %d\n", ret);
 			return ret;
 		}
 	} else {
@@ -1028,7 +1028,7 @@ static int vc6_plane_allocate_upm(struct drm_plane_state *state)
 							 0, 0);
 			spin_unlock_irqrestore(&hvs->mm_lock, irqflags);
 			if (ret) {
-				drm_err(drm, "Failed to allocate UPM entry: %d\n", ret);
+				drm_dbg_kms(drm, "Failed to allocate UPM entry: %d\n", ret);
 				refcount_set(&refcount->refcount, 0);
 				ida_free(&hvs->upm_handles, upm_handle);
 				vc4_state->upm_handle[i] = 0;
Signature · 1 line
2.51.1.windows.1