From 24bb3b399847bdb11f0008820c2c1bad1e21d499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 28 Sep 2006 14:02:05 +0000 Subject: Make driDrawableInitVBlank() initialize the sequence number. This prevents the first wait for vertical blank from timing out when the X server has been running for a long time. --- src/mesa/drivers/dri/common/vblank.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'src/mesa/drivers/dri/common/vblank.c') diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c index eebe42d96a..25b912e824 100644 --- a/src/mesa/drivers/dri/common/vblank.c +++ b/src/mesa/drivers/dri/common/vblank.c @@ -208,20 +208,6 @@ GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache ) } -/****************************************************************************/ -/** - * Sets the default swap interval when the drawable is first bound to a - * direct rendering context. - */ - -void driDrawableInitVBlank( __DRIdrawablePrivate *priv, GLuint flags ) -{ - if ( priv->pdraw->swap_interval == (unsigned)-1 ) { - priv->pdraw->swap_interval = (flags & VBLANK_FLAG_THROTTLE) != 0 ? 1 : 0; - } -} - - /****************************************************************************/ /** * Wrapper to call \c drmWaitVBlank. The main purpose of this function is to @@ -260,6 +246,25 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd ) } +/****************************************************************************/ +/** + * Sets the default swap interval when the drawable is first bound to a + * direct rendering context. + */ + +void driDrawableInitVBlank( __DRIdrawablePrivate *priv, GLuint flags, + GLuint *vbl_seq ) +{ + if ( priv->pdraw->swap_interval == (unsigned)-1 ) { + /* Get current vertical blank sequence */ + drmVBlank vbl = { .request={ .type = DRM_VBLANK_RELATIVE, .sequence = 0 } }; + do_wait( &vbl, vbl_seq, priv->driScreenPriv->fd ); + + priv->pdraw->swap_interval = (flags & VBLANK_FLAG_THROTTLE) != 0 ? 1 : 0; + } +} + + /****************************************************************************/ /** * Waits for the vertical blank for use with glXSwapBuffers. -- cgit v1.2.3