[PATCH] drm/nouveau/dispnv50: skip vblank and timestamp constants when dotclock is 0

From: Munique Feitoza

Date: Sat Dec 05 2026 - 12:25:42 EST


During probe, nv50_display_read_hw_or_state() marks firmware-inherited
active heads as active and enabled without populating mode timings,
leaving adjusted_mode.crtc_clock at 0 until the first modeset.

If a non-modeset atomic commit such as drm_mode_gamma_set_ioctl() from
plymouthd runs before the first modeset, nv50_disp_atomic_commit_tail()
calls drm_atomic_helper_calc_timestamping_constants() and vblank helpers
with crtc_clock == 0, triggering:

[drm] *ERROR* crtc 62: Can't calculate constants, dotclock = 0!
WARNING: drivers/gpu/drm/drm_vblank.c:756

Guard drm_calc_timestamping_constants() and the symmetric vblank
on/get/accurate_count/put calls in nv50_disp_atomic_commit_tail() on
adjusted_mode.crtc_clock != 0.

Signed-off-by: Munique Feitoza <muniquefeitoz4@xxxxxxxxx>
---
drivers/gpu/drm/nouveau/dispnv50/disp.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index e91130f93db670..9d73a31ba21a44 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -2187,7 +2187,11 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_commit *state)
drm_atomic_helper_wait_for_dependencies(state);
drm_dp_mst_atomic_wait_for_dependencies(state);
drm_atomic_helper_update_legacy_modeset_state(dev, state);
- drm_atomic_helper_calc_timestamping_constants(state);
+ for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
+ if (new_crtc_state->enable && new_crtc_state->adjusted_mode.crtc_clock)
+ drm_calc_timestamping_constants(crtc,
+ &new_crtc_state->adjusted_mode);
+ }

if (atom->lock_core)
mutex_lock(&disp->mutex);
@@ -2290,10 +2294,11 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_commit *state)

if (new_crtc_state->active) {
if (!old_crtc_state->active) {
- drm_crtc_vblank_on(crtc);
+ if (new_crtc_state->adjusted_mode.crtc_clock)
+ drm_crtc_vblank_on(crtc);
pm_runtime_get_noresume(dev->dev);
}
- if (new_crtc_state->event)
+ if (new_crtc_state->event && new_crtc_state->adjusted_mode.crtc_clock)
drm_crtc_vblank_get(crtc);
}
}
@@ -2388,14 +2393,14 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_commit *state)
if (new_crtc_state->event) {
unsigned long flags;
/* Get correct count/ts if racing with vblank irq */
- if (new_crtc_state->active)
+ if (new_crtc_state->active && new_crtc_state->adjusted_mode.crtc_clock)
drm_crtc_accurate_vblank_count(crtc);
spin_lock_irqsave(&crtc->dev->event_lock, flags);
drm_crtc_send_vblank_event(crtc, new_crtc_state->event);
spin_unlock_irqrestore(&crtc->dev->event_lock, flags);

new_crtc_state->event = NULL;
- if (new_crtc_state->active)
+ if (new_crtc_state->active && new_crtc_state->adjusted_mode.crtc_clock)
drm_crtc_vblank_put(crtc);
}
}
--
2.56.1