[PATCH] drm/fb_helper: Determine proper crtc_index within drm_fb_helper_fb_dirty
From: H. Nikolaus Schaller
Date: Thu Jun 18 2026 - 13:34:15 EST
The call to drm_client_modeset_wait_for_vblank() currently hardcodes the
crtc_index to 0. This is incorrect when CRTC 0 is inactive and not
generating vblank interrupts.
When this occurs, the console is flooded with vblank timeout warnings:
[ 77.201354] WARNING: drivers/gpu/drm/drm_vblank.c:1320 at drm_crtc_wait_one_vblank+0x194/0x1cc [drm], CPU#1: kworker/1:7/1867
[ 77.201354] omapdrm omapdrm.0: [drm] vblank wait timed out on crtc 0
This behavior was observed on a PandaBoard-ES when only the HDMI port
(CRTC 1) is connected, while the LCD (CRTC 0) and DVI port (CRTC 2)
remain disconnected. The root cause is the hardcoded crtc_index = 0.
Fix this by locating the matching CRTCs. If multiple CRTCs match, the
last active one is selected. If no matching CRTC is found, the vblank
wait is skipped entirely.
Fixes: d8c4bddcd8bcb ("drm/fb-helper: Synchronize dirty worker with vblank")
Signed-off-by: H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>
---
drivers/gpu/drm/drm_fb_helper.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 1541fc8a9ac2d..70999cdc98b32 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -232,9 +232,23 @@ static void drm_fb_helper_fb_dirty(struct drm_fb_helper *helper)
struct drm_clip_rect clip_copy;
unsigned long flags;
int ret;
+ unsigned int crtc_index = 0;
+ struct drm_crtc *crtc;
mutex_lock(&helper->lock);
- drm_client_modeset_wait_for_vblank(&helper->client, 0);
+
+ drm_for_each_crtc(crtc, dev) {
+ if (crtc->primary && crtc->primary->state &&
+ crtc->primary->state->fb == helper->fb &&
+ crtc->state && crtc->state->active) {
+ crtc_index = drm_crtc_index(crtc) + 1;
+ break;
+ }
+ }
+
+ if (crtc_index > 0)
+ drm_client_modeset_wait_for_vblank(&helper->client, crtc_index - 1);
+
mutex_unlock(&helper->lock);
if (drm_WARN_ON_ONCE(dev, !helper->funcs->fb_dirty))
--
2.50.1 (Apple Git-155)