diff options
author | Michel Dänzer <[email protected]> | 2006-09-28 14:02:05 +0000 |
---|---|---|
committer | Michel Dänzer <[email protected]> | 2006-09-28 14:02:05 +0000 |
commit | 24bb3b399847bdb11f0008820c2c1bad1e21d499 (patch) | |
tree | 329235d2d35cd0d7b7cf432e636ac06c9868c695 /src/mesa/drivers/dri/common | |
parent | 1d914fe465fd9ac4775b88481c3a84ea398ce66e (diff) |
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.
Diffstat (limited to 'src/mesa/drivers/dri/common')
-rw-r--r-- | src/mesa/drivers/dri/common/vblank.c | 33 | ||||
-rw-r--r-- | src/mesa/drivers/dri/common/vblank.h | 3 |
2 files changed, 21 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c index eebe42d96a1..25b912e8242 100644 --- a/src/mesa/drivers/dri/common/vblank.c +++ b/src/mesa/drivers/dri/common/vblank.c @@ -210,20 +210,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 * wrap the error message logging. The error message should only be logged * the first time the \c drmWaitVBlank fails. If \c drmWaitVBlank is @@ -262,6 +248,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. * * \param vbl_seq Vertical blank sequence number (MSC) after the last buffer diff --git a/src/mesa/drivers/dri/common/vblank.h b/src/mesa/drivers/dri/common/vblank.h index 3dc965def1a..2663956858d 100644 --- a/src/mesa/drivers/dri/common/vblank.h +++ b/src/mesa/drivers/dri/common/vblank.h @@ -47,7 +47,8 @@ extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count ); extern int driWaitForMSC32( __DRIdrawablePrivate *priv, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc ); extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache ); -extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv, GLuint flags ); +extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv, GLuint flags, + GLuint *vbl_seq ); extern int driWaitForVBlank( const __DRIdrawablePrivate *priv, GLuint * vbl_seq, GLuint flags, GLboolean * missed_deadline ); |