[PATCH 18/60] ui/console-vc: make invalidate_xy() take vt100

Marc-André Lureau posted 60 patches 2 weeks, 6 days ago
Maintainers: "Marc-André Lureau" <marcandre.lureau@redhat.com>, John Snow <jsnow@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Mauro Carvalho Chehab <mchehab+huawei@kernel.org>, Pierrick Bouvier <pierrick.bouvier@linaro.org>, Jan Kiszka <jan.kiszka@web.de>, Phil Dennis-Jordan <phil@philjordan.eu>, Richard Henderson <richard.henderson@linaro.org>, Helge Deller <deller@gmx.de>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Gerd Hoffmann <kraxel@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Samuel Tardieu <sam@rfc1149.net>, Igor Mitsyanko <i.mitsyanko@gmail.com>, "Hervé Poussineau" <hpoussin@reactos.org>, Aleksandar Rikalo <arikalo@gmail.com>, Laurent Vivier <laurent@vivier.eu>, Thomas Huth <th.huth+qemu@posteo.eu>, BALATON Zoltan <balaton@eik.bme.hu>, "Michael S. Tsirkin" <mst@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>, Dmitry Osipenko <dmitry.osipenko@collabora.com>, Dmitry Fleytman <dmitry.fleytman@gmail.com>, Stefano Stabellini <sstabellini@kernel.org>, Anthony PERARD <anthony@xenproject.org>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Alistair Francis <alistair@alistair23.me>, Alex Williamson <alex@shazbot.org>, "Cédric Le Goater" <clg@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Fabiano Rosas <farosas@suse.de>
[PATCH 18/60] ui/console-vc: make invalidate_xy() take vt100
Posted by Marc-André Lureau 2 weeks, 6 days ago
This decouples glyph rendering from the console object, continuing the
QemuVT100 abstraction introduced in the previous commits.

Style fixes.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/console-vc.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/ui/console-vc.c b/ui/console-vc.c
index c730a8a52b8..4117429a508 100644
--- a/ui/console-vc.c
+++ b/ui/console-vc.c
@@ -179,19 +179,20 @@ static void vt100_putcharxy(QemuVT100 *vt, int x, int y, int ch,
                              &fgcol, &bgcol, x, y, FONT_WIDTH, FONT_HEIGHT);
 }
 
-static void invalidate_xy(QemuTextConsole *s, int x, int y)
+static void vt100_invalidate_xy(QemuVT100 *vt, int x, int y)
 {
-    if (!qemu_console_is_visible(QEMU_CONSOLE(s))) {
-        return;
+    if (vt->update_x0 > x * FONT_WIDTH) {
+        vt->update_x0 = x * FONT_WIDTH;
+    }
+    if (vt->update_y0 > y * FONT_HEIGHT) {
+        vt->update_y0 = y * FONT_HEIGHT;
+    }
+    if (vt->update_x1 < (x + 1) * FONT_WIDTH) {
+        vt->update_x1 = (x + 1) * FONT_WIDTH;
+    }
+    if (vt->update_y1 < (y + 1) * FONT_HEIGHT) {
+        vt->update_y1 = (y + 1) * FONT_HEIGHT;
     }
-    if (s->vt.update_x0 > x * FONT_WIDTH)
-        s->vt.update_x0 = x * FONT_WIDTH;
-    if (s->vt.update_y0 > y * FONT_HEIGHT)
-        s->vt.update_y0 = y * FONT_HEIGHT;
-    if (s->vt.update_x1 < (x + 1) * FONT_WIDTH)
-        s->vt.update_x1 = (x + 1) * FONT_WIDTH;
-    if (s->vt.update_y1 < (y + 1) * FONT_HEIGHT)
-        s->vt.update_y1 = (y + 1) * FONT_HEIGHT;
 }
 
 static void console_show_cursor(QemuTextConsole *s, int show)
@@ -219,7 +220,7 @@ static void console_show_cursor(QemuTextConsole *s, int show)
         } else {
             vt100_putcharxy(&s->vt, x, y, c->ch, &(c->t_attrib));
         }
-        invalidate_xy(s, x, y);
+        vt100_invalidate_xy(&s->vt, x, y);
     }
 }
 
@@ -585,7 +586,7 @@ static void vc_update_xy(VCChardev *vc, int x, int y)
         c = &s->vt.cells[y1 * s->vt.width + x];
         vt100_putcharxy(&s->vt, x, y2, c->ch,
                       &(c->t_attrib));
-        invalidate_xy(s, x, y2);
+        vt100_invalidate_xy(&s->vt, x, y2);
     }
 }
 

-- 
2.53.0


Re: [PATCH 18/60] ui/console-vc: make invalidate_xy() take vt100
Posted by Philippe Mathieu-Daudé 5 days, 15 hours ago
On 17/3/26 09:50, Marc-André Lureau wrote:
> This decouples glyph rendering from the console object, continuing the
> QemuVT100 abstraction introduced in the previous commits.
> 
> Style fixes.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   ui/console-vc.c | 27 ++++++++++++++-------------
>   1 file changed, 14 insertions(+), 13 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>