comparison src/video/dga/SDL_dgavideo.c @ 1786:473abd216edb

Fixed bug #106 Wait for any pending operations to complete before freeing a hardware surface.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 09 May 2006 06:44:47 +0000
parents dcec47a019e2
children cc6bea4bb90d
comparison
equal deleted inserted replaced
1785:dcec47a019e2 1786:473abd216edb
769 } 769 }
770 static void DGA_FreeHWSurface(_THIS, SDL_Surface *surface) 770 static void DGA_FreeHWSurface(_THIS, SDL_Surface *surface)
771 { 771 {
772 vidmem_bucket *bucket, *freeable; 772 vidmem_bucket *bucket, *freeable;
773 773
774 /* Wait for any pending operations involving this surface */
775 if ( DGA_IsSurfaceBusy(surface) ) {
776 LOCK_DISPLAY();
777 DGA_WaitBusySurfaces(this);
778 UNLOCK_DISPLAY();
779 }
780
774 /* Look for the bucket in the current list */ 781 /* Look for the bucket in the current list */
775 for ( bucket=&surfaces; bucket; bucket=bucket->next ) { 782 for ( bucket=&surfaces; bucket; bucket=bucket->next ) {
776 if ( bucket == (vidmem_bucket *)surface->hwdata ) { 783 if ( bucket == (vidmem_bucket *)surface->hwdata ) {
777 break; 784 break;
778 } 785 }
1052 1059
1053 /* Unmap memory and reset video mode */ 1060 /* Unmap memory and reset video mode */
1054 SDL_NAME(XDGACloseFramebuffer)(DGA_Display, DGA_Screen); 1061 SDL_NAME(XDGACloseFramebuffer)(DGA_Display, DGA_Screen);
1055 if ( this->screen ) { 1062 if ( this->screen ) {
1056 /* Tell SDL not to free the pixels */ 1063 /* Tell SDL not to free the pixels */
1057 this->screen->pixels = NULL; 1064 DGA_FreeHWSurface(this, this->screen);
1058 } 1065 }
1059 SDL_NAME(XDGASetMode)(DGA_Display, DGA_Screen, 0); 1066 SDL_NAME(XDGASetMode)(DGA_Display, DGA_Screen, 0);
1060 1067
1061 /* Clear the lock mutex */ 1068 /* Clear the lock mutex */
1062 if ( hw_lock != NULL ) { 1069 if ( hw_lock != NULL ) {