Mercurial > sdl-ios-xcode
diff src/video/fbcon/SDL_fbvideo.c @ 1780:7a36f01acf71
Fixed bug #49
Added support for non-blocking VT switching on the framebuffer console.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 08 May 2006 05:33:02 +0000 |
parents | 980d2a0dc2a3 |
children | 49b4b8413734 |
line wrap: on
line diff
--- a/src/video/fbcon/SDL_fbvideo.c Mon May 08 05:30:15 2006 +0000 +++ b/src/video/fbcon/SDL_fbvideo.c Mon May 08 05:33:02 2006 +0000 @@ -1238,26 +1238,10 @@ surface->hwdata = NULL; } -/* Routine to check to see if the frame buffer virtual terminal */ -/* is the current(active) one. If it is not, result will cause */ -/* Lock to fail. (would have waited forever, since the fbevent */ -/* keyboard handler maintains a lock when switched away from */ -/* current) */ -static __inline__ int FB_IsFrameBufferActive(_THIS) -{ - struct vt_stat vtstate; - if ( (ioctl(keyboard_fd, VT_GETSTATE, &vtstate) < 0) || - (current_vt != vtstate.v_active) ) { - return 0; - } - return 1; -} - - static int FB_LockHWSurface(_THIS, SDL_Surface *surface) { - if ( !FB_IsFrameBufferActive(this) ) { - return -1; /* fail locking. */ + if ( switched_away ) { + return -2; /* no hardware access */ } if ( surface == this->screen ) { SDL_mutexP(hw_lock); @@ -1293,6 +1277,10 @@ static int FB_FlipHWSurface(_THIS, SDL_Surface *surface) { + if ( switched_away ) { + return -2; /* no hardware access */ + } + /* Wait for vertical retrace and then flip display */ cache_vinfo.yoffset = flip_page*surface->h; if ( FB_IsSurfaceBusy(this->screen) ) { @@ -1333,6 +1321,10 @@ Uint32 *src, *srcPtr; Uint8 *dst, *dstPtr; + if ( switched_away ) { + return; /* no hardware access */ + } + screen = this->screen; FBPitch = screen->w >> 3; SRCPitch = screen->pitch >> 2;