More vblank cleanups.
* Fix crash at context creation in most drivers supporting vblank. * Don't pass vblank sequence or flags to functions that get passed the drawable private already. * Attempt to initialize vblank related drawable private fields just once per drawable. May need more work in some drivers.
This commit is contained in:
parent
dc1264970e
commit
3177b4e2cf
|
@ -301,45 +301,13 @@ 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.
|
||||
* Returns the default swap interval of the given drawable.
|
||||
*/
|
||||
|
||||
void driDrawableInitVBlank( __DRIdrawablePrivate *priv )
|
||||
static unsigned
|
||||
driGetDefaultVBlankInterval( const __DRIdrawablePrivate *priv )
|
||||
{
|
||||
if ( priv->swap_interval == (unsigned)-1 ) {
|
||||
/* Get current vertical blank sequence */
|
||||
drmVBlank vbl;
|
||||
|
||||
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 =
|
||||
(priv->vblFlags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
* 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->swap_interval != (unsigned)-1 );
|
||||
|
||||
return priv->swap_interval;
|
||||
}
|
||||
else if ( (flags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) {
|
||||
if ( (priv->vblFlags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
|
@ -348,24 +316,68 @@ driGetVBlankInterval( const __DRIdrawablePrivate *priv, GLuint flags )
|
|||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
* Sets the default swap interval when the drawable is first bound to a
|
||||
* direct rendering context.
|
||||
*/
|
||||
|
||||
void driDrawableInitVBlank( __DRIdrawablePrivate *priv )
|
||||
{
|
||||
if ( priv->swap_interval == (unsigned)-1 &&
|
||||
!( priv->vblFlags & VBLANK_FLAG_NO_IRQ ) ) {
|
||||
/* Get current vertical blank sequence */
|
||||
drmVBlank vbl;
|
||||
|
||||
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 = driGetDefaultVBlankInterval( priv );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
* Returns the current swap interval of the given drawable.
|
||||
*/
|
||||
|
||||
unsigned
|
||||
driGetVBlankInterval( const __DRIdrawablePrivate *priv )
|
||||
{
|
||||
if ( (priv->vblFlags & VBLANK_FLAG_INTERVAL) != 0 ) {
|
||||
/* this must have been initialized when the drawable was first bound
|
||||
* to a direct rendering context. */
|
||||
assert ( priv->swap_interval != (unsigned)-1 );
|
||||
|
||||
return priv->swap_interval;
|
||||
}
|
||||
else
|
||||
return driGetDefaultVBlankInterval( priv );
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
* Returns the current vertical blank sequence number of the given drawable.
|
||||
*/
|
||||
|
||||
void
|
||||
driGetCurrentVBlank( const __DRIdrawablePrivate *priv, GLuint flags,
|
||||
GLuint *vbl_seq )
|
||||
driGetCurrentVBlank( __DRIdrawablePrivate *priv )
|
||||
{
|
||||
drmVBlank vbl;
|
||||
|
||||
vbl.request.type = DRM_VBLANK_RELATIVE;
|
||||
if ( flags & VBLANK_FLAG_SECONDARY ) {
|
||||
if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) {
|
||||
vbl.request.type |= DRM_VBLANK_SECONDARY;
|
||||
}
|
||||
vbl.request.sequence = 0;
|
||||
|
||||
(void) do_wait( &vbl, vbl_seq, priv->driScreenPriv->fd );
|
||||
(void) do_wait( &vbl, &priv->vblSeq, priv->driScreenPriv->fd );
|
||||
}
|
||||
|
||||
|
||||
|
@ -373,19 +385,15 @@ driGetCurrentVBlank( const __DRIdrawablePrivate *priv, GLuint flags,
|
|||
/**
|
||||
* Waits for the vertical blank for use with glXSwapBuffers.
|
||||
*
|
||||
* \param vbl_seq Vertical blank sequence number (MSC) after the last buffer
|
||||
* swap. Updated after this wait.
|
||||
* \param flags \c VBLANK_FLAG bits that control how long to wait.
|
||||
* \param missed_deadline Set to \c GL_TRUE if the MSC after waiting is later
|
||||
* than the "target" based on \c flags. The idea is that if
|
||||
* \c missed_deadline is set, then the application is not
|
||||
* achieving its desired framerate.
|
||||
* than the "target" based on \c priv->vblFlags. The idea is
|
||||
* that if \c missed_deadline is set, then the application is
|
||||
* not achieving its desired framerate.
|
||||
* \return Zero on success, -1 on error.
|
||||
*/
|
||||
|
||||
int
|
||||
driWaitForVBlank( const __DRIdrawablePrivate *priv, GLuint * vbl_seq,
|
||||
GLuint flags, GLboolean * missed_deadline )
|
||||
driWaitForVBlank( __DRIdrawablePrivate *priv, GLboolean * missed_deadline )
|
||||
{
|
||||
drmVBlank vbl;
|
||||
unsigned original_seq;
|
||||
|
@ -394,10 +402,10 @@ driWaitForVBlank( const __DRIdrawablePrivate *priv, GLuint * vbl_seq,
|
|||
unsigned diff;
|
||||
|
||||
*missed_deadline = GL_FALSE;
|
||||
if ( (flags & (VBLANK_FLAG_INTERVAL |
|
||||
VBLANK_FLAG_THROTTLE |
|
||||
VBLANK_FLAG_SYNC)) == 0 ||
|
||||
(flags & VBLANK_FLAG_NO_IRQ) != 0 ) {
|
||||
if ( (priv->vblFlags & (VBLANK_FLAG_INTERVAL |
|
||||
VBLANK_FLAG_THROTTLE |
|
||||
VBLANK_FLAG_SYNC)) == 0 ||
|
||||
(priv->vblFlags & VBLANK_FLAG_NO_IRQ) != 0 ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -408,44 +416,45 @@ driWaitForVBlank( const __DRIdrawablePrivate *priv, GLuint * vbl_seq,
|
|||
*
|
||||
* VBLANK_FLAG_INTERVAL and VBLANK_FLAG_THROTTLE mean to wait for at
|
||||
* least one vertical blank since the last wait. Since do_wait modifies
|
||||
* vbl_seq, we have to save the original value of vbl_seq for the
|
||||
* priv->vblSeq, we have to save the original value of priv->vblSeq for the
|
||||
* VBLANK_FLAG_INTERVAL / VBLANK_FLAG_THROTTLE calculation later.
|
||||
*/
|
||||
|
||||
original_seq = *vbl_seq;
|
||||
interval = driGetVBlankInterval(priv, flags);
|
||||
original_seq = priv->vblSeq;
|
||||
interval = driGetVBlankInterval(priv);
|
||||
deadline = original_seq + interval;
|
||||
|
||||
vbl.request.type = DRM_VBLANK_RELATIVE;
|
||||
if ( flags & VBLANK_FLAG_SECONDARY ) {
|
||||
if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) {
|
||||
vbl.request.type |= DRM_VBLANK_SECONDARY;
|
||||
}
|
||||
vbl.request.sequence = ((flags & VBLANK_FLAG_SYNC) != 0) ? 1 : 0;
|
||||
vbl.request.sequence = ((priv->vblFlags & VBLANK_FLAG_SYNC) != 0) ? 1 : 0;
|
||||
|
||||
if ( do_wait( & vbl, vbl_seq, priv->driScreenPriv->fd ) != 0 ) {
|
||||
if ( do_wait( & vbl, &priv->vblSeq, priv->driScreenPriv->fd ) != 0 ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
diff = *vbl_seq - deadline;
|
||||
diff = priv->vblSeq - deadline;
|
||||
|
||||
/* No need to wait again if we've already reached the target */
|
||||
if (diff <= (1 << 23)) {
|
||||
*missed_deadline = (flags & VBLANK_FLAG_SYNC) ? (diff > 0) : GL_TRUE;
|
||||
*missed_deadline = (priv->vblFlags & VBLANK_FLAG_SYNC) ? (diff > 0) :
|
||||
GL_TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Wait until the target vertical blank. */
|
||||
vbl.request.type = DRM_VBLANK_ABSOLUTE;
|
||||
if ( flags & VBLANK_FLAG_SECONDARY ) {
|
||||
if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) {
|
||||
vbl.request.type |= DRM_VBLANK_SECONDARY;
|
||||
}
|
||||
vbl.request.sequence = deadline;
|
||||
|
||||
if ( do_wait( & vbl, vbl_seq, priv->driScreenPriv->fd ) != 0 ) {
|
||||
if ( do_wait( & vbl, &priv->vblSeq, priv->driScreenPriv->fd ) != 0 ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
diff = *vbl_seq - deadline;
|
||||
diff = priv->vblSeq - deadline;
|
||||
*missed_deadline = diff > 0 && diff <= (1 << 23);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -53,12 +53,10 @@ 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 );
|
||||
extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv,
|
||||
GLuint flags );
|
||||
extern void driGetCurrentVBlank( const __DRIdrawablePrivate *priv,
|
||||
GLuint flags, GLuint *vbl_seq );
|
||||
extern int driWaitForVBlank( const __DRIdrawablePrivate *priv,
|
||||
GLuint * vbl_seq, GLuint flags, GLboolean * missed_deadline );
|
||||
extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv );
|
||||
extern void driGetCurrentVBlank( __DRIdrawablePrivate *priv );
|
||||
extern int driWaitForVBlank( __DRIdrawablePrivate *priv,
|
||||
GLboolean * missed_deadline );
|
||||
|
||||
#undef usleep
|
||||
#include <unistd.h> /* for usleep() */
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "intel_fbo.h"
|
||||
#include "intel_reg.h"
|
||||
#include "intel_regions.h"
|
||||
#include "vblank.h"
|
||||
|
||||
#define FILE_DEBUG_FLAG DEBUG_BLIT
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ intelWindowMoved(struct intel_context *intel)
|
|||
* Then get new vblank_base and vblSeq values
|
||||
*/
|
||||
dPriv->vblFlags = flags;
|
||||
driGetCurrentVBlank(dPriv, dPriv->vblFlags, &dPriv->vblSeq);
|
||||
driGetCurrentVBlank(dPriv);
|
||||
dPriv->vblank_base = dPriv->vblSeq;
|
||||
|
||||
intel_fb->vbl_waited = dPriv->vblSeq;
|
||||
|
@ -838,7 +838,7 @@ static GLboolean
|
|||
intelScheduleSwap(__DRIdrawablePrivate * dPriv, GLboolean *missed_target)
|
||||
{
|
||||
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
|
||||
unsigned int interval = driGetVBlankInterval(dPriv, dPriv->vblFlags);
|
||||
unsigned int interval;
|
||||
struct intel_context *intel =
|
||||
intelScreenContext(dPriv->driScreenPriv->private);
|
||||
const intelScreenPrivate *intelScreen = intel->intelScreen;
|
||||
|
@ -852,6 +852,8 @@ intelScheduleSwap(__DRIdrawablePrivate * dPriv, GLboolean *missed_target)
|
|||
intelScreen->drmMinor < (intel_fb->pf_active ? 9 : 6))
|
||||
return GL_FALSE;
|
||||
|
||||
interval = driGetVBlankInterval(dPriv);
|
||||
|
||||
swap.seqtype = DRM_VBLANK_ABSOLUTE;
|
||||
|
||||
if (dPriv->vblFlags & VBLANK_FLAG_SYNC) {
|
||||
|
@ -933,8 +935,7 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv)
|
|||
|
||||
if (screen->current_rotation != 0 ||
|
||||
!intelScheduleSwap(dPriv, &missed_target)) {
|
||||
driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags,
|
||||
&missed_target);
|
||||
driWaitForVBlank(dPriv, &missed_target);
|
||||
|
||||
if (screen->current_rotation != 0 || !intelPageFlip(dPriv)) {
|
||||
intelCopyBuffer(dPriv, NULL);
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
/*
|
||||
* Copy the back buffer to the front buffer.
|
||||
*/
|
||||
void intelCopyBuffer( const __DRIdrawablePrivate *dPriv,
|
||||
void intelCopyBuffer( __DRIdrawablePrivate *dPriv,
|
||||
const drm_clip_rect_t *rect )
|
||||
{
|
||||
struct intel_context *intel;
|
||||
|
@ -76,8 +76,7 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv,
|
|||
if (!rect)
|
||||
{
|
||||
UNLOCK_HARDWARE( intel );
|
||||
driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags,
|
||||
&missed_target );
|
||||
driWaitForVBlank( dPriv, &missed_target );
|
||||
LOCK_HARDWARE( intel );
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
struct buffer;
|
||||
|
||||
extern void intelCopyBuffer( const __DRIdrawablePrivate *dpriv,
|
||||
extern void intelCopyBuffer( __DRIdrawablePrivate *dpriv,
|
||||
const drm_clip_rect_t *rect );
|
||||
extern void intelClearWithBlit(GLcontext *ctx, GLbitfield mask);
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ void intelWindowMoved( struct intel_context *intel )
|
|||
* Then get new vblank_base and vblSeq values
|
||||
*/
|
||||
dPriv->vblFlags = flags;
|
||||
driGetCurrentVBlank(dPriv, dPriv->vblFlags, &dPriv->vblSeq);
|
||||
driGetCurrentVBlank(dPriv);
|
||||
dPriv->vblank_base = dPriv->vblSeq;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -589,19 +589,21 @@ GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
|
|||
if (driContextPriv) {
|
||||
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) {
|
||||
intel->driReadDrawable = driReadPriv;
|
||||
}
|
||||
|
||||
if ( intel->driDrawable != driDrawPriv ) {
|
||||
if (driDrawPriv->swap_interval == (unsigned)-1) {
|
||||
driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0)
|
||||
? driGetDefaultVBlankFlags(&intel->optionCache)
|
||||
: VBLANK_FLAG_NO_IRQ;
|
||||
driDrawableInitVBlank( driDrawPriv );
|
||||
}
|
||||
|
||||
intel->driDrawable = driDrawPriv;
|
||||
intelWindowMoved( intel );
|
||||
/* Shouldn't the readbuffer be stored also? */
|
||||
driDrawableInitVBlank( driDrawPriv );
|
||||
}
|
||||
|
||||
_mesa_make_current(&intel->ctx,
|
||||
|
|
|
@ -100,7 +100,6 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
|
|||
{
|
||||
GLcontext *ctx, *shareCtx;
|
||||
__DRIscreenPrivate *driScreen = driContextPriv->driScreenPriv;
|
||||
__DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv;
|
||||
struct dd_function_table functions;
|
||||
mach64ContextPtr mmesa;
|
||||
mach64ScreenPtr mach64Screen;
|
||||
|
@ -254,9 +253,6 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
|
|||
|
||||
mmesa->do_irqs = (mmesa->mach64Screen->irq && !getenv("MACH64_NO_IRQS"));
|
||||
|
||||
dPriv->vblFlags = (mmesa->do_irqs)
|
||||
? driGetDefaultVBlankFlags(&mmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
|
||||
|
||||
driContextPriv->driverPrivate = (void *)mmesa;
|
||||
|
||||
if (driQueryOptionb(&mmesa->optionCache, "no_rast")) {
|
||||
|
@ -331,9 +327,15 @@ mach64MakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
}
|
||||
|
||||
|
||||
driDrawableInitVBlank( driDrawPriv );
|
||||
|
||||
if ( newMach64Ctx->driDrawable != driDrawPriv ) {
|
||||
if (driDrawPriv->swap_interval == (unsigned)-1) {
|
||||
driDrawPriv->vblFlags = (newMach64Ctx->do_irqs)
|
||||
? driGetDefaultVBlankFlags(&newMach64Ctx->optionCache)
|
||||
: VBLANK_FLAG_NO_IRQ;
|
||||
|
||||
driDrawableInitVBlank( driDrawPriv );
|
||||
}
|
||||
|
||||
newMach64Ctx->driDrawable = driDrawPriv;
|
||||
mach64CalcViewport( newMach64Ctx->glCtx );
|
||||
}
|
||||
|
|
|
@ -320,7 +320,7 @@ void mach64CopyBuffer( __DRIdrawablePrivate *dPriv )
|
|||
#endif
|
||||
|
||||
UNLOCK_HARDWARE( mmesa );
|
||||
driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target );
|
||||
driWaitForVBlank( dPriv, &missed_target );
|
||||
LOCK_HARDWARE( mmesa );
|
||||
|
||||
/* use front buffer cliprects */
|
||||
|
|
|
@ -452,7 +452,6 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
|
|||
GLcontext *ctx, *shareCtx;
|
||||
mgaContextPtr mmesa;
|
||||
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
|
||||
__DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv;
|
||||
mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private;
|
||||
drm_mga_sarea_t *saPriv = (drm_mga_sarea_t *)(((char*)sPriv->pSAREA)+
|
||||
mgaScreen->sarea_priv_offset);
|
||||
|
@ -651,9 +650,6 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
|
|||
debug_control );
|
||||
#endif
|
||||
|
||||
dPriv->vblFlags = (mmesa->mgaScreen->irq == 0)
|
||||
? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags(&mmesa->optionCache);
|
||||
|
||||
(*dri_interface->getUST)( & mmesa->swap_ust );
|
||||
|
||||
if (driQueryOptionb(&mmesa->optionCache, "no_rast")) {
|
||||
|
@ -883,7 +879,13 @@ mgaMakeCurrent(__DRIcontextPrivate *driContextPriv,
|
|||
mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;
|
||||
|
||||
if (mmesa->driDrawable != driDrawPriv) {
|
||||
driDrawableInitVBlank( driDrawPriv );
|
||||
if (driDrawPriv->swap_interval == (unsigned)-1) {
|
||||
driDrawPriv->vblFlags = (mmesa->mgaScreen->irq == 0)
|
||||
? VBLANK_FLAG_NO_IRQ
|
||||
: driGetDefaultVBlankFlags(&mmesa->optionCache);
|
||||
|
||||
driDrawableInitVBlank( driDrawPriv );
|
||||
}
|
||||
|
||||
mmesa->driDrawable = driDrawPriv;
|
||||
mmesa->dirty = ~0;
|
||||
|
|
|
@ -409,7 +409,7 @@ static void mgaWaitForFrameCompletion( mgaContextPtr mmesa )
|
|||
/*
|
||||
* Copy the back buffer to the front buffer.
|
||||
*/
|
||||
void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv )
|
||||
void mgaCopyBuffer( __DRIdrawablePrivate *dPriv )
|
||||
{
|
||||
mgaContextPtr mmesa;
|
||||
drm_clip_rect_t *pbox;
|
||||
|
@ -428,7 +428,7 @@ void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv )
|
|||
FLUSH_BATCH( mmesa );
|
||||
|
||||
mgaWaitForFrameCompletion( mmesa );
|
||||
driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, & missed_target );
|
||||
driWaitForVBlank( dPriv, & missed_target );
|
||||
if ( missed_target ) {
|
||||
mmesa->swap_missed_count++;
|
||||
(void) (*dri_interface->getUST)( & mmesa->swap_missed_ust );
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "mgacontext.h"
|
||||
#include "mga_xmesa.h"
|
||||
|
||||
void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv );
|
||||
void mgaCopyBuffer( __DRIdrawablePrivate *dPriv );
|
||||
void mgaWaitForVBlank( mgaContextPtr mmesa );
|
||||
|
||||
void mgaGetILoadBufferLocked( mgaContextPtr mmesa );
|
||||
|
|
|
@ -283,7 +283,13 @@ GLboolean nouveauMakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
struct gl_framebuffer *read_fb =
|
||||
(struct gl_framebuffer*)driReadPriv->driverPrivate;
|
||||
|
||||
driDrawableInitVBlank(driDrawPriv);
|
||||
if (driDrawPriv->swap_interval == (unsigned)-1) {
|
||||
driDrawPriv->vblFlags =
|
||||
driGetDefaultVBlankFlags(&nmesa->optionCache);
|
||||
|
||||
driDrawableInitVBlank(driDrawPriv);
|
||||
}
|
||||
|
||||
nmesa->driDrawable = driDrawPriv;
|
||||
|
||||
_mesa_resize_framebuffer(nmesa->glCtx, draw_fb,
|
||||
|
|
|
@ -113,7 +113,6 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual,
|
|||
{
|
||||
GLcontext *ctx, *shareCtx;
|
||||
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
|
||||
__DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv;
|
||||
struct dd_function_table functions;
|
||||
r128ContextPtr rmesa;
|
||||
r128ScreenPtr r128scrn;
|
||||
|
@ -263,9 +262,6 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual,
|
|||
r128DDInitSpanFuncs( ctx );
|
||||
r128DDInitState( rmesa );
|
||||
|
||||
dPriv->vblFlags = (rmesa->r128Screen->irq != 0)
|
||||
? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
|
||||
|
||||
driContextPriv->driverPrivate = (void *)rmesa;
|
||||
|
||||
#if DO_DEBUG
|
||||
|
@ -348,7 +344,13 @@ r128MakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
newR128Ctx->dirty = R128_UPLOAD_ALL;
|
||||
}
|
||||
|
||||
driDrawableInitVBlank( driDrawPriv );
|
||||
if (driDrawPriv->swap_interval == (unsigned)-1) {
|
||||
driDrawPriv->vblFlags = (newR128Ctx->r128Screen->irq != 0)
|
||||
? driGetDefaultVBlankFlags(&newR128Ctx->optionCache)
|
||||
: VBLANK_FLAG_NO_IRQ;
|
||||
|
||||
driDrawableInitVBlank( driDrawPriv );
|
||||
}
|
||||
newR128Ctx->driDrawable = driDrawPriv;
|
||||
|
||||
_mesa_make_current( newR128Ctx->glCtx,
|
||||
|
|
|
@ -282,7 +282,7 @@ void r128CopyBuffer( __DRIdrawablePrivate *dPriv )
|
|||
}
|
||||
|
||||
UNLOCK_HARDWARE( rmesa );
|
||||
driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target );
|
||||
driWaitForVBlank( dPriv, &missed_target );
|
||||
LOCK_HARDWARE( rmesa );
|
||||
|
||||
nbox = dPriv->numClipRects; /* must be in locked region */
|
||||
|
@ -359,7 +359,7 @@ void r128PageFlip( __DRIdrawablePrivate *dPriv )
|
|||
}
|
||||
|
||||
UNLOCK_HARDWARE( rmesa );
|
||||
driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target );
|
||||
driWaitForVBlank( dPriv, &missed_target );
|
||||
LOCK_HARDWARE( rmesa );
|
||||
|
||||
/* The kernel will have been initialized to perform page flipping
|
||||
|
|
|
@ -248,7 +248,6 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
|
|||
void *sharedContextPrivate)
|
||||
{
|
||||
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
|
||||
__DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv;
|
||||
radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private);
|
||||
struct dd_function_table functions;
|
||||
r200ContextPtr rmesa;
|
||||
|
@ -500,9 +499,6 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
|
|||
fthrottle_mode,
|
||||
rmesa->r200Screen->irq);
|
||||
|
||||
dPriv->vblFlags = (rmesa->r200Screen->irq != 0)
|
||||
? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
|
||||
|
||||
rmesa->prefer_gart_client_texturing =
|
||||
(getenv("R200_GART_CLIENT_TEXTURES") != 0);
|
||||
|
||||
|
@ -667,14 +663,18 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
if (R200_DEBUG & DEBUG_DRI)
|
||||
fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)newCtx->glCtx);
|
||||
|
||||
if ( newCtx->dri.drawable != driDrawPriv ) {
|
||||
driDrawableInitVBlank( driDrawPriv );
|
||||
}
|
||||
|
||||
newCtx->dri.readable = driReadPriv;
|
||||
|
||||
if ( newCtx->dri.drawable != driDrawPriv ||
|
||||
newCtx->lastStamp != driDrawPriv->lastStamp ) {
|
||||
if (driDrawPriv->swap_interval == (unsigned)-1) {
|
||||
driDrawPriv->vblFlags = (newCtx->r200Screen->irq != 0)
|
||||
? driGetDefaultVBlankFlags(&newCtx->optionCache)
|
||||
: VBLANK_FLAG_NO_IRQ;
|
||||
|
||||
driDrawableInitVBlank( driDrawPriv );
|
||||
}
|
||||
|
||||
newCtx->dri.drawable = driDrawPriv;
|
||||
|
||||
r200SetCliprects(newCtx);
|
||||
|
|
|
@ -449,7 +449,7 @@ void r200CopyBuffer( __DRIdrawablePrivate *dPriv,
|
|||
if (!rect)
|
||||
{
|
||||
UNLOCK_HARDWARE( rmesa );
|
||||
driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, & missed_target );
|
||||
driWaitForVBlank( dPriv, & missed_target );
|
||||
LOCK_HARDWARE( rmesa );
|
||||
}
|
||||
|
||||
|
@ -553,7 +553,7 @@ void r200PageFlip( __DRIdrawablePrivate *dPriv )
|
|||
*/
|
||||
r200WaitForFrameCompletion( rmesa );
|
||||
UNLOCK_HARDWARE( rmesa );
|
||||
driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, & missed_target );
|
||||
driWaitForVBlank( dPriv, & missed_target );
|
||||
if ( missed_target ) {
|
||||
rmesa->swap_missed_count++;
|
||||
(void) (*dri_interface->getUST)( & rmesa->swap_missed_ust );
|
||||
|
|
|
@ -127,7 +127,6 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
|
|||
void *sharedContextPrivate)
|
||||
{
|
||||
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
|
||||
__DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv;
|
||||
radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
|
||||
GLcontext* ctx;
|
||||
GLcontext* shareCtx;
|
||||
|
@ -178,9 +177,6 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
|
|||
radeon->do_usleeps ? "usleeps" : "busy waits",
|
||||
fthrottle_mode, radeon->radeonScreen->irq);
|
||||
|
||||
dPriv->vblFlags = (radeon->radeonScreen->irq != 0)
|
||||
? driGetDefaultVBlankFlags(&radeon->optionCache) : VBLANK_FLAG_NO_IRQ;
|
||||
|
||||
(*dri_interface->getUST) (&radeon->swap_ust);
|
||||
|
||||
return GL_TRUE;
|
||||
|
@ -278,7 +274,15 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
|
|||
radeon->glCtx);
|
||||
|
||||
if (radeon->dri.drawable != driDrawPriv) {
|
||||
driDrawableInitVBlank(driDrawPriv);
|
||||
if (driDrawPriv->swap_interval == (unsigned)-1) {
|
||||
driDrawPriv->vblFlags =
|
||||
(radeon->radeonScreen->irq != 0)
|
||||
? driGetDefaultVBlankFlags(&radeon->
|
||||
optionCache)
|
||||
: VBLANK_FLAG_NO_IRQ;
|
||||
|
||||
driDrawableInitVBlank(driDrawPriv);
|
||||
}
|
||||
}
|
||||
|
||||
radeon->dri.readable = driReadPriv;
|
||||
|
|
|
@ -187,8 +187,7 @@ void radeonCopyBuffer(__DRIdrawablePrivate * dPriv,
|
|||
if (!rect)
|
||||
{
|
||||
UNLOCK_HARDWARE(radeon);
|
||||
driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags,
|
||||
&missed_target);
|
||||
driWaitForVBlank(dPriv, &missed_target);
|
||||
LOCK_HARDWARE(radeon);
|
||||
}
|
||||
|
||||
|
@ -293,8 +292,7 @@ void radeonPageFlip(__DRIdrawablePrivate * dPriv)
|
|||
*/
|
||||
radeonWaitForFrameCompletion(radeon);
|
||||
UNLOCK_HARDWARE(radeon);
|
||||
driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags,
|
||||
&missed_target);
|
||||
driWaitForVBlank(dPriv, &missed_target);
|
||||
if (missed_target) {
|
||||
radeon->swap_missed_count++;
|
||||
(void)(*dri_interface->getUST) (&radeon->swap_missed_ust);
|
||||
|
|
|
@ -424,9 +424,6 @@ radeonCreateContext( const __GLcontextModes *glVisual,
|
|||
|
||||
rmesa->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
|
||||
|
||||
rmesa->vblank_flags = (rmesa->radeonScreen->irq != 0)
|
||||
? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
|
||||
|
||||
(*dri_interface->getUST)( & rmesa->swap_ust );
|
||||
|
||||
|
||||
|
@ -592,15 +589,18 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
if (RADEON_DEBUG & DEBUG_DRI)
|
||||
fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *) newCtx->glCtx);
|
||||
|
||||
if ( newCtx->dri.drawable != driDrawPriv ) {
|
||||
/* XXX we may need to validate the drawable here!!! */
|
||||
driDrawableInitVBlank( driDrawPriv );
|
||||
}
|
||||
|
||||
newCtx->dri.readable = driReadPriv;
|
||||
|
||||
if ( (newCtx->dri.drawable != driDrawPriv) ||
|
||||
newCtx->lastStamp != driDrawPriv->lastStamp ) {
|
||||
if (driDrawPriv->swap_interval == (unsigned)-1) {
|
||||
driDrawPriv->vblFlags = (newCtx->radeonScreen->irq != 0)
|
||||
? driGetDefaultVBlankFlags(&newCtx->optionCache)
|
||||
: VBLANK_FLAG_NO_IRQ;
|
||||
|
||||
driDrawableInitVBlank( driDrawPriv );
|
||||
}
|
||||
|
||||
newCtx->dri.drawable = driDrawPriv;
|
||||
|
||||
radeonSetCliprects(newCtx);
|
||||
|
|
|
@ -667,9 +667,6 @@ struct radeon_context {
|
|||
|
||||
/* VBI
|
||||
*/
|
||||
GLuint vbl_seq;
|
||||
GLuint vblank_flags;
|
||||
|
||||
int64_t swap_ust;
|
||||
int64_t swap_missed_ust;
|
||||
|
||||
|
|
|
@ -863,7 +863,7 @@ static void radeonWaitForFrameCompletion( radeonContextPtr rmesa )
|
|||
|
||||
/* 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)
|
||||
{
|
||||
radeonContextPtr rmesa;
|
||||
|
@ -891,7 +891,7 @@ void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv,
|
|||
if (!rect)
|
||||
{
|
||||
UNLOCK_HARDWARE( rmesa );
|
||||
driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
|
||||
driWaitForVBlank( dPriv, & missed_target );
|
||||
LOCK_HARDWARE( rmesa );
|
||||
}
|
||||
|
||||
|
@ -952,7 +952,7 @@ void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv,
|
|||
}
|
||||
}
|
||||
|
||||
void radeonPageFlip( const __DRIdrawablePrivate *dPriv )
|
||||
void radeonPageFlip( __DRIdrawablePrivate *dPriv )
|
||||
{
|
||||
radeonContextPtr rmesa;
|
||||
GLint ret;
|
||||
|
@ -987,7 +987,7 @@ void radeonPageFlip( const __DRIdrawablePrivate *dPriv )
|
|||
*/
|
||||
radeonWaitForFrameCompletion( rmesa );
|
||||
UNLOCK_HARDWARE( rmesa );
|
||||
driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
|
||||
driWaitForVBlank( dPriv, & missed_target );
|
||||
if ( missed_target ) {
|
||||
rmesa->swap_missed_count++;
|
||||
(void) (*dri_interface->getUST)( & rmesa->swap_missed_ust );
|
||||
|
|
|
@ -87,9 +87,9 @@ extern void radeonReleaseDmaRegion( radeonContextPtr rmesa,
|
|||
struct radeon_dma_region *region,
|
||||
const char *caller );
|
||||
|
||||
extern void radeonCopyBuffer( const __DRIdrawablePrivate *drawable,
|
||||
extern void radeonCopyBuffer( __DRIdrawablePrivate *drawable,
|
||||
const drm_clip_rect_t *rect);
|
||||
extern void radeonPageFlip( const __DRIdrawablePrivate *drawable );
|
||||
extern void radeonPageFlip( __DRIdrawablePrivate *drawable );
|
||||
extern void radeonFlush( GLcontext *ctx );
|
||||
extern void radeonFinish( GLcontext *ctx );
|
||||
extern void radeonWaitForIdleLocked( radeonContextPtr rmesa );
|
||||
|
|
|
@ -465,7 +465,6 @@ viaCreateContext(const __GLcontextModes *visual,
|
|||
GLcontext *ctx, *shareCtx;
|
||||
struct via_context *vmesa;
|
||||
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
|
||||
__DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv;
|
||||
viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private;
|
||||
drm_via_sarea_t *saPriv = (drm_via_sarea_t *)
|
||||
(((GLubyte *)sPriv->pSAREA) + viaScreen->sareaPrivOffset);
|
||||
|
@ -659,10 +658,6 @@ viaCreateContext(const __GLcontextModes *visual,
|
|||
driQueryOptionb(&vmesa->optionCache, "no_rast"))
|
||||
FALLBACK(vmesa, VIA_FALLBACK_USER_DISABLE, 1);
|
||||
|
||||
dPriv->vblFlags =
|
||||
vmesa->viaScreen->irqEnabled ?
|
||||
driGetDefaultVBlankFlags(&vmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
|
||||
|
||||
if (getenv("VIA_PAGEFLIP"))
|
||||
vmesa->allowPageFlip = 1;
|
||||
|
||||
|
@ -838,12 +833,17 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
|
|||
drawBuffer = (GLframebuffer *)driDrawPriv->driverPrivate;
|
||||
readBuffer = (GLframebuffer *)driReadPriv->driverPrivate;
|
||||
|
||||
if (vmesa->driDrawable != driDrawPriv) {
|
||||
driDrawableInitVBlank(driDrawPriv);
|
||||
}
|
||||
|
||||
if ((vmesa->driDrawable != driDrawPriv)
|
||||
|| (vmesa->driReadable != driReadPriv)) {
|
||||
if (driDrawPriv->swap_interval == (unsigned)-1) {
|
||||
driDrawPriv->vblFlags =
|
||||
vmesa->viaScreen->irqEnabled ?
|
||||
driGetDefaultVBlankFlags(&vmesa->optionCache) :
|
||||
VBLANK_FLAG_NO_IRQ;
|
||||
|
||||
driDrawableInitVBlank(driDrawPriv);
|
||||
}
|
||||
|
||||
vmesa->driDrawable = driDrawPriv;
|
||||
vmesa->driReadable = driReadPriv;
|
||||
|
||||
|
|
|
@ -523,8 +523,7 @@ static void viaWaitIdleVBlank( __DRIdrawablePrivate *dPriv,
|
|||
vmesa->thrashing)
|
||||
viaSwapOutWork(vmesa);
|
||||
|
||||
driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags,
|
||||
& missed_target );
|
||||
driWaitForVBlank( dPriv, & missed_target );
|
||||
if ( missed_target ) {
|
||||
vmesa->swap_missed_count++;
|
||||
(*dri_interface->getUST)( &vmesa->swap_missed_ust );
|
||||
|
|
Loading…
Reference in New Issue