From fcf143d2948cb3fde7f73d8fb65c8750e64df044 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 21 Aug 2011 09:26:56 -0400 Subject: [PATCH] Optionally don't clear the fbcon framebuffer on shutdown. The new behavior is triggered by setting the environment variable SDL_FBCON_DONT_CLEAR. This is useful in certain circumstances (specifically: a game launcher on an embedded device can leave a "now loading!" screen on the framebuffer while another process is starting up). Fixes Bugzilla #1251. Thanks to Paul Cercueil for the patch! --HG-- branch : SDL-1.2 --- src/video/fbcon/SDL_fbvideo.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/video/fbcon/SDL_fbvideo.c b/src/video/fbcon/SDL_fbvideo.c index 81a89daa4..ba7ec9402 100644 --- a/src/video/fbcon/SDL_fbvideo.c +++ b/src/video/fbcon/SDL_fbvideo.c @@ -1910,7 +1910,16 @@ static void FB_VideoQuit(_THIS) if ( this->screen ) { /* Clear screen and tell SDL not to free the pixels */ - if ( this->screen->pixels && FB_InGraphicsMode(this) ) { + + const char *dontClearPixels = SDL_getenv("SDL_FBCON_DONT_CLEAR"); + + /* If the framebuffer is not to be cleared, make sure that we won't + * display the previous frame when disabling double buffering. */ + if ( dontClearPixels && flip_page == 0 ) { + SDL_memcpy(flip_address[0], flip_address[1], this->screen->pitch * this->screen->h); + } + + if ( !dontClearPixels && this->screen->pixels && FB_InGraphicsMode(this) ) { #if defined(__powerpc__) || defined(__ia64__) /* SIGBUS when using SDL_memset() ?? */ Uint8 *rowp = (Uint8 *)this->screen->pixels; int left = this->screen->pitch*this->screen->h;