[PATCH xserver] xf86-video-modesetting: Fix ms_queue_vblank(flags = MS_QUEUE_RELATIVE)

Alex Goins agoins at nvidia.com
Fri Oct 27 02:53:42 UTC 2017


Adding Keith, as this is a regression that completely breaks PRIME Sync configs
at top of tree.

Thanks,
Alex

On Fri, 20 Oct 2017, Alex Goins wrote:

> 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 at nvidia.com>
> ---
>  hw/xfree86/drivers/modesetting/vblank.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/xfree86/drivers/modesetting/vblank.c b/hw/xfree86/drivers/modesetting/vblank.c
> index 31cf0bd..fe046e4 100644
> --- a/hw/xfree86/drivers/modesetting/vblank.c
> +++ b/hw/xfree86/drivers/modesetting/vblank.c
> @@ -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) {
> -- 
> 2.7.4
> 
> 

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------


More information about the xorg-devel mailing list