• Ville Syrjälä's avatar
    drm/i915: Move vrr push after the frame counter sampling again · 4765d061
    Ville Syrjälä authored
    Moving the vrr push to happen before sampling the frame counter
    was wrong. If we are already in vblank when the push is sent
    the vblank exit will start immediately which causes the sampled
    frame counter to correspond to the next frame instead of the current
    frame.
    
    So put things back into the original order (except we should
    keep the vrr push within the irq disable section to avoid
    pointless irq related delays here).
    
    We'll just have to accept the tiny race that exists between
    sampling the frame counter vs. vrr push. And let's at least
    document said race properly in a comment.
    
    I suppose we could try to minimize the race by sampling the frame
    counter just before sending the push, but that would require
    changing drm_crtc_arm_vblank_event() to accept a caller provided
    vblank counter value, so leave it be for now. Another thing we
    could do is change the vblank evasion to account for the case
    where a push was already sent. That would anyway be required
    for mailbox style updates. Currently mailbox updates are only
    used by the legacy cursor, but we don't do a vrr push for those.
    
    Cc: Manasi Navare <manasi.d.navare@intel.com>
    Fixes: 6f9976bd ("drm/i915: Do vrr push before sampling the frame counter")
    Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20211117183103.27418-1-ville.syrjala@linux.intel.comReviewed-by: default avatarManasi Navare <manasi.d.navare@intel.com>
    4765d061
intel_crtc.c 19.2 KB