diff mbox series

ui/console: fix default VC when there are no display

Message ID 20231108133719.113217-1-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show
Series ui/console: fix default VC when there are no display | expand

Commit Message

Marc-André Lureau Nov. 8, 2023, 1:37 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

When display is "none", we may still have remote displays (I think it
would be simpler if VNC/Spice were regular display btw). Return the
default VC then, and set them up to fix a regression when using remote
display and it used the TTY instead.

Fixes: commit 1bec1cc0d ("ui/console: allow to override the default VC")
Reported-by: German Maglione <gmaglione@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 system/vl.c  |  4 +++-
 ui/console.c | 14 ++++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)

Comments

Marc-André Lureau Nov. 10, 2023, 8:10 a.m. UTC | #1
Hi

On Wed, Nov 8, 2023 at 5:37 PM <marcandre.lureau@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> When display is "none", we may still have remote displays (I think it
> would be simpler if VNC/Spice were regular display btw). Return the
> default VC then, and set them up to fix a regression when using remote
> display and it used the TTY instead.
>
> Fixes: commit 1bec1cc0d ("ui/console: allow to override the default VC")
> Reported-by: German Maglione <gmaglione@redhat.com>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

German, did you file an issue on gitlab? Could you check/test this patch?

thanks

> ---
>  system/vl.c  |  4 +++-
>  ui/console.c | 14 ++++++++------
>  2 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/system/vl.c b/system/vl.c
> index bd7fad770b..8c522a07da 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -1359,6 +1359,7 @@ static void qemu_setup_display(void)
>              dpy.type = DISPLAY_TYPE_NONE;
>  #if defined(CONFIG_VNC)
>              vnc_parse("localhost:0,to=99,id=default");
> +            display_remote++;
>  #endif
>          }
>      }
> @@ -1391,7 +1392,8 @@ static void qemu_create_default_devices(void)
>          }
>      }
>
> -    if (nographic || (!vc && !is_daemonized() && isatty(STDOUT_FILENO))) {
> +    if (nographic ||
> +        ((!display_remote || !vc) && !is_daemonized() && isatty(STDOUT_FILENO))) {
>          if (default_parallel) {
>              add_device_config(DEV_PARALLEL, "null");
>          }
> diff --git a/ui/console.c b/ui/console.c
> index 8e688d3569..f08c8365b0 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -1679,19 +1679,21 @@ void qemu_display_init(DisplayState *ds, DisplayOptions *opts)
>
>  const char *qemu_display_get_vc(DisplayOptions *opts)
>  {
> +#ifdef CONFIG_PIXMAN
> +    const char *vc = "vc:80Cx24C";
> +#else
> +    const char *vc = NULL;
> +#endif
> +
>      assert(opts->type < DISPLAY_TYPE__MAX);
>      if (opts->type == DISPLAY_TYPE_NONE) {
> -        return NULL;
> +        return vc;
>      }
>      assert(dpys[opts->type] != NULL);
>      if (dpys[opts->type]->vc) {
>          return dpys[opts->type]->vc;
> -    } else {
> -#ifdef CONFIG_PIXMAN
> -        return "vc:80Cx24C";
> -#endif
>      }
> -    return NULL;
> +    return vc;
>  }
>
>  void qemu_display_help(void)
> --
> 2.41.0
>
diff mbox series

Patch

diff --git a/system/vl.c b/system/vl.c
index bd7fad770b..8c522a07da 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -1359,6 +1359,7 @@  static void qemu_setup_display(void)
             dpy.type = DISPLAY_TYPE_NONE;
 #if defined(CONFIG_VNC)
             vnc_parse("localhost:0,to=99,id=default");
+            display_remote++;
 #endif
         }
     }
@@ -1391,7 +1392,8 @@  static void qemu_create_default_devices(void)
         }
     }
 
-    if (nographic || (!vc && !is_daemonized() && isatty(STDOUT_FILENO))) {
+    if (nographic ||
+        ((!display_remote || !vc) && !is_daemonized() && isatty(STDOUT_FILENO))) {
         if (default_parallel) {
             add_device_config(DEV_PARALLEL, "null");
         }
diff --git a/ui/console.c b/ui/console.c
index 8e688d3569..f08c8365b0 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1679,19 +1679,21 @@  void qemu_display_init(DisplayState *ds, DisplayOptions *opts)
 
 const char *qemu_display_get_vc(DisplayOptions *opts)
 {
+#ifdef CONFIG_PIXMAN
+    const char *vc = "vc:80Cx24C";
+#else
+    const char *vc = NULL;
+#endif
+
     assert(opts->type < DISPLAY_TYPE__MAX);
     if (opts->type == DISPLAY_TYPE_NONE) {
-        return NULL;
+        return vc;
     }
     assert(dpys[opts->type] != NULL);
     if (dpys[opts->type]->vc) {
         return dpys[opts->type]->vc;
-    } else {
-#ifdef CONFIG_PIXMAN
-        return "vc:80Cx24C";
-#endif
     }
-    return NULL;
+    return vc;
 }
 
 void qemu_display_help(void)