Refactor and fix core vblank support

Consolidate support for synchronizing to and retrieving vblank counters.  Also
fix the core vblank code to return monotonic MSC counters, which are required
by some GLX extensions.  Adding support for multiple pipes to a low level
driver is fairly easy, the Intel 965 driver provides simple example code (see
intel_buffers.c:intelWindowMoved()).

The new code bumps the media stream counter extension version to 2 and adds a
new getDrawableMSC callback.  This callback takes a drawablePrivate pointer,
which is used to calculate the MSC value seen by clients based on the actual
vblank counter(s) returned from the kernel.  The new drawable private fields
are as follows:
  - vblSeq - used for tracking vblank counts for buffer swapping
  - vblFlags - flags (e.g. current pipe), updated by low level driver
  - msc_base - MSC counter from the last time the current pipe changed
  - vblank_base - kernel DRM vblank counter from the last time the pipe changed

Using the above variables, the core vblank code (in vblank.c) can calculate a
monotonic MSC value.  The low level DRI drivers are responsible for updating
the current pipe (by setting VBLANK_FLAG_SECONDARY for example in vblFlags)
along with msc_base and vblank_base whenever the pipe associated with a given
drawable changes (again, see intelWindowMoved for an example of this).

Drivers should fill in the GetDrawableMSC DriverAPIRec field to point to
driDrawableGetMSC32 and add code for pipe switching as outlined above to fully
support the new scheme.
This commit is contained in:
Jesse Barnes 2007-10-29 11:56:31 -07:00
parent 40133487db
commit 38fdb47d26
50 changed files with 340 additions and 173 deletions

View File

@ -170,7 +170,7 @@ struct __DRIframeTrackingExtensionRec {
* Used by drivers that implement the GLX_SGI_video_sync extension. * Used by drivers that implement the GLX_SGI_video_sync extension.
*/ */
#define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter" #define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter"
#define __DRI_MEDIA_STREAM_COUNTER_VERSION 1 #define __DRI_MEDIA_STREAM_COUNTER_VERSION 2
struct __DRImediaStreamCounterExtensionRec { struct __DRImediaStreamCounterExtensionRec {
__DRIextension base; __DRIextension base;
@ -189,6 +189,18 @@ struct __DRImediaStreamCounterExtensionRec {
int (*waitForMSC)(__DRIdrawable *drawable, int (*waitForMSC)(__DRIdrawable *drawable,
int64_t target_msc, int64_t divisor, int64_t remainder, int64_t target_msc, int64_t divisor, int64_t remainder,
int64_t * msc, int64_t * sbc); int64_t * msc, int64_t * sbc);
/**
* Like the screen version of getMSC, but also takes a drawable so that
* the appropriate pipe's counter can be retrieved.
*
* Get the number of vertical refreshes since some point in time before
* this function was first called (i.e., system start up).
*
* \since Internal API version 2
*/
int (*getDrawableMSC)(__DRIscreen *screen, void *drawablePrivate,
int64_t *msc);
}; };

View File

@ -1941,13 +1941,24 @@ static int __glXGetVideoSyncSGI(unsigned int *count)
if ( (gc != NULL) && gc->isDirect ) { if ( (gc != NULL) && gc->isDirect ) {
__GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy, __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
gc->screen ); gc->screen );
if (psc->msc != NULL && psc->driScreen.private != NULL) { if ( psc->msc && psc->driScreen.private ) {
int ret; __DRIdrawable * const pdraw =
int64_t temp; GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
int64_t temp;
ret = psc->msc->getMSC(&psc->driScreen, &temp); int ret;
*count = (unsigned) temp;
return (ret == 0) ? 0 : GLX_BAD_CONTEXT; /*
* Try to use getDrawableMSC first so we get the right
* counter...
*/
if (psc->msc->base.version >= 2 && psc->msc->getDrawableMSC)
ret = (*psc->msc->getDrawableMSC)( &psc->driScreen,
pdraw->private,
& temp);
else
ret = (*psc->msc->getMSC)( &psc->driScreen, & temp);
*count = (unsigned) temp;
return (ret == 0) ? 0 : GLX_BAD_CONTEXT;
} }
} }
#else #else
@ -1970,16 +1981,14 @@ static int __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count
if (psc->msc != NULL && psc->driScreen.private ) { if (psc->msc != NULL && psc->driScreen.private ) {
__DRIdrawable * const pdraw = __DRIdrawable * const pdraw =
GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL); GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
if (pdraw != NULL) { int ret;
int ret; int64_t msc;
int64_t msc; int64_t sbc;
int64_t sbc;
ret = (*psc->msc->waitForMSC)(pdraw, 0, ret = (*psc->msc->waitForMSC)(pdraw, 0, divisor, remainder, &msc,
divisor, remainder, &msc, &sbc); &sbc);
*count = (unsigned) msc; *count = (unsigned) msc;
return (ret == 0) ? 0 : GLX_BAD_CONTEXT; return (ret == 0) ? 0 : GLX_BAD_CONTEXT;
}
} }
} }
#else #else

View File

