Re: [PATCH] ui/console: fix default VC when there are no display

2023-11-10 Thread Marc-André Lureau
Hi

On Wed, Nov 8, 2023 at 5:37 PM  wrote:
>
> From: Marc-André Lureau 
>
> 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 
> Signed-off-by: Marc-André Lureau 

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
>




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

2023-11-08 Thread marcandre . lureau
From: Marc-André Lureau 

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 
Signed-off-by: Marc-André Lureau 
---
 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