if ( pMGADRIServer->agpTextures.map ) { drmUnmap( pMGADRIServer->agpTextures.map, pMGADRIServer->agpTextures.size ); pMGADRIServer->agpTextures.map = NULL; }
void MGADRICloseScreen( ScreenPtr pScreen ){   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];   MGAPtr pMga = MGAPTR(pScrn);   MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo;   if ( pMGADRIServer->drmBuffers ) {      drmUnmapBufs( pMGADRIServer->drmBuffers );      pMGADRIServer->drmBuffers = NULL;   }   drmMGACleanupDMA( pMga->drmFD );   if ( pMGADRIServer->status.map ) {      drmUnmap( pMGADRIServer->status.map, pMGADRIServer->status.size );      pMGADRIServer->status.map = NULL;   }   if ( pMGADRIServer->buffers.map ) {      drmUnmap( pMGADRIServer->buffers.map, pMGADRIServer->buffers.size );      pMGADRIServer->buffers.map = NULL;   }   if ( pMGADRIServer->primary.map ) {      drmUnmap( pMGADRIServer->primary.map, pMGADRIServer->primary.size );      pMGADRIServer->primary.map = NULL;   }   if ( pMGADRIServer->warp.map ) {      drmUnmap( pMGADRIServer->warp.map, pMGADRIServer->warp.size );      pMGADRIServer->warp.map = NULL;   }   if ( pMGADRIServer->agp.handle ) {      drmAgpUnbind( pMga->drmFD, pMGADRIServer->agp.handle );      drmAgpFree( pMga->drmFD, pMGADRIServer->agp.handle );      pMGADRIServer->agp.handle = 0;      drmAgpRelease( pMga->drmFD );   }   DRICloseScreen( pScreen );   if ( pMga->pDRIInfo ) {      if ( pMga->pDRIInfo->devPrivate ) {	 xfree( pMga->pDRIInfo->devPrivate );	 pMga->pDRIInfo->devPrivate = 0;      }      DRIDestroyInfoRec( pMga->pDRIInfo );      pMga->pDRIInfo = 0;   }   if ( pMga->DRIServerInfo ) {      xfree( pMga->DRIServerInfo );      pMga->DRIServerInfo = 0;   }   if ( pMga->pVisualConfigs ) {      xfree( pMga->pVisualConfigs );   }   if ( pMga->pVisualConfigsPriv ) {      xfree( pMga->pVisualConfigsPriv );   }}