diff mbox

[11/14] pl110: move resize

Message ID 1409644827-26317-12-git-send-email-kraxel@redhat.com
State New
Headers show

Commit Message

Gerd Hoffmann Sept. 2, 2014, 8 a.m. UTC
Handle display resizes in the update callback.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/pl110.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
diff mbox

Patch

diff --git a/hw/display/pl110.c b/hw/display/pl110.c
index 78b146b..f788382 100644
--- a/hw/display/pl110.c
+++ b/hw/display/pl110.c
@@ -200,6 +200,13 @@  static void pl110_update_display(void *opaque)
         break;
     }
 
+    /* handle resize */
+    if (surface_width(surface) != s->cols ||
+        surface_height(surface) != s->rows) {
+        qemu_console_resize(s->con, s->cols, s->rows);
+        surface = qemu_console_surface(s->con);
+    }
+
     g_assert(surface_bits_per_pixel(surface) == 32);
     dest_width = 4 * s->cols;
     first = 0;
@@ -219,9 +226,6 @@  static void pl110_invalidate_display(void * opaque)
 {
     PL110State *s = (PL110State *)opaque;
     s->invalidate = 1;
-    if (pl110_enabled(s)) {
-        qemu_console_resize(s->con, s->cols, s->rows);
-    }
 }
 
 static void pl110_update_palette(PL110State *s, int n)
@@ -254,11 +258,6 @@  static void pl110_update_palette(PL110State *s, int n)
 
 static void pl110_resize(PL110State *s, int width, int height)
 {
-    if (width != s->cols || height != s->rows) {
-        if (pl110_enabled(s)) {
-            qemu_console_resize(s->con, width, height);
-        }
-    }
     s->cols = width;
     s->rows = height;
 }
@@ -373,9 +372,6 @@  static void pl110_write(void *opaque, hwaddr offset,
     control:
         s->cr = val;
         s->bpp = (val >> 1) & 7;
-        if (pl110_enabled(s)) {
-            qemu_console_resize(s->con, s->cols, s->rows);
-        }
         break;
     case 10: /* LCDICR */
         s->int_status &= ~val;