On Thu, Nov 19, 2026 at 04:24:22PM +0800, Prike Liang wrote: > FBIO_WAITFORVSYNC calls drm_client_modeset_wait_for_vblank(), which > waits with drm_crtc_wait_one_vblank(). That wait is uninterruptible and > only gives up after one second. If no vblank interrupt arrives, for > example while the driver resets the display hardware, the caller sleeps > in D state for the whole second and can't be interrupted, not even by > SIGKILL. > > DRM_IOCTL_WAIT_VBLANK waits interruptibly, and so do fbdev drivers that > implement FBIO_WAITFORVSYNC themselves, such as atyfb and matroxfb.
So we have precedent. Good. > > Use drm_crtc_wait_one_vblank_interruptible() in > drm_client_modeset_wait_for_vblank(). Return -ERESTARTSYS when a signal > interrupts the wait, so that the ioctl returns to userspace or is > restarted. Timeouts and disabled CRTCs are still not reported. > > The fbdev damage worker also calls drm_client_modeset_wait_for_vblank(), > but it runs in a kernel thread, which doesn't receive signals, so its > wait doesn't change. The damage workers recent unilateral use of vblank waits is bugging me. Enabling vblanks has hardware side effects on i915/xe that we probably don't want there. Need to take a look at demidlayering that at some point... > > Version update: > 1) https://lists.freedesktop.org/archives/dri-devel/2026-November/616727.html > > Cc: Thomas Zimmermann <[email protected]> > Cc: Ville Syrjälä <[email protected]> > Assisted-by: Copilot:claude-opus-5.5 > Signed-off-by: Prike Liang <[email protected]> Reviewed-by: Ville Syrjälä <[email protected]> > --- > drivers/gpu/drm/drm_client_modeset.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/drm_client_modeset.c > b/drivers/gpu/drm/drm_client_modeset.c > index 0080a8e9556a..b475b8dbdb17 100644 > --- a/drivers/gpu/drm/drm_client_modeset.c > +++ b/drivers/gpu/drm/drm_client_modeset.c > @@ -1301,10 +1301,11 @@ EXPORT_SYMBOL(drm_client_modeset_dpms); > * > * Block the caller until the given CRTC has seen a VBLANK. Do nothing > * if the CRTC is disabled. If there's another DRM master present, fail > - * with -EBUSY. > + * with -EBUSY. A signal interrupts the wait. > * > * Returns: > - * 0 on success, or negative error code otherwise. > + * 0 on success, -ERESTARTSYS if a signal interrupted the wait, or > + * negative error code otherwise. > */ > int drm_client_modeset_wait_for_vblank(struct drm_client_dev *client, > unsigned int crtc_index) > { > @@ -1328,13 +1329,14 @@ int drm_client_modeset_wait_for_vblank(struct > drm_client_dev *client, unsigned i > */ > ret = drm_crtc_vblank_get(crtc); > if (!ret) { > - drm_crtc_wait_one_vblank(crtc); > + ret = drm_crtc_wait_one_vblank_interruptible(crtc); > drm_crtc_vblank_put(crtc); > } > > drm_master_internal_release(dev); > > - return 0; > + /* Only report interruption by a signal, not timeouts. */ > + return ret == -ERESTARTSYS ? ret : 0; > } > EXPORT_SYMBOL(drm_client_modeset_wait_for_vblank); > > -- > 2.34.1 -- Ville Syrjälä Intel
