From: Thomas Zimmermann Date: Mon, 27 Apr 2026 15:00:38 +0000 (+0200) Subject: drm/vmwgfx: Determine lock-waiting timeout from vblank state X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83ae9a231dadbe2b0686786344a692d0b598953a;p=thirdparty%2Fkernel%2Flinux.git drm/vmwgfx: Determine lock-waiting timeout from vblank state Use the calculated duration of a frame as stored in the vblank state for the lock-waiting timeout. Decouples the waiting from the details of the vblank implementation. Both values should be equal. This will be helpful for replacing vmwgfx's vblank timer with DRM's common implementation. Signed-off-by: Thomas Zimmermann Reviewed-by: Zack Rusin Link: https://patch.msgid.link/20260427150250.699768-2-tzimmermann@suse.de --- diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c index 5abd7f5ad2db0..7862f6972512f 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c @@ -516,9 +516,13 @@ vmw_vkms_set_crc_surface(struct drm_crtc *crtc, static inline u64 vmw_vkms_lock_max_wait_ns(struct vmw_display_unit *du) { - s64 nsecs = ktime_to_ns(du->vkms.period_ns); + struct drm_crtc *crtc = &du->crtc; + struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc); + + if (!vblank || !vblank->framedur_ns) + return NSEC_PER_SEC / 60; /* disabled; assume 60 Hz */ - return (nsecs > 0) ? nsecs : 16666666; + return vblank->framedur_ns; } /**