aboutsummaryrefslogtreecommitdiff
path: root/console.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-02-24 12:43:45 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2012-02-24 13:36:05 -0600
commit45efb16124efef51de5157afc31984b5a47700f9 (patch)
tree3f391912a9c7d6172c3abf861bf2e56accdf8aae /console.c
parent167351020420c285b67cdf0603501b3d3b15e3f7 (diff)
optimize screendump for the common non-switch case
switch console only if needed, also pass down whenever the console was switched or not because a displaysurface redraw is only needed in case the console was switched. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'console.c')
-rw-r--r--console.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/console.c b/console.c
index df058b86e7..6a463f5918 100644
--- a/console.c
+++ b/console.c
@@ -176,19 +176,23 @@ void vga_hw_invalidate(void)
void vga_hw_screen_dump(const char *filename)
{
TextConsole *previous_active_console;
+ bool cswitch;
previous_active_console = active_console;
+ cswitch = previous_active_console && previous_active_console->index != 0;
/* There is currently no way of specifying which screen we want to dump,
so always dump the first one. */
- console_select(0);
+ if (cswitch) {
+ console_select(0);
+ }
if (consoles[0] && consoles[0]->hw_screen_dump) {
- consoles[0]->hw_screen_dump(consoles[0]->hw, filename);
+ consoles[0]->hw_screen_dump(consoles[0]->hw, filename, cswitch);
} else {
error_report("screen dump not implemented");
}
- if (previous_active_console) {
+ if (cswitch) {
console_select(previous_active_console->index);
}
}