summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/common/vblank.c
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2006-09-28 14:04:19 +0000
committerMichel Dänzer <[email protected]>2006-09-28 14:04:19 +0000
commit7585fc989de1eabe7b978226b8750f912f06778c (patch)
treeb289fb48e61cfc97318df2ad3a0e2cfe25391813 /src/mesa/drivers/dri/common/vblank.c
parent7539fde334d3164bc9d33cdabac9c5741d61d012 (diff)
Add driGetVBlankInterval() helper function.
This can be used by drivers to determine the current swap interval of a drawable.
Diffstat (limited to 'src/mesa/drivers/dri/common/vblank.c')
-rw-r--r--src/mesa/drivers/dri/common/vblank.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c
index 2ec3c12353a..9c219ea37d8 100644
--- a/src/mesa/drivers/dri/common/vblank.c
+++ b/src/mesa/drivers/dri/common/vblank.c
@@ -268,6 +268,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.
*
* \param vbl_seq Vertical blank sequence number (MSC) after the last buffer
@@ -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;