[Mesa-dev] [PATCH 3/3] dri3: Add GLX_EXT_buffer_age support

Eric Anholt eric at anholt.net
Mon Feb 24 10:37:52 PST 2014


Adel Gadllah <adel.gadllah at gmail.com> writes:

> ---
>  src/glx/dri2_glx.c      |  1 +
>  src/glx/dri3_glx.c      | 18 ++++++++++++++++++
>  src/glx/dri3_priv.h     |  2 ++
>  src/glx/glx_pbuffer.c   |  8 ++++++++
>  src/glx/glxclient.h     |  1 +
>  src/glx/glxextensions.c |  1 +
>  src/glx/glxextensions.h |  1 +
>  7 files changed, 32 insertions(+)
>
> diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
> index 67fe9c1..146802a 100644
> --- a/src/glx/dri2_glx.c
> +++ b/src/glx/dri2_glx.c
> @@ -1288,6 +1288,7 @@ dri2CreateScreen(int screen, struct glx_display * priv)
>     psp->waitForSBC = NULL;
>     psp->setSwapInterval = NULL;
>     psp->getSwapInterval = NULL;
> +   psp->getBufferAge = NULL;
>  
>     if (pdp->driMinor >= 2) {
>        psp->getDrawableMSC = dri2DrawableGetMSC;
> diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
> index 70ec057..697d448 100644
> --- a/src/glx/dri3_glx.c
> +++ b/src/glx/dri3_glx.c
> @@ -1345,6 +1345,7 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
>           target_msc = priv->msc + priv->swap_interval * (priv->send_sbc - priv->recv_sbc);
>  
>        priv->buffers[buf_id]->busy = 1;
> +      priv->buffers[buf_id]->last_swap = priv->swap_count;
>        xcb_present_pixmap(c,
>                           priv->base.xDrawable,
>                           priv->buffers[buf_id]->pixmap,
> @@ -1379,11 +1380,25 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
>        xcb_flush(c);
>        if (priv->stamp)
>           ++(*priv->stamp);
> +
> +      priv->swap_count++;
>     }

Can't you just use priv->send_sbc for swap_count?  It looks like you've
got the order swapped of the two operations currently:

           "* The current back buffer's age is set to 1.
            * Any other color buffers' ages are incremented by 1 if
              their age was previously greater than 0."

As is, when an application gets the buffer from the first swap back, it
will get a 0 (invalid) age instead of a valid age.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140224/ac75300c/attachment-0001.pgp>


More information about the mesa-dev mailing list