[PATCH 42/67] ui/vc: move text console invalidate in helper

marcandre.lureau@redhat.com posted 67 patches 2 years, 5 months ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Dr. David Alan Gilbert" <dave@treblig.org>, Peter Maydell <peter.maydell@linaro.org>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Yoshinori Sato <ysato@users.sourceforge.jp>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Akihiko Odaki <akihiko.odaki@daynix.com>
[PATCH 42/67] ui/vc: move text console invalidate in helper
Posted by marcandre.lureau@redhat.com 2 years, 5 months ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

This will allow to split the VC code in a separate unit more easily.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/ui/console.h |  1 +
 ui/console.c         | 13 +++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 0f7f50deaf..91d8bbc9dc 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -521,6 +521,7 @@ void console_select(unsigned int index);
 void qemu_console_resize(QemuConsole *con, int width, int height);
 DisplaySurface *qemu_console_surface(QemuConsole *con);
 void coroutine_fn qemu_console_co_wait_update(QemuConsole *con);
+int qemu_invalidate_text_consoles(void);
 
 /* console-gl.c */
 #ifdef CONFIG_OPENGL
diff --git a/ui/console.c b/ui/console.c
index c0b60284b2..7be2d4eef3 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -2500,13 +2500,11 @@ static void vc_chr_set_echo(Chardev *chr, bool echo)
     drv->console->echo = echo;
 }
 
-static void text_console_update_cursor(void *opaque)
+int qemu_invalidate_text_consoles(void)
 {
     QemuConsole *s;
     int count = 0;
 
-    cursor_visible_phase = !cursor_visible_phase;
-
     QTAILQ_FOREACH(s, &consoles, next) {
         if (qemu_console_is_graphic(s) ||
             !qemu_console_is_visible(s)) {
@@ -2516,7 +2514,14 @@ static void text_console_update_cursor(void *opaque)
         graphic_hw_invalidate(s);
     }
 
-    if (count) {
+    return count;
+}
+
+static void text_console_update_cursor(void *opaque)
+{
+    cursor_visible_phase = !cursor_visible_phase;
+
+    if (qemu_invalidate_text_consoles()) {
         timer_mod(cursor_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME)
                   + CONSOLE_CURSOR_PERIOD / 2);
     }
-- 
2.41.0


Re: [PATCH 42/67] ui/vc: move text console invalidate in helper
Posted by Daniel P. Berrangé 2 years, 5 months ago
On Wed, Aug 30, 2023 at 01:38:16PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> This will allow to split the VC code in a separate unit more easily.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  include/ui/console.h |  1 +
>  ui/console.c         | 13 +++++++++----
>  2 files changed, 10 insertions(+), 4 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|