diff options
Diffstat (limited to 'src/core/fbcon.c')
-rw-r--r-- | src/core/fbcon.c | 72 |
1 files changed, 41 insertions, 31 deletions
diff --git a/src/core/fbcon.c b/src/core/fbcon.c index ff3132ac..056b164c 100644 --- a/src/core/fbcon.c +++ b/src/core/fbcon.c @@ -525,6 +525,9 @@ static int fbcon_picture_init ( struct fbcon *fbcon, /* Allocate buffer */ len = ( pixel->height * pixel->stride ); + if ( picture->start ) { + ufree( picture->start ); + } picture->start = umalloc ( len ); if ( ! picture->start ) { DBGC ( fbcon, "FBCON %p could not allocate %zd bytes for " @@ -600,21 +603,23 @@ int fbcon_init ( struct fbcon *fbcon, userptr_t start, unsigned int bottom; int rc; - /* Initialise data structure */ - memset ( fbcon, 0, sizeof ( *fbcon ) ); - fbcon->start = start; - fbcon->pixel = pixel; - assert ( pixel->len <= sizeof ( uint32_t ) ); - fbcon->map = map; - fbcon->font = font; - fbcon->ctx.handlers = fbcon_ansiesc_handlers; - fbcon->show_cursor = 1; - - /* Derive overall length */ - fbcon->len = ( pixel->height * pixel->stride ); - DBGC ( fbcon, "FBCON %p at [%08lx,%08lx)\n", fbcon, - user_to_phys ( fbcon->start, 0 ), - user_to_phys ( fbcon->start, fbcon->len ) ); + if ( ! config->lazy_update ) { + /* Initialise data structure */ + memset ( fbcon, 0, sizeof ( *fbcon ) ); + fbcon->start = start; + fbcon->pixel = pixel; + assert ( pixel->len <= sizeof ( uint32_t ) ); + fbcon->map = map; + fbcon->font = font; + fbcon->ctx.handlers = fbcon_ansiesc_handlers; + fbcon->show_cursor = 1; + + /* Derive overall length */ + fbcon->len = ( pixel->height * pixel->stride ); + DBGC ( fbcon, "FBCON %p at [%08lx,%08lx)\n", fbcon, + user_to_phys ( fbcon->start, 0 ), + user_to_phys ( fbcon->start, fbcon->len ) ); + } /* Calculate margin. If the actual screen size is larger than * the requested screen size, then update the margins so that @@ -669,27 +674,32 @@ int fbcon_init ( struct fbcon *fbcon, userptr_t start, fbcon->margin.top, ( fbcon->pixel->height - fbcon->margin.bottom ) ); - /* Set default colours */ - fbcon_set_default_foreground ( fbcon ); - fbcon_set_default_background ( fbcon ); + if ( ! config->lazy_update ) { + /* Set default colours */ + fbcon_set_default_foreground ( fbcon ); + fbcon_set_default_background ( fbcon ); + + /* Allocate and initialise stored character array */ + fbcon->text.start = umalloc ( fbcon->character.width * + fbcon->character.height * + sizeof ( struct fbcon_text_cell ) ); + if ( ! fbcon->text.start ) { + rc = -ENOMEM; + goto err_text; + } + fbcon_clear ( fbcon, 0 ); - /* Allocate and initialise stored character array */ - fbcon->text.start = umalloc ( fbcon->character.width * - fbcon->character.height * - sizeof ( struct fbcon_text_cell ) ); - if ( ! fbcon->text.start ) { - rc = -ENOMEM; - goto err_text; + /* Set framebuffer to all black (including margins) */ + memset_user ( fbcon->start, 0, 0, fbcon->len ); + } else { + fbcon_clear ( fbcon, 0 ); } - fbcon_clear ( fbcon, 0 ); - - /* Set framebuffer to all black (including margins) */ - memset_user ( fbcon->start, 0, 0, fbcon->len ); /* Generate pixel buffer from background image, if applicable */ if ( config->pixbuf && - ( ( rc = fbcon_picture_init ( fbcon, config->pixbuf ) ) != 0 ) ) - goto err_picture; + ( ( rc = fbcon_picture_init ( fbcon, config->pixbuf ) ) != 0 ) && + ( ! config->lazy_update ) ) + goto err_picture; /* Keep going w/o background in lazy_update mode */ /* Draw background picture (including margins), if applicable */ if ( fbcon->picture.start ) { |