Пример #1
0
/* 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
sisGetLock( sisContextPtr smesa, GLuint flags )
{
   __DRIdrawablePrivate *dPriv = smesa->driDrawable;
   __DRIscreenPrivate *sPriv = smesa->driScreen;
   SISSAREAPrivPtr sarea = smesa->sarea;

   drmGetLock( smesa->driFd, smesa->hHWContext, 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 ( smesa->lastStamp != dPriv->lastStamp ) {
      sisUpdateBufferSize( smesa );
      sisUpdateClipping( smesa->glCtx );
      sisDDDrawBuffer( smesa->glCtx, smesa->glCtx->Color.DrawBuffer );
      smesa->lastStamp = dPriv->lastStamp;
   }

   if ( sarea->CtxOwner != smesa->hHWContext ) {
      sarea->CtxOwner = smesa->hHWContext;
      smesa->GlobalFlag = GFLAG_ALL;
   }
}
Пример #2
0
GLboolean
sisMakeCurrent( __DRIcontextPrivate *driContextPriv,
                __DRIdrawablePrivate *driDrawPriv,
                __DRIdrawablePrivate *driReadPriv )
{
   if ( driContextPriv ) {
      GET_CURRENT_CONTEXT(ctx);
      sisContextPtr oldSisCtx = ctx ? SIS_CONTEXT(ctx) : NULL;
      sisContextPtr newSisCtx = (sisContextPtr) driContextPriv->driverPrivate;

      if ( newSisCtx != oldSisCtx) {
         newSisCtx->GlobalFlag = GFLAG_ALL;
      }

      newSisCtx->driDrawable = driDrawPriv;

      _mesa_make_current2( newSisCtx->glCtx,
                         (GLframebuffer *) driDrawPriv->driverPrivate,
                         (GLframebuffer *) driReadPriv->driverPrivate );

      sisUpdateBufferSize( newSisCtx );
      sisUpdateClipping( newSisCtx->glCtx );
   } else {
      _mesa_make_current( 0, 0 );
   }

   return GL_TRUE;
}