diff mbox series

[for-8.2,3/3] ui/console: fix default VC when there are no display

Message ID 20231117143506.1521718-4-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show
Series UI: fix default VC regressions | expand

Commit Message

Marc-André Lureau Nov. 17, 2023, 2:35 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>
---
 ui/console.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

Comments

Thomas Huth Nov. 21, 2023, 9:27 a.m. UTC | #1
On 17/11/2023 15.35, 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>
> ---
>   ui/console.c | 18 ++++++++----------
>   1 file changed, 8 insertions(+), 10 deletions(-)

Acked-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/ui/console.c b/ui/console.c
index 8e688d3569..7db921e3b7 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1679,19 +1679,17 @@  void qemu_display_init(DisplayState *ds, DisplayOptions *opts)
 
 const char *qemu_display_get_vc(DisplayOptions *opts)
 {
-    assert(opts->type < DISPLAY_TYPE__MAX);
-    if (opts->type == DISPLAY_TYPE_NONE) {
-        return NULL;
-    }
-    assert(dpys[opts->type] != NULL);
-    if (dpys[opts->type]->vc) {
-        return dpys[opts->type]->vc;
-    } else {
 #ifdef CONFIG_PIXMAN
-        return "vc:80Cx24C";
+    const char *vc = "vc:80Cx24C";
+#else
+    const char *vc = NULL;
 #endif
+
+    assert(opts->type < DISPLAY_TYPE__MAX);
+    if (dpys[opts->type] && dpys[opts->type]->vc) {
+        vc = dpys[opts->type]->vc;
     }
-    return NULL;
+    return vc;
 }
 
 void qemu_display_help(void)