summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorSimon Rettberg2018-05-28 15:33:56 +0200
committerSimon Rettberg2018-05-28 15:45:25 +0200
commit85b64c16424ce690ba7f640c2f0bde6e70295112 (patch)
tree5043b7eede0364ff48be6859a1d31298e4e36bd6 /src/core
parent[icplus] Add driver for IC+ network card (diff)
downloadipxe-85b64c16424ce690ba7f640c2f0bde6e70295112.tar.gz
ipxe-85b64c16424ce690ba7f640c2f0bde6e70295112.tar.xz
ipxe-85b64c16424ce690ba7f640c2f0bde6e70295112.zip
[console] Add option to update margins and bg-image of vesa mode console
Adding --update to the console call will prevent the vesa mode from being initialized again. The existing mode will be reused. This makes it possible to quickly update the background image or console margins without ugly flickering.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/fbcon.c72
1 files changed, 41 insertions, 31 deletions
diff --git a/src/core/fbcon.c b/src/core/fbcon.c
index 44a56e105..f64bab7ce 100644
--- a/src/core/fbcon.c
+++ b/src/core/fbcon.c
@@ -520,6 +520,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 "
@@ -595,21 +598,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
@@ -664,27 +669,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 ) {