[PATCH v2 3/3] present: sync flips unless requested not to

Ben Skeggs skeggsb at gmail.com
Sat Jun 21 00:33:07 PDT 2014


On Thu, May 29, 2014 at 2:40 AM, Frank Binns <frank.binns at imgtec.com> wrote:
> When the display driver supports async flipping this mode of operation is
> always used. This means that, when the swap interval is none 0, the present
> extension relies on vblank events to get synchronised flips. However, by the
> time present gets the event, requests a flip and the GPU has finished we might
> have missed the vblank period. This results in tearing.
>
> Fix this by always doing synced flips unless the client uses the
> PresentOptionAsync flag when presenting a pixmap.
Yes, please!

>
> Signed-off-by: Frank Binns <frank.binns at imgtec.com>
Reviewed-by: Ben Skeggs <bskeggs at redhat.com>

> ---
>  present/present.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/present/present.c b/present/present.c
> index a717d0d..6d3cffa 100644
> --- a/present/present.c
> +++ b/present/present.c
> @@ -706,7 +706,7 @@ present_pixmap(WindowPtr window,
>              }
>          } else {
>              target_msc = crtc_msc;
> -            if (!(options & PresentOptionAsync))
> +            if (!(options & PresentOptionAsync) || !screen_priv->info || !(screen_priv->info->capabilities & PresentCapabilityAsync))
>                  target_msc++;
>          }
>      }
> @@ -781,7 +781,7 @@ present_pixmap(WindowPtr window,
>      vblank->notifies = notifies;
>      vblank->num_notifies = num_notifies;
>
> -    if (!screen_priv->info || !(screen_priv->info->capabilities & PresentCapabilityAsync))
> +    if (!(options & PresentOptionAsync) || !screen_priv->info || !(screen_priv->info->capabilities & PresentCapabilityAsync))
>          vblank->sync_flip = TRUE;
>
>      if (pixmap && present_check_flip (target_crtc, window, pixmap, vblank->sync_flip, valid, x_off, y_off)) {
> @@ -810,7 +810,7 @@ present_pixmap(WindowPtr window,
>
>      xorg_list_add(&vblank->event_queue, &present_exec_queue);
>      vblank->queued = TRUE;
> -    if (target_msc >= crtc_msc) {
> +    if (target_msc > crtc_msc) {
>          ret = present_queue_vblank(screen, target_crtc, vblank->event_id, target_msc);
>          if (ret != Success) {
>              xorg_list_del(&vblank->event_queue);
> --
> 1.8.5.4.gfdaaaa2
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list