diff src/video/fbcon/SDL_fb3dfx.c @ 109:5a9c36a45db1

Fixed switching away from the SDL at the framebuffer console
author Sam Lantinga <slouken@lokigames.com>
date Sat, 14 Jul 2001 19:10:06 +0000
parents 63ec24e0575f
children e8157fcb3114
line wrap: on
line diff
--- a/src/video/fbcon/SDL_fb3dfx.c	Sat Jul 14 19:08:25 2001 +0000
+++ b/src/video/fbcon/SDL_fb3dfx.c	Sat Jul 14 19:10:06 2001 +0000
@@ -61,6 +61,11 @@
 	Uint32 format;
 	int dstX, dstY;
 
+	/* Don't blit to the display surface when switched away */
+	if ( dst == this->screen ) {
+		SDL_mutexP(hw_lock);
+	}
+
 	/* Set the destination pixel format */
 	dst_base = (char *)((char *)dst->pixels - mapped_mem);
 	bpp = dst->format->BitsPerPixel;
@@ -81,13 +86,16 @@
 
 	FB_AddBusySurface(dst);
 
+	if ( dst == this->screen ) {
+		SDL_mutexV(hw_lock);
+	}
 	return(0);
 }
 
 static int HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect,
                        SDL_Surface *dst, SDL_Rect *dstrect)
 {
-	SDL_VideoDevice *this;
+	SDL_VideoDevice *this = current_video;
 	int bpp;
 	Uint32 src_format;
 	Uint32 dst_format;
@@ -98,8 +106,12 @@
 	Uint32 blitop;
 	Uint32 use_colorkey;
 
+	/* Don't blit to the display surface when switched away */
+	if ( dst == this->screen ) {
+		SDL_mutexP(hw_lock);
+	}
+
 	/* Set the source and destination pixel format */
-	this = current_video;
 	src_base = (char *)((char *)src->pixels - mapped_mem);
 	bpp = src->format->BitsPerPixel;
 	src_format = src->pitch | ((bpp+((bpp==8) ? 0 : 8)) << 13);
@@ -149,6 +161,9 @@
 	FB_AddBusySurface(src);
 	FB_AddBusySurface(dst);
 
+	if ( dst == this->screen ) {
+		SDL_mutexV(hw_lock);
+	}
 	return(0);
 }