If get_buffers() hadn't been called yet, we would return the age of the last back, rather than the one that's actually going to be used for this frame.
Note that get_buffers() can sometimes reallocate. We're covered on that front, though -- it does a copy_area() when it reallocates, which fulfills the requirement that pixels whose ownership passes both before and after are of the correct age. Fixes piglit glx_buffer_age with vblank_mode=0 set. --- src/glx/dri3_glx.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index e5862f3..f66f322 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -1386,11 +1386,15 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, static int dri3_get_buffer_age(__GLXDRIdrawable *pdraw) { + xcb_connection_t *c = XGetXCBConnection(pdraw->psc->dpy); struct dri3_drawable *priv = (struct dri3_drawable *) pdraw; - const struct dri3_buffer *const back = dri3_back_buffer(priv); + int back_id = DRI3_BACK_ID(dri3_find_back(c, priv)); + + if (back_id < 0 || !priv->buffers[back_id]) + return 0; - if (back->last_swap != 0) - return priv->send_sbc - back->last_swap + 1; + if (priv->buffers[back_id]->last_swap != 0) + return priv->send_sbc - priv->buffers[back_id]->last_swap + 1; else return 0; } -- 1.9.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev