xf86-video-modesetting: Fix ms_queue_vblank(flags = MS_QUEUE_RELATIVE)

Change 677c32bc refactored all usages of drmWaitVBlank() into a helper function,
ms_queue_vblank().

ms_queue_vblank() takes in an MS_QUEUE_RELATIVE flag to indicate that the
sequence number is relative rather than absolute, but still treats the actual
sequence number as absolute, passing it through ms_crtc_msc_to_kernel_msc()
unconditionally before calling drmWaitVBlank().

ms_crtc_msc_to_kernel_msc() works by subtracting a vblank offset from the
provided sequence number, which only makes sense for absolute sequence numbers.
In the case of PRIME Sync, drmmode_SharedPixmapPrsentOnVBlank() passes in 1,
which results in a large negative vblank offset. After subtracting, we're left
with a relative sequence number of 100,000+, i.e. wait for 100,000+ vblanks...

In the relative case we want to pass in the sequence number unmodified. Simply
add a check to do this.

Signed-off-by: Alex Goins <agoins@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Alex Goins 2017-10-19 20:02:30 -07:00 committed by Adam Jackson
parent 68d95e759f
commit 266d9868ca

View File

@ -219,7 +219,8 @@ ms_queue_vblank(xf86CrtcPtr crtc, ms_queue_flag flags,
if (flags & MS_QUEUE_NEXT_ON_MISS)
vbl.request.type |= DRM_VBLANK_NEXTONMISS;
vbl.request.sequence = ms_crtc_msc_to_kernel_msc(crtc, msc);
vbl.request.sequence = (flags & MS_QUEUE_RELATIVE) ?
msc : ms_crtc_msc_to_kernel_msc(crtc, msc);
vbl.request.signal = seq;
ret = drmWaitVBlank(ms->fd, &vbl);
if (ret == 0) {