@ -356,10 +356,18 @@ static void driSwapBuffers(__DRIdrawable *drawable)
&rect, 1, GL_TRUE); &rect, 1, GL_TRUE);
} }
static int driDrawableGetMSC( __DRIscreen *screen, void *drawablePrivate,
int64_t *msc )
{
__DRIscreenPrivate *sPriv = screen->private;
return sPriv->DriverAPI.GetDrawableMSC( sPriv, drawablePrivate, msc );
}
/** /**
* Called directly from a number of higher-level GLX functions. * Called directly from a number of higher-level GLX functions.
*/ */
static int driGetMSC( __DRIscreen *screen, int64_t *msc ) static int driGetMSC( __DRIscreen *screen, void *drawablePrivate, int64_t *msc )
{ {
__DRIscreenPrivate *sPriv = screen->private; __DRIscreenPrivate *sPriv = screen->private;
@ -396,6 +404,7 @@ const __DRImediaStreamCounterExtension driMediaStreamCounterExtension = {
{ __DRI_MEDIA_STREAM_COUNTER, __DRI_MEDIA_STREAM_COUNTER_VERSION }, { __DRI_MEDIA_STREAM_COUNTER, __DRI_MEDIA_STREAM_COUNTER_VERSION },
driGetMSC, driGetMSC,
driWaitForMSC, driWaitForMSC,
driDrawableGetMSC,
}; };
static void driCopySubBuffer(__DRIdrawable *drawable, static void driCopySubBuffer(__DRIdrawable *drawable,
@ -471,6 +480,8 @@ static void *driCreateNewDrawable(__DRIscreen *screen,
pdp->numBackClipRects = 0; pdp->numBackClipRects = 0;
pdp->pClipRects = NULL; pdp->pClipRects = NULL;
pdp->pBackClipRects = NULL; pdp->pBackClipRects = NULL;
pdp->vblSeq = 0;
pdp->vblFlags = 0;
psp = (__DRIscreenPrivate *)screen->private; psp = (__DRIscreenPrivate *)screen->private;
pdp->driScreenPriv = psp; pdp->driScreenPriv = psp;
@ -485,6 +496,7 @@ static void *driCreateNewDrawable(__DRIscreen *screen,
pdraw->private = pdp; pdraw->private = pdp;
pdraw->destroyDrawable = driDestroyDrawable; pdraw->destroyDrawable = driDestroyDrawable;
pdraw->swapBuffers = driSwapBuffers; /* called by glXSwapBuffers() */ pdraw->swapBuffers = driSwapBuffers; /* called by glXSwapBuffers() */
pdp->msc_base = 0;
/* This special default value is replaced with the configured /* This special default value is replaced with the configured
* default value when the drawable is first bound to a direct * default value when the drawable is first bound to a direct

View File

@ -206,6 +206,14 @@ struct __DriverAPIRec {
*/ */
void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname, void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
unsigned long long offset, GLint depth, GLuint pitch); unsigned long long offset, GLint depth, GLuint pitch);
/**
* New version of GetMSC so we can pass drawable data to the low level
* DRM driver (e.g. pipe info).
*/
int (*GetDrawableMSC) ( __DRIscreenPrivate * priv,
__DRIdrawablePrivate *drawablePrivate,
int64_t *count);
}; };
@ -317,6 +325,32 @@ struct __DRIdrawablePrivateRec {
drm_clip_rect_t *pBackClipRects; drm_clip_rect_t *pBackClipRects;
/*@}*/ /*@}*/
/**
* \name Vertical blank tracking information
* Used for waiting on vertical blank events.
*/
/*@{*/
unsigned int vblSeq;
unsigned int vblFlags;
/*@}*/
/**
* \name Monotonic MSC tracking
*
* Low level driver is responsible for updating msc_base and
* vblSeq values so that higher level code can calculate
* a new msc value or msc target for a WaitMSC call. The new value
* will be:
* msc = msc_base + get_vblank_count() - vblank_base;
*
* And for waiting on a value, core code will use:
* actual_target = target_msc - msc_base + vblank_base;
*/
/*@{*/
int64_t vblank_base;
int64_t msc_base;
/*@}*/
/** /**
* Pointer to context to which this drawable is currently bound. * Pointer to context to which this drawable is currently bound.
*/ */

View File

@ -35,8 +35,62 @@
#include "vblank.h" #include "vblank.h"
#include "xmlpool.h" #include "xmlpool.h"
static unsigned int msc_to_vblank(__DRIdrawablePrivate * dPriv, int64_t msc)
{
return (unsigned int)(msc - dPriv->msc_base + dPriv->vblank_base);
}
static int64_t vblank_to_msc(__DRIdrawablePrivate * dPriv, unsigned int vblank)
{
return (int64_t)(vblank - dPriv->vblank_base + dPriv->msc_base);
}
/****************************************************************************/ /****************************************************************************/
/**
* Get the current MSC refresh counter.
*
* Stores the 64-bit count of vertical refreshes since some (arbitrary)
* point in time in \c count. Unless the value wraps around, which it
* may, it will never decrease for a given drawable.
*
* \warning This function is called from \c glXGetVideoSyncSGI, which expects
* a \c count of type \c unsigned (32-bit), and \c glXGetSyncValuesOML, which
* expects a \c count of type \c int64_t (signed 64-bit). The kernel ioctl
* currently always returns a \c sequence of type \c unsigned.
*
* \param priv Pointer to the DRI screen private struct.
* \param dPriv Pointer to the DRI drawable private struct
* \param count Storage to hold MSC counter.
* \return Zero is returned on success. A negative errno value
* is returned on failure.
*/
int driDrawableGetMSC32( __DRIscreenPrivate * priv,
__DRIdrawablePrivate * dPriv,
int64_t * count)
{
drmVBlank vbl;
int ret;
/* Don't wait for anything. Just get the current refresh count. */
vbl.request.type = DRM_VBLANK_RELATIVE;
vbl.request.sequence = 0;
if ( dPriv && dPriv->vblFlags & VBLANK_FLAG_SECONDARY )
vbl.request.type |= DRM_VBLANK_SECONDARY;
ret = drmWaitVBlank( priv->fd, &vbl );
if (dPriv) {
*count = vblank_to_msc(dPriv, vbl.reply.sequence);
} else {
/* Old driver (no knowledge of drawable MSC callback) */
*count = vbl.reply.sequence;
}
return ret;
}
/** /**
* Get the current MSC refresh counter. * Get the current MSC refresh counter.
* *
@ -49,6 +103,10 @@
* expects a \c count of type \c int64_t (signed 64-bit). The kernel ioctl * expects a \c count of type \c int64_t (signed 64-bit). The kernel ioctl
* currently always returns a \c sequence of type \c unsigned. * currently always returns a \c sequence of type \c unsigned.
* *
* Since this function doesn't take a drawable, it may end up getting the MSC
* value from a pipe not associated with the caller's context, resuling in
* undesired behavior.
*
* \param priv Pointer to the DRI screen private struct. * \param priv Pointer to the DRI screen private struct.
* \param count Storage to hold MSC counter. * \param count Storage to hold MSC counter.
* \return Zero is returned on success. A negative errno value * \return Zero is returned on success. A negative errno value
@ -56,21 +114,9 @@
*/ */
int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count ) int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count )
{ {
drmVBlank vbl; return driDrawableGetMSC32(priv, NULL, count);
int ret;
/* Don't wait for anything. Just get the current refresh count. */
vbl.request.type = DRM_VBLANK_RELATIVE;
vbl.request.sequence = 0;
ret = drmWaitVBlank( priv->fd, &vbl );
*count = (int64_t)vbl.reply.sequence;
return ret;
} }
/****************************************************************************/ /****************************************************************************/
/** /**
* Wait for a specified refresh count. This implements most of the * Wait for a specified refresh count. This implements most of the
@ -123,7 +169,9 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv,
*/ */
vbl.request.type = dont_wait ? DRM_VBLANK_RELATIVE : vbl.request.type = dont_wait ? DRM_VBLANK_RELATIVE :
DRM_VBLANK_ABSOLUTE; DRM_VBLANK_ABSOLUTE;
vbl.request.sequence = next; vbl.request.sequence = next ? msc_to_vblank(priv, next) : 0;
if ( priv->vblFlags & VBLANK_FLAG_SECONDARY )
vbl.request.type |= DRM_VBLANK_SECONDARY;
if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) { if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) {
/* FIXME: This doesn't seem like the right thing to return here. /* FIXME: This doesn't seem like the right thing to return here.
@ -131,8 +179,10 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv,
return GLX_BAD_CONTEXT; return GLX_BAD_CONTEXT;
} }
*msc = vblank_to_msc(priv, vbl.reply.sequence);
dont_wait = 0; dont_wait = 0;
if (target_msc != 0 && vbl.reply.sequence == target) if (target_msc != 0 && *msc == target)
break; break;
/* Assuming the wait-done test fails, the next refresh to wait for /* Assuming the wait-done test fails, the next refresh to wait for
@ -142,9 +192,9 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv,
* If this refresh has already happened, we add divisor to obtain * If this refresh has already happened, we add divisor to obtain
* the next refresh after the current one that will satisfy it. * the next refresh after the current one that will satisfy it.
*/ */
r = (vbl.reply.sequence % (unsigned int)divisor); r = (*msc % (unsigned int)divisor);
next = (vbl.reply.sequence - r + (unsigned int)remainder); next = (*msc - r + (unsigned int)remainder);
if (next <= vbl.reply.sequence) next += (unsigned int)divisor; if (next <= *msc) next += (unsigned int)divisor;
} while ( r != (unsigned int)remainder ); } while ( r != (unsigned int)remainder );
} }
@ -154,7 +204,10 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv,
*/ */
vbl.request.type = DRM_VBLANK_ABSOLUTE; vbl.request.type = DRM_VBLANK_ABSOLUTE;
vbl.request.sequence = target_msc; vbl.request.sequence = target_msc ? msc_to_vblank(priv, target_msc) : 0;
if ( priv->vblFlags & VBLANK_FLAG_SECONDARY )
vbl.request.type |= DRM_VBLANK_SECONDARY;
if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) { if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) {
/* FIXME: This doesn't seem like the right thing to return here. /* FIXME: This doesn't seem like the right thing to return here.
@ -163,8 +216,8 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv,
} }
} }
*msc = (target_msc & 0xffffffff00000000LL); *msc = vblank_to_msc(priv, vbl.reply.sequence);
*msc |= vbl.reply.sequence;
if ( *msc < target_msc ) { if ( *msc < target_msc ) {
*msc += 0x0000000100000000LL; *msc += 0x0000000100000000LL;
} }
@ -252,16 +305,21 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd )
* direct rendering context. * direct rendering context.
*/ */
void driDrawableInitVBlank( __DRIdrawablePrivate *priv, GLuint flags, void driDrawableInitVBlank( __DRIdrawablePrivate *priv )
GLuint *vbl_seq )
{ {
if ( priv->swap_interval == (unsigned)-1 ) { if ( priv->swap_interval == (unsigned)-1 ) {
/* Get current vertical blank sequence */ /* Get current vertical blank sequence */
drmVBlank vbl = { .request={ .type = DRM_VBLANK_RELATIVE, .sequence = 0 } }; drmVBlank vbl;
do_wait( &vbl, vbl_seq, priv->driScreenPriv->fd );
vbl.request.type = DRM_VBLANK_RELATIVE;
if ( priv->vblFlags & VBLANK_FLAG_SECONDARY )
vbl.request.type |= DRM_VBLANK_SECONDARY;
vbl.request.sequence = 0;
do_wait( &vbl, &priv->vblSeq, priv->driScreenPriv->fd );
priv->vblank_base = priv->vblSeq;
priv->swap_interval = (flags & (VBLANK_FLAG_THROTTLE | priv->swap_interval =
VBLANK_FLAG_SYNC)) != 0 ? 1 : 0; (priv->vblFlags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) ? 1 : 0;
} }
} }

View File

@ -46,11 +46,13 @@
*/ */
extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count ); extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count );
extern int driDrawableGetMSC32( __DRIscreenPrivate * priv,
__DRIdrawablePrivate * drawablePrivate,
int64_t * count);
extern int driWaitForMSC32( __DRIdrawablePrivate *priv, extern int driWaitForMSC32( __DRIdrawablePrivate *priv,
int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc ); int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc );
extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache ); extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache );
extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv, GLuint flags, extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv );
GLuint *vbl_seq );
extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv, extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv,
GLuint flags ); GLuint flags );
extern void driGetCurrentVBlank( const __DRIdrawablePrivate *priv, extern void driGetCurrentVBlank( const __DRIdrawablePrivate *priv,

View File

@ -615,6 +615,7 @@ static const struct __DriverAPIRec ffbAPI = {
.UnbindContext = ffbUnbindContext, .UnbindContext = ffbUnbindContext,
.GetSwapInfo = NULL, .GetSwapInfo = NULL,
.GetMSC = NULL, .GetMSC = NULL,
.GetDrawableMSC = NULL,
.WaitForMSC = NULL, .WaitForMSC = NULL,
.WaitForSBC = NULL, .WaitForSBC = NULL,
.SwapBuffersMSC = NULL .SwapBuffersMSC = NULL

View File

@ -413,6 +413,7 @@ static const struct __DriverAPIRec i810API = {
.UnbindContext = i810UnbindContext, .UnbindContext = i810UnbindContext,
.GetSwapInfo = NULL, .GetSwapInfo = NULL,
.GetMSC = NULL, .GetMSC = NULL,
.GetDrawableMSC = NULL,
.WaitForMSC = NULL, .WaitForMSC = NULL,
.WaitForSBC = NULL, .WaitForSBC = NULL,
.SwapBuffersMSC = NULL .SwapBuffersMSC = NULL

View File

@ -243,7 +243,7 @@ intelWindowMoved(struct intel_context *intel)
.y2 = sarea->planeB_y + sarea->planeB_h }; .y2 = sarea->planeB_y + sarea->planeB_h };
GLint areaA = driIntersectArea( drw_rect, planeA_rect ); GLint areaA = driIntersectArea( drw_rect, planeA_rect );
GLint areaB = driIntersectArea( drw_rect, planeB_rect ); GLint areaB = driIntersectArea( drw_rect, planeB_rect );
GLuint flags = intel_fb->vblank_flags; GLuint flags = dPriv->vblFlags;
GLboolean pf_active; GLboolean pf_active;
GLint pf_planes; GLint pf_planes;
@ -311,19 +311,24 @@ intelWindowMoved(struct intel_context *intel)
/* Update vblank info /* Update vblank info
*/ */
if (areaB > areaA || (areaA == areaB && areaB > 0)) { if (areaB > areaA || (areaA == areaB && areaB > 0)) {
flags = intel_fb->vblank_flags | VBLANK_FLAG_SECONDARY; flags = dPriv->vblFlags | VBLANK_FLAG_SECONDARY;
} else { } else {
flags = intel_fb->vblank_flags & ~VBLANK_FLAG_SECONDARY; flags = dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY;
} }
if (flags != intel_fb->vblank_flags && intel_fb->vblank_flags && /* Check to see if we changed pipes */
!(intel_fb->vblank_flags & VBLANK_FLAG_NO_IRQ)) { if (flags != dPriv->vblFlags && dPriv->vblFlags &&
!(dPriv->vblFlags & VBLANK_FLAG_NO_IRQ)) {
int64_t count;
drmVBlank vbl; drmVBlank vbl;
int i; int i;
/*
* Deal with page flipping
*/
vbl.request.type = DRM_VBLANK_ABSOLUTE; vbl.request.type = DRM_VBLANK_ABSOLUTE;
if ( intel_fb->vblank_flags & VBLANK_FLAG_SECONDARY ) { if ( dPriv->vblFlags & VBLANK_FLAG_SECONDARY ) {
vbl.request.type |= DRM_VBLANK_SECONDARY; vbl.request.type |= DRM_VBLANK_SECONDARY;
} }
@ -337,9 +342,19 @@ intelWindowMoved(struct intel_context *intel)
drmWaitVBlank(intel->driFd, &vbl); drmWaitVBlank(intel->driFd, &vbl);
} }
intel_fb->vblank_flags = flags; /*
driGetCurrentVBlank(dPriv, intel_fb->vblank_flags, &intel_fb->vbl_seq); * Update msc_base from old pipe
intel_fb->vbl_waited = intel_fb->vbl_seq; */
driDrawableGetMSC32(dPriv->driScreenPriv, dPriv, &count);
dPriv->msc_base = count;
/*
* Then get new vblank_base and vblSeq values
*/
dPriv->vblFlags = flags;
driGetCurrentVBlank(dPriv, dPriv->vblFlags, &dPriv->vblSeq);
dPriv->vblank_base = dPriv->vblSeq;
intel_fb->vbl_waited = dPriv->vblSeq;
for (i = 0; i < intel_fb->pf_num_pages; i++) { for (i = 0; i < intel_fb->pf_num_pages; i++) {
if (intel_fb->color_rb[i]) if (intel_fb->color_rb[i])
@ -347,7 +362,7 @@ intelWindowMoved(struct intel_context *intel)
} }
} }
} else { } else {
intel_fb->vblank_flags &= ~VBLANK_FLAG_SECONDARY; dPriv->vblFlags &= ~VBLANK_FLAG_SECONDARY;
} }
/* Update Mesa's notion of window size */ /* Update Mesa's notion of window size */
@ -820,10 +835,10 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv)
*/ */
static GLboolean static GLboolean
intelScheduleSwap(const __DRIdrawablePrivate * dPriv, GLboolean *missed_target) intelScheduleSwap(__DRIdrawablePrivate * dPriv, GLboolean *missed_target)
{ {
struct intel_framebuffer *intel_fb = dPriv->driverPrivate; struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
unsigned int interval = driGetVBlankInterval(dPriv, intel_fb->vblank_flags); unsigned int interval = driGetVBlankInterval(dPriv, dPriv->vblFlags);
struct intel_context *intel = struct intel_context *intel =
intelScreenContext(dPriv->driScreenPriv->private); intelScreenContext(dPriv->driScreenPriv->private);
const intelScreenPrivate *intelScreen = intel->intelScreen; const intelScreenPrivate *intelScreen = intel->intelScreen;
@ -831,24 +846,24 @@ intelScheduleSwap(const __DRIdrawablePrivate * dPriv, GLboolean *missed_target)
drm_i915_vblank_swap_t swap; drm_i915_vblank_swap_t swap;
GLboolean ret; GLboolean ret;
if (!intel_fb->vblank_flags || if (!dPriv->vblFlags ||
(intel_fb->vblank_flags & VBLANK_FLAG_NO_IRQ) || (dPriv->vblFlags & VBLANK_FLAG_NO_IRQ) ||
intelScreen->current_rotation != 0 || intelScreen->current_rotation != 0 ||
intelScreen->drmMinor < (intel_fb->pf_active ? 9 : 6)) intelScreen->drmMinor < (intel_fb->pf_active ? 9 : 6))
return GL_FALSE; return GL_FALSE;
swap.seqtype = DRM_VBLANK_ABSOLUTE; swap.seqtype = DRM_VBLANK_ABSOLUTE;
if (intel_fb->vblank_flags & VBLANK_FLAG_SYNC) { if (dPriv->vblFlags & VBLANK_FLAG_SYNC) {
swap.seqtype |= DRM_VBLANK_NEXTONMISS; swap.seqtype |= DRM_VBLANK_NEXTONMISS;
} else if (interval == 0) { } else if (interval == 0) {
return GL_FALSE; return GL_FALSE;
} }
swap.drawable = dPriv->hHWDrawable; swap.drawable = dPriv->hHWDrawable;
target = swap.sequence = intel_fb->vbl_seq + interval; target = swap.sequence = dPriv->vblSeq + interval;
if ( intel_fb->vblank_flags & VBLANK_FLAG_SECONDARY ) { if ( dPriv->vblFlags & VBLANK_FLAG_SECONDARY ) {
swap.seqtype |= DRM_VBLANK_SECONDARY; swap.seqtype |= DRM_VBLANK_SECONDARY;
} }
@ -866,14 +881,14 @@ intelScheduleSwap(const __DRIdrawablePrivate * dPriv, GLboolean *missed_target)
if (!drmCommandWriteRead(intel->driFd, DRM_I915_VBLANK_SWAP, &swap, if (!drmCommandWriteRead(intel->driFd, DRM_I915_VBLANK_SWAP, &swap,
sizeof(swap))) { sizeof(swap))) {
intel_fb->vbl_seq = swap.sequence; dPriv->vblSeq = swap.sequence;
swap.sequence -= target; swap.sequence -= target;
*missed_target = swap.sequence > 0 && swap.sequence <= (1 << 23); *missed_target = swap.sequence > 0 && swap.sequence <= (1 << 23);
intel_get_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT)->vbl_pending = intel_get_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT)->vbl_pending =
intel_get_renderbuffer(&intel_fb->Base, intel_get_renderbuffer(&intel_fb->Base,
BUFFER_FRONT_LEFT)->vbl_pending = BUFFER_FRONT_LEFT)->vbl_pending =
intel_fb->vbl_seq; dPriv->vblSeq;
if (swap.seqtype & DRM_VBLANK_FLIP) { if (swap.seqtype & DRM_VBLANK_FLIP) {
intel_flip_renderbuffers(intel_fb); intel_flip_renderbuffers(intel_fb);
@ -918,7 +933,7 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv)
if (screen->current_rotation != 0 || if (screen->current_rotation != 0 ||
!intelScheduleSwap(dPriv, &missed_target)) { !intelScheduleSwap(dPriv, &missed_target)) {
driWaitForVBlank(dPriv, &intel_fb->vbl_seq, intel_fb->vblank_flags, driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags,
&missed_target); &missed_target);
if (screen->current_rotation != 0 || !intelPageFlip(dPriv)) { if (screen->current_rotation != 0 || !intelPageFlip(dPriv)) {

View File

@ -616,18 +616,17 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
if (driDrawPriv->swap_interval == (unsigned)-1) { if (driDrawPriv->swap_interval == (unsigned)-1) {
int i; int i;
intel_fb->vblank_flags = (intel->intelScreen->irq_active != 0) driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0)
? driGetDefaultVBlankFlags(&intel->optionCache) ? driGetDefaultVBlankFlags(&intel->optionCache)
: VBLANK_FLAG_NO_IRQ; : VBLANK_FLAG_NO_IRQ;
(*dri_interface->getUST) (&intel_fb->swap_ust); (*dri_interface->getUST) (&intel_fb->swap_ust);
driDrawableInitVBlank(driDrawPriv, intel_fb->vblank_flags, driDrawableInitVBlank(driDrawPriv);
&intel_fb->vbl_seq); intel_fb->vbl_waited = driDrawPriv->vblSeq;
intel_fb->vbl_waited = intel_fb->vbl_seq;
for (i = 0; i < (intel->intelScreen->third.handle ? 3 : 2); i++) { for (i = 0; i < (intel->intelScreen->third.handle ? 3 : 2); i++) {
if (intel_fb->color_rb[i]) if (intel_fb->color_rb[i])
intel_fb->color_rb[i]->vbl_pending = intel_fb->vbl_seq; intel_fb->color_rb[i]->vbl_pending = driDrawPriv->vblSeq;
} }
} }
intel->driDrawable = driDrawPriv; intel->driDrawable = driDrawPriv;
@ -731,6 +730,7 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
*/ */
void LOCK_HARDWARE( struct intel_context *intel ) void LOCK_HARDWARE( struct intel_context *intel )
{ {
__DRIdrawablePrivate *dPriv = intel->driDrawable;
char __ret=0; char __ret=0;
struct intel_framebuffer *intel_fb = NULL; struct intel_framebuffer *intel_fb = NULL;
struct intel_renderbuffer *intel_rb = NULL; struct intel_renderbuffer *intel_rb = NULL;
@ -748,14 +748,14 @@ void LOCK_HARDWARE( struct intel_context *intel )
BUFFER_BACK_LEFT); BUFFER_BACK_LEFT);
} }
if (intel_rb && intel_fb->vblank_flags && if (intel_rb && dPriv->vblFlags &&
!(intel_fb->vblank_flags & VBLANK_FLAG_NO_IRQ) && !(dPriv->vblFlags & VBLANK_FLAG_NO_IRQ) &&
(intel_fb->vbl_waited - intel_rb->vbl_pending) > (1<<23)) { (intel_fb->vbl_waited - intel_rb->vbl_pending) > (1<<23)) {
drmVBlank vbl; drmVBlank vbl;
vbl.request.type = DRM_VBLANK_ABSOLUTE; vbl.request.type = DRM_VBLANK_ABSOLUTE;
if ( intel_fb->vblank_flags & VBLANK_FLAG_SECONDARY ) { if ( dPriv->vblFlags & VBLANK_FLAG_SECONDARY ) {
vbl.request.type |= DRM_VBLANK_SECONDARY; vbl.request.type |= DRM_VBLANK_SECONDARY;
} }

View File

@ -50,8 +50,6 @@ struct intel_framebuffer
/* VBI /* VBI
*/ */
GLuint vbl_seq;
GLuint vblank_flags;
GLuint vbl_waited; GLuint vbl_waited;
int64_t swap_ust; int64_t swap_ust;

View File

@ -790,6 +790,7 @@ static const struct __DriverAPIRec intelAPI = {
.UnbindContext = intelUnbindContext, .UnbindContext = intelUnbindContext,
.GetSwapInfo = intelGetSwapInfo, .GetSwapInfo = intelGetSwapInfo,
.GetMSC = driGetMSC32, .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32, .WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL, .WaitForSBC = NULL,
.SwapBuffersMSC = NULL, .SwapBuffersMSC = NULL,

View File

@ -76,7 +76,8 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv,
if (!rect) if (!rect)
{ {
UNLOCK_HARDWARE( intel ); UNLOCK_HARDWARE( intel );
driWaitForVBlank( dPriv, &intel->vbl_seq, intel->vblank_flags, & missed_target ); driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags,
&missed_target );
LOCK_HARDWARE( intel ); LOCK_HARDWARE( intel );
} }

View File

@ -33,6 +33,8 @@
#include "context.h" #include "context.h"
#include "framebuffer.h" #include "framebuffer.h"
#include "macros.h" #include "macros.h"
#include "utils.h"
#include "vblank.h"
#include "swrast/swrast.h" #include "swrast/swrast.h"
GLboolean intel_intersect_cliprects( drm_clip_rect_t *dst, GLboolean intel_intersect_cliprects( drm_clip_rect_t *dst,
@ -190,6 +192,50 @@ void intelWindowMoved( struct intel_context *intel )
} }
} }
/* Get updated plane info so we sync against the right vblank counter */
if (intel->intelScreen->driScrnPriv->ddx_version.minor >= 7) {
drmI830Sarea *sarea = intel->sarea;
drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w,
.y1 = dPriv->y, .y2 = dPriv->y + dPriv->h };
drm_clip_rect_t planeA_rect = { .x1 = sarea->planeA_x, .y1 = sarea->planeA_y,
.x2 = sarea->planeA_x + sarea->planeA_w,
.y2 = sarea->planeA_y + sarea->planeA_h };
drm_clip_rect_t planeB_rect = { .x1 = sarea->planeB_x, .y1 = sarea->planeB_y,
.x2 = sarea->planeB_x + sarea->planeB_w,
.y2 = sarea->planeB_y + sarea->planeB_h };
GLint areaA = driIntersectArea( drw_rect, planeA_rect );
GLint areaB = driIntersectArea( drw_rect, planeB_rect );
GLuint flags = dPriv->vblFlags;
/* Update vblank info
*/
if (areaB > areaA || (areaA == areaB && areaB > 0)) {
flags = dPriv->vblFlags | VBLANK_FLAG_SECONDARY;
} else {
flags = dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY;
}
/* Check to see if we changed pipes */
if (flags != dPriv->vblFlags && dPriv->vblFlags &&
!(dPriv->vblFlags & VBLANK_FLAG_NO_IRQ)) {
int64_t count;
/*
* Update msc_base from old pipe
*/
driDrawableGetMSC32(dPriv->driScreenPriv, dPriv, &count);
dPriv->msc_base = count;
/*
* Then get new vblank_base and vblSeq values
*/
dPriv->vblFlags = flags;
driGetCurrentVBlank(dPriv, dPriv->vblFlags, &dPriv->vblSeq);
dPriv->vblank_base = dPriv->vblSeq;
}
} else {
dPriv->vblFlags &= ~VBLANK_FLAG_SECONDARY;
}
_mesa_resize_framebuffer(&intel->ctx, _mesa_resize_framebuffer(&intel->ctx,
(GLframebuffer*)dPriv->driverPrivate, (GLframebuffer*)dPriv->driverPrivate,
dPriv->w, dPriv->h); dPriv->w, dPriv->h);

View File

@ -342,8 +342,8 @@ GLboolean intelInitContext( struct intel_context *intel,
GLcontext *shareCtx = (GLcontext *) sharedContextPrivate; GLcontext *shareCtx = (GLcontext *) sharedContextPrivate;
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private; intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private;
volatile drmI830Sarea *saPriv = (volatile drmI830Sarea *) volatile drmI830Sarea *saPriv = (drmI830Sarea *)
(((GLubyte *)sPriv->pSAREA)+intelScreen->sarea_priv_offset); (((GLubyte *)sPriv->pSAREA)+intelScreen->sarea_priv_offset);
if (!_mesa_initialize_context(&intel->ctx, if (!_mesa_initialize_context(&intel->ctx,
mesaVis, shareCtx, mesaVis, shareCtx,
@ -361,9 +361,6 @@ GLboolean intelInitContext( struct intel_context *intel,
driParseConfigFiles (&intel->optionCache, &intelScreen->optionCache, driParseConfigFiles (&intel->optionCache, &intelScreen->optionCache,
intel->driScreen->myNum, "i965"); intel->driScreen->myNum, "i965");
intel->vblank_flags = (intel->intelScreen->irq_active != 0)
? driGetDefaultVBlankFlags(&intel->optionCache) : VBLANK_FLAG_NO_IRQ;
ctx->Const.MaxTextureMaxAnisotropy = 2.0; ctx->Const.MaxTextureMaxAnisotropy = 2.0;
if (getenv("INTEL_STRICT_CONFORMANCE")) { if (getenv("INTEL_STRICT_CONFORMANCE")) {
@ -592,17 +589,19 @@ GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
if (driContextPriv) { if (driContextPriv) {
struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate; struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate;
driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0)
? driGetDefaultVBlankFlags(&intel->optionCache) : VBLANK_FLAG_NO_IRQ;
if (intel->driReadDrawable != driReadPriv) { if (intel->driReadDrawable != driReadPriv) {
intel->driReadDrawable = driReadPriv; intel->driReadDrawable = driReadPriv;
} }
if ( intel->driDrawable != driDrawPriv ) { if ( intel->driDrawable != driDrawPriv ) {
/* Shouldn't the readbuffer be stored also? */
driDrawableInitVBlank( driDrawPriv, intel->vblank_flags,
&intel->vbl_seq );
intel->driDrawable = driDrawPriv; intel->driDrawable = driDrawPriv;
intelWindowMoved( intel ); intelWindowMoved( intel );
/* Shouldn't the readbuffer be stored also? */
driDrawableInitVBlank( driDrawPriv );
} }
_mesa_make_current(&intel->ctx, _mesa_make_current(&intel->ctx,

View File

@ -231,11 +231,6 @@ struct intel_context
*/ */
driOptionCache optionCache; driOptionCache optionCache;
/* VBI
*/
GLuint vbl_seq;
GLuint vblank_flags;
int64_t swap_ust; int64_t swap_ust;
int64_t swap_missed_ust; int64_t swap_missed_ust;

View File

@ -549,6 +549,7 @@ static const struct __DriverAPIRec intelAPI = {
.UnbindContext = intelUnbindContext, .UnbindContext = intelUnbindContext,
.GetSwapInfo = intelGetSwapInfo, .GetSwapInfo = intelGetSwapInfo,
.GetMSC = driGetMSC32, .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32, .WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL, .WaitForSBC = NULL,
.SwapBuffersMSC = NULL, .SwapBuffersMSC = NULL,

View File

@ -100,6 +100,7 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
{ {
GLcontext *ctx, *shareCtx; GLcontext *ctx, *shareCtx;
__DRIscreenPrivate *driScreen = driContextPriv->driScreenPriv; __DRIscreenPrivate *driScreen = driContextPriv->driScreenPriv;
__DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv;
struct dd_function_table functions; struct dd_function_table functions;
mach64ContextPtr mmesa; mach64ContextPtr mmesa;
mach64ScreenPtr mach64Screen; mach64ScreenPtr mach64Screen;
@ -253,7 +254,7 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
mmesa->do_irqs = (mmesa->mach64Screen->irq && !getenv("MACH64_NO_IRQS")); mmesa->do_irqs = (mmesa->mach64Screen->irq && !getenv("MACH64_NO_IRQS"));
mmesa->vblank_flags = (mmesa->do_irqs) dPriv->vblFlags = (mmesa->do_irqs)
? driGetDefaultVBlankFlags(&mmesa->optionCache) : VBLANK_FLAG_NO_IRQ; ? driGetDefaultVBlankFlags(&mmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
driContextPriv->driverPrivate = (void *)mmesa; driContextPriv->driverPrivate = (void *)mmesa;
@ -330,8 +331,7 @@ mach64MakeCurrent( __DRIcontextPrivate *driContextPriv,
} }
driDrawableInitVBlank( driDrawPriv, newMach64Ctx->vblank_flags, driDrawableInitVBlank( driDrawPriv );
&newMach64Ctx->vbl_seq );
if ( newMach64Ctx->driDrawable != driDrawPriv ) { if ( newMach64Ctx->driDrawable != driDrawPriv ) {
newMach64Ctx->driDrawable = driDrawPriv; newMach64Ctx->driDrawable = driDrawPriv;

View File

@ -263,8 +263,6 @@ struct mach64_context {
/* VBI /* VBI
*/ */
GLuint vbl_seq;
GLuint vblank_flags;
GLuint do_irqs; GLuint do_irqs;
/* Configuration cache /* Configuration cache

View File

@ -279,7 +279,7 @@ static int mach64WaitForFrameCompletion( mach64ContextPtr mmesa )
/* Copy the back color buffer to the front color buffer. /* Copy the back color buffer to the front color buffer.
*/ */
void mach64CopyBuffer( const __DRIdrawablePrivate *dPriv ) void mach64CopyBuffer( __DRIdrawablePrivate *dPriv )
{ {
mach64ContextPtr mmesa; mach64ContextPtr mmesa;
GLint nbox, i, ret; GLint nbox, i, ret;
@ -320,7 +320,7 @@ void mach64CopyBuffer( const __DRIdrawablePrivate *dPriv )
#endif #endif
UNLOCK_HARDWARE( mmesa ); UNLOCK_HARDWARE( mmesa );
driWaitForVBlank( dPriv, &mmesa->vbl_seq, mmesa->vblank_flags, &missed_target ); driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target );
LOCK_HARDWARE( mmesa ); LOCK_HARDWARE( mmesa );
/* use front buffer cliprects */ /* use front buffer cliprects */

View File

@ -78,7 +78,7 @@ extern void mach64FireBlitLocked( mach64ContextPtr mmesa, void *buffer,
GLint offset, GLint pitch, GLint format, GLint offset, GLint pitch, GLint format,
GLint x, GLint y, GLint width, GLint height ); GLint x, GLint y, GLint width, GLint height );
extern void mach64CopyBuffer( const __DRIdrawablePrivate *dPriv ); extern void mach64CopyBuffer( __DRIdrawablePrivate *dPriv );
#if ENABLE_PERF_BOXES #if ENABLE_PERF_BOXES
extern void mach64PerformanceCounters( mach64ContextPtr mmesa ); extern void mach64PerformanceCounters( mach64ContextPtr mmesa );
extern void mach64PerformanceBoxesLocked( mach64ContextPtr mmesa ); extern void mach64PerformanceBoxesLocked( mach64ContextPtr mmesa );

View File

@ -484,6 +484,7 @@ static struct __DriverAPIRec mach64API = {
.UnbindContext = mach64UnbindContext, .UnbindContext = mach64UnbindContext,
.GetSwapInfo = NULL, .GetSwapInfo = NULL,
.GetMSC = driGetMSC32, .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32, .WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL, .WaitForSBC = NULL,
.SwapBuffersMSC = NULL .SwapBuffersMSC = NULL

View File

@ -452,6 +452,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
GLcontext *ctx, *shareCtx; GLcontext *ctx, *shareCtx;
mgaContextPtr mmesa; mgaContextPtr mmesa;
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
__DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv;
mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private; mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private;
drm_mga_sarea_t *saPriv = (drm_mga_sarea_t *)(((char*)sPriv->pSAREA)+ drm_mga_sarea_t *saPriv = (drm_mga_sarea_t *)(((char*)sPriv->pSAREA)+
mgaScreen->sarea_priv_offset); mgaScreen->sarea_priv_offset);
@ -650,7 +651,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
debug_control ); debug_control );
#endif #endif
mmesa->vblank_flags = (mmesa->mgaScreen->irq == 0) dPriv->vblFlags = (mmesa->mgaScreen->irq == 0)
? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags(&mmesa->optionCache); ? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags(&mmesa->optionCache);
(*dri_interface->getUST)( & mmesa->swap_ust ); (*dri_interface->getUST)( & mmesa->swap_ust );
@ -882,8 +883,8 @@ mgaMakeCurrent(__DRIcontextPrivate *driContextPriv,
mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate; mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;
if (mmesa->driDrawable != driDrawPriv) { if (mmesa->driDrawable != driDrawPriv) {
driDrawableInitVBlank( driDrawPriv, mmesa->vblank_flags, driDrawableInitVBlank( driDrawPriv );
&mmesa->vbl_seq );
mmesa->driDrawable = driDrawPriv; mmesa->driDrawable = driDrawPriv;
mmesa->dirty = ~0; mmesa->dirty = ~0;
mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK); mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK);
@ -948,6 +949,7 @@ static const struct __DriverAPIRec mgaAPI = {
.UnbindContext = mgaUnbindContext, .UnbindContext = mgaUnbindContext,
.GetSwapInfo = getSwapInfo, .GetSwapInfo = getSwapInfo,
.GetMSC = driGetMSC32, .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32, .WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL, .WaitForSBC = NULL,
.SwapBuffersMSC = NULL .SwapBuffersMSC = NULL

View File

@ -258,11 +258,6 @@ struct mga_context_t {
drmBufPtr vertex_dma_buffer; drmBufPtr vertex_dma_buffer;
drmBufPtr iload_buffer; drmBufPtr iload_buffer;
/* VBI
*/
GLuint vbl_seq;
GLuint vblank_flags;
int64_t swap_ust; int64_t swap_ust;
int64_t swap_missed_ust; int64_t swap_missed_ust;

View File

@ -428,8 +428,7 @@ void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv )
FLUSH_BATCH( mmesa ); FLUSH_BATCH( mmesa );
mgaWaitForFrameCompletion( mmesa ); mgaWaitForFrameCompletion( mmesa );
driWaitForVBlank( dPriv, & mmesa->vbl_seq, mmesa->vblank_flags, driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, & missed_target );
& missed_target );
if ( missed_target ) { if ( missed_target ) {
mmesa->swap_missed_count++; mmesa->swap_missed_count++;
(void) (*dri_interface->getUST)( & mmesa->swap_missed_ust ); (void) (*dri_interface->getUST)( & mmesa->swap_missed_ust );

View File

@ -283,7 +283,7 @@ GLboolean nouveauMakeCurrent( __DRIcontextPrivate *driContextPriv,
struct gl_framebuffer *read_fb = struct gl_framebuffer *read_fb =
(struct gl_framebuffer*)driReadPriv->driverPrivate; (struct gl_framebuffer*)driReadPriv->driverPrivate;
driDrawableInitVBlank(driDrawPriv, nmesa->vblank_flags, &nmesa->vblank_seq ); driDrawableInitVBlank(driDrawPriv);
nmesa->driDrawable = driDrawPriv; nmesa->driDrawable = driDrawPriv;
_mesa_resize_framebuffer(nmesa->glCtx, draw_fb, _mesa_resize_framebuffer(nmesa->glCtx, draw_fb,

View File

@ -182,10 +182,6 @@ typedef struct nouveau_context {
/* Configuration cache */ /* Configuration cache */
driOptionCache optionCache; driOptionCache optionCache;
/* vblank stuff */
uint32_t vblank_flags;
uint32_t vblank_seq;
GLuint new_state; GLuint new_state;
GLuint new_render_state; GLuint new_render_state;
GLuint render_index; GLuint render_index;

View File

@ -205,6 +205,7 @@ static const struct __DriverAPIRec nouveauAPI = {
.UnbindContext = nouveauUnbindContext, .UnbindContext = nouveauUnbindContext,
.GetSwapInfo = nouveauGetSwapInfo, .GetSwapInfo = nouveauGetSwapInfo,
.GetMSC = driGetMSC32, .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32, .WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL, .WaitForSBC = NULL,
.SwapBuffersMSC = NULL, .SwapBuffersMSC = NULL,

View File

@ -113,6 +113,7 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual,
{ {
GLcontext *ctx, *shareCtx; GLcontext *ctx, *shareCtx;
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
__DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv;
struct dd_function_table functions; struct dd_function_table functions;
r128ContextPtr rmesa; r128ContextPtr rmesa;
r128ScreenPtr r128scrn; r128ScreenPtr r128scrn;
@ -262,7 +263,7 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual,
r128DDInitSpanFuncs( ctx ); r128DDInitSpanFuncs( ctx );
r128DDInitState( rmesa ); r128DDInitState( rmesa );
rmesa->vblank_flags = (rmesa->r128Screen->irq != 0) dPriv->vblFlags = (rmesa->r128Screen->irq != 0)
? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
driContextPriv->driverPrivate = (void *)rmesa; driContextPriv->driverPrivate = (void *)rmesa;
@ -347,8 +348,7 @@ r128MakeCurrent( __DRIcontextPrivate *driContextPriv,
newR128Ctx->dirty = R128_UPLOAD_ALL; newR128Ctx->dirty = R128_UPLOAD_ALL;
} }
driDrawableInitVBlank( driDrawPriv, newR128Ctx->vblank_flags, driDrawableInitVBlank( driDrawPriv );
&newR128Ctx->vbl_seq );
newR128Ctx->driDrawable = driDrawPriv; newR128Ctx->driDrawable = driDrawPriv;
_mesa_make_current( newR128Ctx->glCtx, _mesa_make_current( newR128Ctx->glCtx,

View File

@ -210,11 +210,6 @@ struct r128_context {
GLuint c_textureBytes; GLuint c_textureBytes;
GLuint c_vertexBuffers; GLuint c_vertexBuffers;
/* VBI
*/
GLuint vbl_seq;
GLuint vblank_flags;
/* Configuration cache /* Configuration cache
*/ */
driOptionCache optionCache; driOptionCache optionCache;

View File

@ -249,7 +249,7 @@ static int r128WaitForFrameCompletion( r128ContextPtr rmesa )
/* Copy the back color buffer to the front color buffer. /* Copy the back color buffer to the front color buffer.
*/ */
void r128CopyBuffer( const __DRIdrawablePrivate *dPriv ) void r128CopyBuffer( __DRIdrawablePrivate *dPriv )
{ {
r128ContextPtr rmesa; r128ContextPtr rmesa;
GLint nbox, i, ret; GLint nbox, i, ret;
@ -282,7 +282,7 @@ void r128CopyBuffer( const __DRIdrawablePrivate *dPriv )
} }
UNLOCK_HARDWARE( rmesa ); UNLOCK_HARDWARE( rmesa );
driWaitForVBlank( dPriv, &rmesa->vbl_seq, rmesa->vblank_flags, &missed_target ); driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target );
LOCK_HARDWARE( rmesa ); LOCK_HARDWARE( rmesa );
nbox = dPriv->numClipRects; /* must be in locked region */ nbox = dPriv->numClipRects; /* must be in locked region */
@ -328,7 +328,7 @@ void r128CopyBuffer( const __DRIdrawablePrivate *dPriv )
#endif #endif
} }
void r128PageFlip( const __DRIdrawablePrivate *dPriv ) void r128PageFlip( __DRIdrawablePrivate *dPriv )
{ {
r128ContextPtr rmesa; r128ContextPtr rmesa;
GLint ret; GLint ret;
@ -359,7 +359,7 @@ void r128PageFlip( const __DRIdrawablePrivate *dPriv )
} }
UNLOCK_HARDWARE( rmesa ); UNLOCK_HARDWARE( rmesa );
driWaitForVBlank( dPriv, &rmesa->vbl_seq, rmesa->vblank_flags, &missed_target ); driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target );
LOCK_HARDWARE( rmesa ); LOCK_HARDWARE( rmesa );
/* The kernel will have been initialized to perform page flipping /* The kernel will have been initialized to perform page flipping

View File

@ -86,8 +86,8 @@ extern void r128ReadDepthSpanLocked( r128ContextPtr rmesa,
extern void r128ReadDepthPixelsLocked( r128ContextPtr rmesa, GLuint n, extern void r128ReadDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
const GLint x[], const GLint y[] ); const GLint x[], const GLint y[] );
extern void r128CopyBuffer( const __DRIdrawablePrivate *dPriv ); extern void r128CopyBuffer( __DRIdrawablePrivate *dPriv );
extern void r128PageFlip( const __DRIdrawablePrivate *dPriv ); extern void r128PageFlip( __DRIdrawablePrivate *dPriv );
void r128WaitForVBlank( r128ContextPtr rmesa ); void r128WaitForVBlank( r128ContextPtr rmesa );
extern void r128WaitForIdleLocked( r128ContextPtr rmesa ); extern void r128WaitForIdleLocked( r128ContextPtr rmesa );

View File

@ -411,6 +411,7 @@ static struct __DriverAPIRec r128API = {
.UnbindContext = r128UnbindContext, .UnbindContext = r128UnbindContext,
.GetSwapInfo = NULL, .GetSwapInfo = NULL,
.GetMSC = driGetMSC32, .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32, .WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL, .WaitForSBC = NULL,
.SwapBuffersMSC = NULL .SwapBuffersMSC = NULL

View File

@ -248,6 +248,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
void *sharedContextPrivate) void *sharedContextPrivate)
{ {
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
__DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv;
radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private); radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private);
struct dd_function_table functions; struct dd_function_table functions;
r200ContextPtr rmesa; r200ContextPtr rmesa;
@ -499,7 +500,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
fthrottle_mode, fthrottle_mode,
rmesa->r200Screen->irq); rmesa->r200Screen->irq);
rmesa->vblank_flags = (rmesa->r200Screen->irq != 0) dPriv->vblFlags = (rmesa->r200Screen->irq != 0)
? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
rmesa->prefer_gart_client_texturing = rmesa->prefer_gart_client_texturing =
@ -667,8 +668,7 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)newCtx->glCtx); fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)newCtx->glCtx);
if ( newCtx->dri.drawable != driDrawPriv ) { if ( newCtx->dri.drawable != driDrawPriv ) {
driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags, driDrawableInitVBlank( driDrawPriv );
&newCtx->vbl_seq );
} }
newCtx->dri.readable = driReadPriv; newCtx->dri.readable = driReadPriv;

View File

@ -893,11 +893,8 @@ struct r200_context {
GLuint TexGenCompSel; GLuint TexGenCompSel;
GLmatrix tmpmat; GLmatrix tmpmat;
/* VBI / buffer swap /* buffer swap
*/ */
GLuint vbl_seq;
GLuint vblank_flags;
int64_t swap_ust; int64_t swap_ust;
int64_t swap_missed_ust; int64_t swap_missed_ust;

View File

@ -419,7 +419,7 @@ static void r200WaitForFrameCompletion( r200ContextPtr rmesa )
/* Copy the back color buffer to the front color buffer. /* Copy the back color buffer to the front color buffer.
*/ */
void r200CopyBuffer( const __DRIdrawablePrivate *dPriv, void r200CopyBuffer( __DRIdrawablePrivate *dPriv,
const drm_clip_rect_t *rect) const drm_clip_rect_t *rect)
{ {
r200ContextPtr rmesa; r200ContextPtr rmesa;
@ -449,7 +449,7 @@ void r200CopyBuffer( const __DRIdrawablePrivate *dPriv,
if (!rect) if (!rect)
{ {
UNLOCK_HARDWARE( rmesa ); UNLOCK_HARDWARE( rmesa );
driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target ); driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, & missed_target );
LOCK_HARDWARE( rmesa ); LOCK_HARDWARE( rmesa );
} }
@ -513,7 +513,7 @@ void r200CopyBuffer( const __DRIdrawablePrivate *dPriv,
} }
} }
void r200PageFlip( const __DRIdrawablePrivate *dPriv ) void r200PageFlip( __DRIdrawablePrivate *dPriv )
{ {
r200ContextPtr rmesa; r200ContextPtr rmesa;
GLint ret; GLint ret;
@ -553,7 +553,7 @@ void r200PageFlip( const __DRIdrawablePrivate *dPriv )
*/ */
r200WaitForFrameCompletion( rmesa ); r200WaitForFrameCompletion( rmesa );
UNLOCK_HARDWARE( rmesa ); UNLOCK_HARDWARE( rmesa );
driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target ); driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, & missed_target );
if ( missed_target ) { if ( missed_target ) {
rmesa->swap_missed_count++; rmesa->swap_missed_count++;
(void) (*dri_interface->getUST)( & rmesa->swap_missed_ust ); (void) (*dri_interface->getUST)( & rmesa->swap_missed_ust );

View File

@ -89,9 +89,9 @@ extern void r200ReleaseDmaRegion( r200ContextPtr rmesa,
struct r200_dma_region *region, struct r200_dma_region *region,
const char *caller ); const char *caller );
extern void r200CopyBuffer( const __DRIdrawablePrivate *drawable, extern void r200CopyBuffer( __DRIdrawablePrivate *drawable,
const drm_clip_rect_t *rect); const drm_clip_rect_t *rect);
extern void r200PageFlip( const __DRIdrawablePrivate *drawable ); extern void r200PageFlip( __DRIdrawablePrivate *drawable );
extern void r200Flush( GLcontext *ctx ); extern void r200Flush( GLcontext *ctx );
extern void r200Finish( GLcontext *ctx ); extern void r200Finish( GLcontext *ctx );
extern void r200WaitForIdleLocked( r200ContextPtr rmesa ); extern void r200WaitForIdleLocked( r200ContextPtr rmesa );

View File

@ -127,6 +127,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
void *sharedContextPrivate) void *sharedContextPrivate)
{ {
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
__DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv;
radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private); radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
GLcontext* ctx; GLcontext* ctx;
GLcontext* shareCtx; GLcontext* shareCtx;
@ -177,7 +178,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
radeon->do_usleeps ? "usleeps" : "busy waits", radeon->do_usleeps ? "usleeps" : "busy waits",
fthrottle_mode, radeon->radeonScreen->irq); fthrottle_mode, radeon->radeonScreen->irq);
radeon->vblank_flags = (radeon->radeonScreen->irq != 0) dPriv->vblFlags = (radeon->radeonScreen->irq != 0)
? driGetDefaultVBlankFlags(&radeon->optionCache) : VBLANK_FLAG_NO_IRQ; ? driGetDefaultVBlankFlags(&radeon->optionCache) : VBLANK_FLAG_NO_IRQ;
(*dri_interface->getUST) (&radeon->swap_ust); (*dri_interface->getUST) (&radeon->swap_ust);
@ -277,9 +278,7 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
radeon->glCtx); radeon->glCtx);
if (radeon->dri.drawable != driDrawPriv) { if (radeon->dri.drawable != driDrawPriv) {
driDrawableInitVBlank(driDrawPriv, driDrawableInitVBlank(driDrawPriv);
radeon->vblank_flags,
&radeon->vbl_seq);
} }
radeon->dri.readable = driReadPriv; radeon->dri.readable = driReadPriv;

View File

@ -182,10 +182,7 @@ struct radeon_context {
GLuint irqsEmitted; GLuint irqsEmitted;
drm_radeon_irq_wait_t iw; drm_radeon_irq_wait_t iw;
/* VBI / buffer swap */ /* buffer swap */
GLuint vbl_seq;
GLuint vblank_flags;
int64_t swap_ust; int64_t swap_ust;
int64_t swap_missed_ust; int64_t swap_missed_ust;

View File

@ -157,7 +157,7 @@ static void radeonWaitForFrameCompletion(radeonContextPtr radeon)
/* Copy the back color buffer to the front color buffer. /* Copy the back color buffer to the front color buffer.
*/ */
void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv, void radeonCopyBuffer(__DRIdrawablePrivate * dPriv,
const drm_clip_rect_t * rect) const drm_clip_rect_t * rect)
{ {
radeonContextPtr radeon; radeonContextPtr radeon;
@ -187,7 +187,7 @@ void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv,
if (!rect) if (!rect)
{ {
UNLOCK_HARDWARE(radeon); UNLOCK_HARDWARE(radeon);
driWaitForVBlank(dPriv, &radeon->vbl_seq, radeon->vblank_flags, driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags,
&missed_target); &missed_target);
LOCK_HARDWARE(radeon); LOCK_HARDWARE(radeon);
} }
@ -253,7 +253,7 @@ void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv,
} }
} }
void radeonPageFlip(const __DRIdrawablePrivate * dPriv) void radeonPageFlip(__DRIdrawablePrivate * dPriv)
{ {
radeonContextPtr radeon; radeonContextPtr radeon;
GLint ret; GLint ret;
@ -293,7 +293,7 @@ void radeonPageFlip(const __DRIdrawablePrivate * dPriv)
*/ */
radeonWaitForFrameCompletion(radeon); radeonWaitForFrameCompletion(radeon);
UNLOCK_HARDWARE(radeon); UNLOCK_HARDWARE(radeon);
driWaitForVBlank(dPriv, &radeon->vbl_seq, radeon->vblank_flags, driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags,
&missed_target); &missed_target);
if (missed_target) { if (missed_target) {
radeon->swap_missed_count++; radeon->swap_missed_count++;

View File

@ -46,9 +46,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif #endif
#include "radeon_drm.h" #include "radeon_drm.h"
extern void radeonCopyBuffer(const __DRIdrawablePrivate * drawable, extern void radeonCopyBuffer(__DRIdrawablePrivate * drawable,
const drm_clip_rect_t * rect); const drm_clip_rect_t * rect);
extern void radeonPageFlip(const __DRIdrawablePrivate * drawable); extern void radeonPageFlip(__DRIdrawablePrivate * drawable);
extern void radeonFlush(GLcontext * ctx); extern void radeonFlush(GLcontext * ctx);
extern void radeonFinish(GLcontext * ctx); extern void radeonFinish(GLcontext * ctx);
extern void radeonWaitForIdleLocked(radeonContextPtr radeon); extern void radeonWaitForIdleLocked(radeonContextPtr radeon);

View File

@ -594,8 +594,7 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
if ( newCtx->dri.drawable != driDrawPriv ) { if ( newCtx->dri.drawable != driDrawPriv ) {
/* XXX we may need to validate the drawable here!!! */ /* XXX we may need to validate the drawable here!!! */
driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags, driDrawableInitVBlank( driDrawPriv );
&newCtx->vbl_seq );
} }
newCtx->dri.readable = driReadPriv; newCtx->dri.readable = driReadPriv;

View File

@ -961,6 +961,7 @@ static struct __DriverAPIRec radeonAPI = {
.UnbindContext = radeonUnbindContext, .UnbindContext = radeonUnbindContext,
.GetSwapInfo = getSwapInfo, .GetSwapInfo = getSwapInfo,
.GetMSC = driGetMSC32, .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32, .WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL, .WaitForSBC = NULL,
.SwapBuffersMSC = NULL, .SwapBuffersMSC = NULL,
@ -978,6 +979,7 @@ static const struct __DriverAPIRec r200API = {
.UnbindContext = r200UnbindContext, .UnbindContext = r200UnbindContext,
.GetSwapInfo = getSwapInfo, .GetSwapInfo = getSwapInfo,
.GetMSC = driGetMSC32, .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32, .WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL, .WaitForSBC = NULL,
.SwapBuffersMSC = NULL, .SwapBuffersMSC = NULL,

View File

@ -314,6 +314,7 @@ static struct __DriverAPIRec sisAPI = {
.UnbindContext = sisUnbindContext, .UnbindContext = sisUnbindContext,
.GetSwapInfo = NULL, .GetSwapInfo = NULL,
.GetMSC = NULL, .GetMSC = NULL,
.GetDrawableMSC = NULL,
.WaitForMSC = NULL, .WaitForMSC = NULL,
.WaitForSBC = NULL, .WaitForSBC = NULL,
.SwapBuffersMSC = NULL .SwapBuffersMSC = NULL

View File

@ -355,6 +355,7 @@ static const struct __DriverAPIRec tdfxAPI = {
.UnbindContext = tdfxUnbindContext, .UnbindContext = tdfxUnbindContext,
.GetSwapInfo = NULL, .GetSwapInfo = NULL,
.GetMSC = NULL, .GetMSC = NULL,
.GetDrawableMSC = NULL,
.WaitForMSC = NULL, .WaitForMSC = NULL,
.WaitForSBC = NULL, .WaitForSBC = NULL,
.SwapBuffersMSC = NULL .SwapBuffersMSC = NULL

View File

@ -465,6 +465,7 @@ viaCreateContext(const __GLcontextModes *visual,
GLcontext *ctx, *shareCtx; GLcontext *ctx, *shareCtx;
struct via_context *vmesa; struct via_context *vmesa;
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
__DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv;
viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private; viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private;
drm_via_sarea_t *saPriv = (drm_via_sarea_t *) drm_via_sarea_t *saPriv = (drm_via_sarea_t *)
(((GLubyte *)sPriv->pSAREA) + viaScreen->sareaPrivOffset); (((GLubyte *)sPriv->pSAREA) + viaScreen->sareaPrivOffset);
@ -658,7 +659,7 @@ viaCreateContext(const __GLcontextModes *visual,
driQueryOptionb(&vmesa->optionCache, "no_rast")) driQueryOptionb(&vmesa->optionCache, "no_rast"))
FALLBACK(vmesa, VIA_FALLBACK_USER_DISABLE, 1); FALLBACK(vmesa, VIA_FALLBACK_USER_DISABLE, 1);
vmesa->vblank_flags = dPriv->vblFlags =
vmesa->viaScreen->irqEnabled ? vmesa->viaScreen->irqEnabled ?
driGetDefaultVBlankFlags(&vmesa->optionCache) : VBLANK_FLAG_NO_IRQ; driGetDefaultVBlankFlags(&vmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
@ -838,8 +839,7 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
readBuffer = (GLframebuffer *)driReadPriv->driverPrivate; readBuffer = (GLframebuffer *)driReadPriv->driverPrivate;
if (vmesa->driDrawable != driDrawPriv) { if (vmesa->driDrawable != driDrawPriv) {
driDrawableInitVBlank(driDrawPriv, vmesa->vblank_flags, driDrawableInitVBlank(driDrawPriv);
&vmesa->vbl_seq);
} }
if ((vmesa->driDrawable != driDrawPriv) if ((vmesa->driDrawable != driDrawPriv)

View File

@ -321,9 +321,6 @@ struct via_context {
*/ */
driOptionCache optionCache; driOptionCache optionCache;
GLuint vblank_flags;
GLuint vbl_seq;
int64_t swap_ust; int64_t swap_ust;
int64_t swap_missed_ust; int64_t swap_missed_ust;

View File

@ -507,7 +507,7 @@ void viaWaitIdleLocked( struct via_context *vmesa, GLboolean light )
* except that WAIT_IDLE() will spin the CPU polling, while this is * except that WAIT_IDLE() will spin the CPU polling, while this is
* IRQ driven. * IRQ driven.
*/ */
static void viaWaitIdleVBlank( const __DRIdrawablePrivate *dPriv, static void viaWaitIdleVBlank( __DRIdrawablePrivate *dPriv,
struct via_context *vmesa, struct via_context *vmesa,
GLuint value ) GLuint value )
{ {
@ -523,8 +523,8 @@ static void viaWaitIdleVBlank( const __DRIdrawablePrivate *dPriv,
vmesa->thrashing) vmesa->thrashing)
viaSwapOutWork(vmesa); viaSwapOutWork(vmesa);
driWaitForVBlank( dPriv, & vmesa->vbl_seq, driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags,
vmesa->vblank_flags, & missed_target ); & missed_target );
if ( missed_target ) { if ( missed_target ) {
vmesa->swap_missed_count++; vmesa->swap_missed_count++;
(*dri_interface->getUST)( &vmesa->swap_missed_ust ); (*dri_interface->getUST)( &vmesa->swap_missed_ust );
@ -591,7 +591,7 @@ void viaResetPageFlippingLocked(struct via_context *vmesa)
/* /*
* Copy the back buffer to the front buffer. * Copy the back buffer to the front buffer.
*/ */
void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) void viaCopyBuffer(__DRIdrawablePrivate *dPriv)
{ {
struct via_context *vmesa = struct via_context *vmesa =
(struct via_context *)dPriv->driContextPriv->driverPrivate; (struct via_context *)dPriv->driContextPriv->driverPrivate;
@ -607,7 +607,7 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv)
VIA_FLUSH_DMA(vmesa); VIA_FLUSH_DMA(vmesa);
if (vmesa->vblank_flags == VBLANK_FLAG_SYNC && if (dPriv->vblFlags == VBLANK_FLAG_SYNC &&
vmesa->lastBreadcrumbWrite > 1) vmesa->lastBreadcrumbWrite > 1)
viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastBreadcrumbWrite-1); viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastBreadcrumbWrite-1);
else else
@ -634,14 +634,14 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv)
} }
void viaPageFlip(const __DRIdrawablePrivate *dPriv) void viaPageFlip(__DRIdrawablePrivate *dPriv)
{ {
struct via_context *vmesa = struct via_context *vmesa =
(struct via_context *)dPriv->driContextPriv->driverPrivate; (struct via_context *)dPriv->driContextPriv->driverPrivate;
struct via_renderbuffer buffer_tmp; struct via_renderbuffer buffer_tmp;
VIA_FLUSH_DMA(vmesa); VIA_FLUSH_DMA(vmesa);
if (vmesa->vblank_flags == VBLANK_FLAG_SYNC && if (dPriv->vblFlags == VBLANK_FLAG_SYNC &&
vmesa->lastBreadcrumbWrite > 1) vmesa->lastBreadcrumbWrite > 1)
viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastBreadcrumbWrite - 1); viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastBreadcrumbWrite - 1);
else else

View File

@ -33,8 +33,8 @@ void viaFlushDma(struct via_context *vmesa);
void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags); void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags);
void viaInitIoctlFuncs(GLcontext *ctx); void viaInitIoctlFuncs(GLcontext *ctx);
void viaCopyBuffer(const __DRIdrawablePrivate *dpriv); void viaCopyBuffer(__DRIdrawablePrivate *dpriv);
void viaPageFlip(const __DRIdrawablePrivate *dpriv); void viaPageFlip(__DRIdrawablePrivate *dpriv);
void viaCheckDma(struct via_context *vmesa, GLuint bytes); void viaCheckDma(struct via_context *vmesa, GLuint bytes);
void viaResetPageFlippingLocked(struct via_context *vmesa); void viaResetPageFlippingLocked(struct via_context *vmesa);
void viaWaitIdle(struct via_context *vmesa, GLboolean light); void viaWaitIdle(struct via_context *vmesa, GLboolean light);

View File

@ -334,6 +334,7 @@ static struct __DriverAPIRec viaAPI = {
.UnbindContext = viaUnbindContext, .UnbindContext = viaUnbindContext,
.GetSwapInfo = getSwapInfo, .GetSwapInfo = getSwapInfo,
.GetMSC = driGetMSC32, .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32, .WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL, .WaitForSBC = NULL,
.SwapBuffersMSC = NULL .SwapBuffersMSC = NULL