diff src/video/fbcon/SDL_fbmatrox.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_fbmatrox.c	Sat Jul 14 19:08:25 2001 +0000
+++ b/src/video/fbcon/SDL_fbmatrox.c	Sat Jul 14 19:10:06 2001 +0000
@@ -74,6 +74,11 @@
 	Uint32 ydstlen;
 	Uint32 fillop;
 
+	/* Don't blit to the display surface when switched away */
+	if ( dst == this->screen ) {
+		SDL_mutexP(hw_lock);
+	}
+
 	switch (dst->format->BytesPerPixel) {
 	    case 1:
 		color |= (color<<8);
@@ -108,13 +113,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 pitch, w, h;
 	int srcX, srcY;
 	int dstX, dstY;
@@ -128,8 +136,12 @@
 		return(src->map->sw_blit(src, srcrect, dst, dstrect));
 	}
 
+	/* Don't blit to the display surface when switched away */
+	if ( dst == this->screen ) {
+		SDL_mutexP(hw_lock);
+	}
+
 	/* Calculate source and destination base coordinates (in pixels) */
-	this = current_video;
 	w = dstrect->w;
 	h = dstrect->h;
 	FB_dst_to_xy(this, src, &srcX, &srcY);
@@ -201,6 +213,9 @@
 	FB_AddBusySurface(src);
 	FB_AddBusySurface(dst);
 
+	if ( dst == this->screen ) {
+		SDL_mutexV(hw_lock);
+	}
 	return(0);
 }