static void r200RegainedLock(r200ContextPtr r200) { __DRIdrawablePrivate *dPriv = r200->radeon.dri.drawable; int i; if (r200->radeon.lastStamp != dPriv->lastStamp) { radeonUpdatePageFlipping(&r200->radeon); R200_STATECHANGE(r200, ctx); r200->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = r200->radeon.state.color.drawOffset + r200->radeon.radeonScreen->fbLocation; r200->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = r200->radeon.state.color.drawPitch; if (r200->radeon.glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) radeonSetCliprects(&r200->radeon, GL_BACK_LEFT); else radeonSetCliprects(&r200->radeon, GL_FRONT_LEFT); r200UpdateViewportOffset(r200->radeon.glCtx); r200->radeon.lastStamp = dPriv->lastStamp; } for (i = 0; i < r200->nr_heaps; i++) { DRI_AGE_TEXTURES(r200->texture_heaps[i]); } }
/* Update the hardware state. This is called if another context has * grabbed the hardware lock, which includes the X server. This * function also updates the driver's window state after the X server * moves, resizes or restacks a window -- the change will be reflected * in the drawable position and clip rects. Since the X server grabs * the hardware lock when it changes the window state, this routine will * automatically be called after such a change. */ void r200GetLock( r200ContextPtr rmesa, GLuint flags ) { __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; __DRIscreenPrivate *sPriv = rmesa->dri.screen; drm_radeon_sarea_t *sarea = rmesa->sarea; int i; drmGetLock( rmesa->dri.fd, rmesa->dri.hwContext, flags ); /* The window might have moved, so we might need to get new clip * rects. * * NOTE: This releases and regrabs the hw lock to allow the X server * to respond to the DRI protocol request for new drawable info. * Since the hardware state depends on having the latest drawable * clip rects, all state checking must be done _after_ this call. */ DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv ); if ( rmesa->lastStamp != dPriv->lastStamp ) { r200UpdatePageFlipping( rmesa ); if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) r200SetCliprects( rmesa, GL_BACK_LEFT ); else r200SetCliprects( rmesa, GL_FRONT_LEFT ); r200UpdateViewportOffset( rmesa->glCtx ); rmesa->lastStamp = dPriv->lastStamp; } R200_STATECHANGE( rmesa, ctx ); if (rmesa->sarea->tiling_enabled) { rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE; } else rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] &= ~R200_COLOR_TILE_ENABLE; if ( sarea->ctx_owner != rmesa->dri.hwContext ) { sarea->ctx_owner = rmesa->dri.hwContext; } for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) { DRI_AGE_TEXTURES( rmesa->texture_heaps[ i ] ); } rmesa->lost_context = GL_TRUE; }
/* Force the context `c' to be the current context and associate with it * buffer `b'. */ GLboolean r200MakeCurrent( __DRIcontextPrivate *driContextPriv, __DRIdrawablePrivate *driDrawPriv, __DRIdrawablePrivate *driReadPriv ) { if ( driContextPriv ) { r200ContextPtr newCtx = (r200ContextPtr) driContextPriv->driverPrivate; if (R200_DEBUG & DEBUG_DRI) fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)newCtx->glCtx); if ( newCtx->dri.drawable != driDrawPriv ) { driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags, &newCtx->vbl_seq ); } newCtx->dri.readable = driReadPriv; if ( newCtx->dri.drawable != driDrawPriv || newCtx->lastStamp != driDrawPriv->lastStamp ) { newCtx->dri.drawable = driDrawPriv; r200SetCliprects(newCtx); r200UpdateViewportOffset( newCtx->glCtx ); } _mesa_make_current( newCtx->glCtx, (GLframebuffer *) driDrawPriv->driverPrivate, (GLframebuffer *) driReadPriv->driverPrivate ); _mesa_update_state( newCtx->glCtx ); r200ValidateState( newCtx->glCtx ); } else { if (R200_DEBUG & DEBUG_DRI) fprintf(stderr, "%s ctx is null\n", __FUNCTION__); _mesa_make_current( NULL, NULL, NULL ); } if (R200_DEBUG & DEBUG_DRI) fprintf(stderr, "End %s\n", __FUNCTION__); return GL_TRUE; }