summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-config.c
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-02-04 12:02:23 +1100
committerSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-02-16 14:25:23 +1100
commit91143069d1a40cefd997522d85cb2d8adf1681f7 (patch)
treebda3d7e66f2c6c927309987d693585965d43bbde /ui/ncurses/nc-config.c
parent7b67c329067af30ffd2a1dd44cd938a7ee55af56 (diff)
downloadtalos-petitboot-91143069d1a40cefd997522d85cb2d8adf1681f7.tar.gz
talos-petitboot-91143069d1a40cefd997522d85cb2d8adf1681f7.zip
ui/ncurses: Reduce unnecessary calls to redrawwin
All current *_post() methods in ui/ncurses call redrawwin() and wrefresh() together. wrefresh() updates any lines on the screen that have been marked as changed or invalid. However redrawwin() marks the entire screen as invalid unconditionally. We can reduce the amount of data written to the screen by avoiding calls to redrawwin(). Screen transitions are the primary use case of redrawwin(), where the whole screen must be invalidated to avoid stale data remaining on screen. All other 'in-screen' updates such as changes to widgets or changing focus do not require a call to redrawwin(). The most noticeable performance improvement is in nc-menu, which makes an unnecssary call to redrawwin() after every addition to the boot option menu. eg. The number of bytes written to STDOUT in the main menu: # Boot options | Before | After -------------------------------- 8 | 5488 | 1149 133 | 422454 | 4652 Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Diffstat (limited to 'ui/ncurses/nc-config.c')
-rw-r--r--ui/ncurses/nc-config.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c
index 17cc380..c45df34 100644
--- a/ui/ncurses/nc-config.c
+++ b/ui/ncurses/nc-config.c
@@ -57,6 +57,7 @@ struct config_screen {
bool exit;
bool show_help;
+ bool need_redraw;
void (*on_exit)(struct cui *);
int scroll_y;
@@ -146,6 +147,7 @@ static void config_screen_process_key(struct nc_scr *scr, int key)
} else if (screen->show_help) {
screen->show_help = false;
+ screen->need_redraw = true;
cui_show_help(screen->cui, _("System Configuration"),
&config_help_text);
@@ -165,7 +167,10 @@ static int config_screen_post(struct nc_scr *scr)
struct config_screen *screen = config_screen_from_scr(scr);
widgetset_post(screen->widgetset);
nc_scr_frame_draw(scr);
- redrawwin(scr->main_ncw);
+ if (screen->need_redraw) {
+ redrawwin(scr->main_ncw);
+ screen->need_redraw = false;
+ }
wrefresh(screen->scr.main_ncw);
pad_refresh(screen);
return 0;
@@ -859,6 +864,7 @@ struct config_screen *config_screen_init(struct cui *cui,
screen->cui = cui;
screen->on_exit = on_exit;
+ screen->need_redraw = false;
screen->label_x = 2;
screen->field_x = 17;
OpenPOWER on IntegriCloud