On Wed, Aug 30, 2023 at 01:38:04PM +0400, marcandre.lur...@redhat.com wrote: > From: Marc-André Lureau <marcandre.lur...@redhat.com> > > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> > --- > ui/console.c | 80 ++++++++++++++++++++-------------------------------- > 1 file changed, 31 insertions(+), 49 deletions(-)
> @@ -2612,12 +2570,36 @@ static void vc_chr_open(Chardev *chr, > s->chr = chr; > drv->console = s; > > - text_console_do_init(chr); > + fifo8_create(&s->out_fifo, 16); > > - /* console/chardev init sometimes completes elsewhere in a 2nd > - * stage, so defer OPENED events until they are fully initialized > - */ > - *be_opened = false; > + s->total_height = DEFAULT_BACKSCROLL; > + if (QEMU_CONSOLE(s)->scanout.kind != SCANOUT_SURFACE) { > + if (active_console && active_console->scanout.kind == > SCANOUT_SURFACE) { > + g_width = qemu_console_get_width(active_console, g_width); > + g_height = qemu_console_get_height(active_console, g_height); > + } > + QEMU_CONSOLE(s)->surface = qemu_create_displaysurface(g_width, > g_height); > + QEMU_CONSOLE(s)->scanout.kind = SCANOUT_SURFACE; > + } > + > + QEMU_CONSOLE(s)->hw_ops = &text_console_ops; > + QEMU_CONSOLE(s)->hw = s; It feels like it would be worth having a local variable "QemuConsole *c = QEMU_CONSOLE(s)" to replace the many repeated casts. Appreciate you merely moved existing code though, so either way Reviewed-by: Daniel P. Berrangé <berra...@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 :|