[Mesa-dev] [PATCH 2/5] glx/dri3: Track separate (ust, msc) for PresentPixmap vs. PresentNotifyMsc

Axel Davy axel.davy at ens.fr
Thu Dec 4 02:58:28 PST 2014


On 02/12/2014 20:53, Mario Kleiner wrote :
> Prevent calls to glXGetSyncValuesOML() and glXWaitForMscOML()
> from overwriting the (ust,msc) values of the last successfull
> swapbuffers call (PresentPixmapCompleteNotify event), as
> glXWaitForSbcOML() relies on those values corresponding to
> the most recent completed swap, not to whatever was last
> returned from the server.
>
>
> diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
> index b4ac278..5796491 100644
> --- a/src/glx/dri3_glx.c
> +++ b/src/glx/dri3_glx.c
> @@ -420,11 +420,14 @@ dri3_handle_present_event(struct dri3_drawable *priv, xcb_present_generic_event_
>   
>            if (psc->show_fps_interval)
>               show_fps(priv, ce->ust);
> +
> +         priv->ust = ce->ust;
> +         priv->msc = ce->msc;
>         } else {
>            priv->recv_msc_serial = ce->serial;
> +         priv->vblank_ust = ce->ust;
> +         priv->vblank_msc = ce->msc;
>         }
> -      priv->ust = ce->ust;
> -      priv->msc = ce->msc;
>         break;
>      }
>      case XCB_PRESENT_EVENT_IDLE_NOTIFY: {
> @@ -498,8 +501,8 @@ dri3_wait_for_msc(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
>         }
>      }
>   
> -   *ust = priv->ust;
> -   *msc = priv->msc;
> +   *ust = priv->vblank_ust;
> +   *msc = priv->vblank_msc;
>      *sbc = priv->recv_sbc;
>   
>      return 1;
> diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
> index 8e46640..222deb0 100644
> --- a/src/glx/dri3_priv.h
> +++ b/src/glx/dri3_priv.h
> @@ -182,9 +182,12 @@ struct dri3_drawable {
>      uint64_t send_sbc;
>      uint64_t recv_sbc;
>   
> -   /* Last received UST/MSC values */
> +   /* Last received UST/MSC values for pixmap present complete */
>      uint64_t ust, msc;
>   
> +   /* Last received UST/MSC values for vblank */
> +   uint64_t vblank_ust, vblank_msc;
> +
>      /* Serial numbers for tracking wait_for_msc events */
>      uint32_t send_msc_serial;
>      uint32_t recv_msc_serial;

I find using 'vblank' here is ambiguous. Wouldn't 'notify' fit better,
since you want to say it's what you received with the present_notify_event ?

Could you fix names and the comment ?

Axel Davy


More information about the mesa-dev mailing list