mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 15:38:09 +02:00
Add driGetVBlankInterval() helper function.
This can be used by drivers to determine the current swap interval of a drawable.
This commit is contained in:
parent
7539fde334
commit
7585fc989d
2 changed files with 27 additions and 14 deletions
|
|
@ -266,6 +266,30 @@ void driDrawableInitVBlank( __DRIdrawablePrivate *priv, GLuint flags,
|
|||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
* Returns the current swap interval of the given drawable.
|
||||
*/
|
||||
|
||||
unsigned
|
||||
driGetVBlankInterval( const __DRIdrawablePrivate *priv, GLuint flags )
|
||||
{
|
||||
if ( (flags & VBLANK_FLAG_INTERVAL) != 0 ) {
|
||||
/* this must have been initialized when the drawable was first bound
|
||||
* to a direct rendering context. */
|
||||
assert ( priv->pdraw->swap_interval != (unsigned)-1 );
|
||||
|
||||
return priv->pdraw->swap_interval;
|
||||
}
|
||||
else if ( (flags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
* Waits for the vertical blank for use with glXSwapBuffers.
|
||||
|
|
@ -310,20 +334,7 @@ driWaitForVBlank( const __DRIdrawablePrivate *priv, GLuint * vbl_seq,
|
|||
*/
|
||||
|
||||
original_seq = *vbl_seq;
|
||||
|
||||
if ( (flags & VBLANK_FLAG_INTERVAL) != 0 ) {
|
||||
interval = priv->pdraw->swap_interval;
|
||||
/* this must have been initialized when the drawable was first bound
|
||||
* to a direct rendering context. */
|
||||
assert ( interval != (unsigned)-1 );
|
||||
}
|
||||
else if ( (flags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) {
|
||||
interval = 1;
|
||||
}
|
||||
else {
|
||||
interval = 0;
|
||||
}
|
||||
|
||||
interval = driGetVBlankInterval(priv, flags);
|
||||
deadline = original_seq + interval;
|
||||
|
||||
vbl.request.type = DRM_VBLANK_RELATIVE;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ extern int driWaitForMSC32( __DRIdrawablePrivate *priv,
|
|||
extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache );
|
||||
extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv, GLuint flags,
|
||||
GLuint *vbl_seq );
|
||||
extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv,
|
||||
GLuint flags );
|
||||
extern int driWaitForVBlank( const __DRIdrawablePrivate *priv,
|
||||
GLuint * vbl_seq, GLuint flags, GLboolean * missed_deadline );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue