}
-/****************************************************************************/
-/**
- * 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
}
+/****************************************************************************/
+/**
+ * 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.
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 );
if ( intel->driDrawable != driDrawPriv ) {
/* Shouldn't the readbuffer be stored also? */
- driDrawableInitVBlank( driDrawPriv, intel->vblank_flags );
+ driDrawableInitVBlank( driDrawPriv, intel->vblank_flags,
+ &intel->vbl_seq );
intel->driDrawable = driDrawPriv;
intelWindowMoved( intel );
}
- driDrawableInitVBlank( driDrawPriv, newMach64Ctx->vblank_flags );
+ driDrawableInitVBlank( driDrawPriv, newMach64Ctx->vblank_flags,
+ &newMach64Ctx->vbl_seq );
if ( newMach64Ctx->driDrawable != driDrawPriv ) {
newMach64Ctx->driDrawable = driDrawPriv;
mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;
if (mmesa->driDrawable != driDrawPriv) {
- driDrawableInitVBlank( driDrawPriv, mmesa->vblank_flags );
+ driDrawableInitVBlank( driDrawPriv, mmesa->vblank_flags,
+ &mmesa->vbl_seq );
mmesa->driDrawable = driDrawPriv;
mmesa->dirty = ~0;
mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK);
newR128Ctx->dirty = R128_UPLOAD_ALL;
}
- driDrawableInitVBlank( driDrawPriv, newR128Ctx->vblank_flags );
+ driDrawableInitVBlank( driDrawPriv, newR128Ctx->vblank_flags,
+ &newR128Ctx->vbl_seq );
newR128Ctx->driDrawable = driDrawPriv;
_mesa_make_current( newR128Ctx->glCtx,
fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)newCtx->glCtx);
if ( newCtx->dri.drawable != driDrawPriv ) {
- driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags );
+ driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags,
+ &newCtx->vbl_seq );
newCtx->dri.drawable = driDrawPriv;
r200UpdateWindow( newCtx->glCtx );
r200UpdateViewportOffset( newCtx->glCtx );
if (radeon->dri.drawable != driDrawPriv) {
driDrawableInitVBlank(driDrawPriv,
- radeon->vblank_flags);
+ radeon->vblank_flags,
+ &radeon->vbl_seq);
radeon->dri.drawable = driDrawPriv;
r300UpdateWindow(radeon->glCtx);
if ( newCtx->dri.drawable != driDrawPriv ) {
/* XXX we may need to validate the drawable here!!! */
- driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags );
+ driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags,
+ &newCtx->vbl_seq );
newCtx->dri.drawable = driDrawPriv;
radeonUpdateWindow( newCtx->glCtx );
radeonUpdateViewportOffset( newCtx->glCtx );
readBuffer = (GLframebuffer *)driReadPriv->driverPrivate;
if ( vmesa->driDrawable != driDrawPriv ) {
- driDrawableInitVBlank( driDrawPriv, vmesa->vblank_flags );
+ driDrawableInitVBlank( driDrawPriv, vmesa->vblank_flags,
+ &vmesa->vbl_seq );
vmesa->driDrawable = driDrawPriv;
if ( ! calculate_buffer_parameters( vmesa, drawBuffer ) ) {
return GL_FALSE;