[PATCH] present: Queue flips for later execution

Eric Anholt eric at anholt.net
Tue Apr 22 13:18:39 PDT 2014


Keith Packard <keithp at keithp.com> writes:

> When a flip (or unflip) is pending and a flip request comes in, leave
> it queued until the pending flip completes and then execute it.
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
>  present/present.c      | 126 ++++++++++++++++++++++++++++++++++---------------
>  present/present_priv.h |   1 +
>  2 files changed, 89 insertions(+), 38 deletions(-)
>
> diff --git a/present/present.c b/present/present.c
> index 73d5f69..1bf3a58 100644
> --- a/present/present.c
> +++ b/present/present.c
> @@ -42,6 +42,9 @@ static struct xorg_list present_flip_queue;
>  #define DebugPresent(x)
>  #endif
>  
> +static void
> +present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc);
> +
>  /*
>   * Copies the update region from a pixmap to the target drawable
>   */
> @@ -78,6 +81,20 @@ present_copy_region(DrawablePtr drawable,
>      FreeScratchGC(gc);
>  }
>  
> +static inline PixmapPtr
> +present_flip_pending_pixmap(ScreenPtr screen)
> +{
> +    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
> +
> +    if (!screen_priv)
> +        return NULL;
> +
> +    if (!screen_priv->flip_pending)
> +        return NULL;
> +        
> +    return screen_priv->flip_pending->pixmap;

trailing whitespace.

> +}
> @@ -644,7 +690,7 @@ present_pixmap(WindowPtr window,
>      uint64_t                    target_msc;
>      uint64_t                    crtc_msc;
>      int                         ret;
> -    present_vblank_ptr          vblank;
> +    present_vblank_ptr          vblank, tmp;
>      ScreenPtr                   screen = window->drawable.pScreen;
>      present_window_priv_ptr     window_priv = present_get_window_priv(window, TRUE);
>      present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
> @@ -664,7 +710,7 @@ present_pixmap(WindowPtr window,
>              target_crtc = present_get_crtc(window);
>      }
>  
> -    present_get_ust_msc(window, target_crtc, &ust, &crtc_msc);
> +    present_get_ust_msc(screen, target_crtc, &ust, &crtc_msc);
>  
>      target_msc = present_window_to_crtc_msc(window, target_crtc, window_msc, crtc_msc);
>  
> @@ -698,7 +744,7 @@ present_pixmap(WindowPtr window,
>       */
>  
>      if (!update) {
> -        xorg_list_for_each_entry(vblank, &window_priv->vblank, window_list) {
> +        xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->vblank, window_list) {
>  
>              if (!vblank->pixmap)
>                  continue;
> @@ -706,11 +752,11 @@ present_pixmap(WindowPtr window,
>              if (!vblank->queued)
>                  continue;
>  
> -            if (vblank->crtc != target_crtc || vblank->target_msc != target_msc)
> +            if (vblank->crtc != target_crtc || vblank->target_msc > target_msc)
>                  continue;
>  
>              DebugPresent(("\tx %lld %p %8lld: %08lx -> %08lx (crtc %p)\n",
> -                          vblank->event_id, vblank, target_msc,
> +                          vblank->event_id, vblank, vblank->target_msc,
>                            vblank->pixmap->drawable.id, vblank->window->drawable.id,
>                            vblank->crtc));
>  
> @@ -720,6 +766,9 @@ present_pixmap(WindowPtr window,
>  
>              vblank->pixmap = NULL;
>              vblank->idle_fence = NULL;
> +            vblank->flip = FALSE;
> +            if (vblank->flip_ready)
> +                present_re_execute(vblank);
>          }
>      }
>  

So, when we're replacing a previous flip for a given MSC with a new
presented pixmap for the same MSC, we disable pageflip for it.  I don't
see anything else that would reset the flip bit (flip only gets set in
present_pixmap below).  Shouldn't we be doing a vblank->flip =
check_flip(...), instead?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140422/57836f59/attachment.sig>


More information about the xorg-devel mailing list