From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wh16Y-0000qW-A6 for qemu-devel@nongnu.org; Sun, 04 May 2014 14:25:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wh16Q-0004ZY-OL for qemu-devel@nongnu.org; Sun, 04 May 2014 14:25:38 -0400 Received: from mout.web.de ([212.227.15.3]:52582) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wh16Q-0004ZH-EP for qemu-devel@nongnu.org; Sun, 04 May 2014 14:25:30 -0400 Message-ID: <5366860E.5090301@web.de> Date: Sun, 04 May 2014 20:25:18 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1398764774-22595-1-git-send-email-kraxel@redhat.com> <1398764774-22595-8-git-send-email-kraxel@redhat.com> <5365FBD4.90108@web.de> <536673EA.7090402@redhat.com> In-Reply-To: <536673EA.7090402@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="llkAoO2rbLhjC0emTTPrPvK5cNCNRPdho" Subject: Re: [Qemu-devel] [PULL 7/8] gtk: Fix -serial vc List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cole Robinson , Gerd Hoffmann , qemu-devel@nongnu.org Cc: Anthony Liguori This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --llkAoO2rbLhjC0emTTPrPvK5cNCNRPdho Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2014-05-04 19:07, Cole Robinson wrote: > On 05/04/2014 04:35 AM, Jan Kiszka wrote: >> On 2014-04-29 11:46, Gerd Hoffmann wrote: >>> From: Cole Robinson >>> >>> Try kicking off a rhel5 text install over serial, the text menu navig= ation >>> is all messed up, and some of the kernel boot messages are randomly >>> corrupted. >>> >>> Drop use of a pty and just use vte infrastructure for reading and wri= ting. >>> This fixes the above corruption, and is simpler to boot. >>> >>> (I don't know what was wrong with the original code though. FWIW this= is >>> what virt-manager has done for years). >>> >>> Signed-off-by: Cole Robinson >>> Signed-off-by: Gerd Hoffmann >>> --- >>> ui/gtk.c | 41 +++++++++-------------------------------- >>> 1 file changed, 9 insertions(+), 32 deletions(-) >>> >>> diff --git a/ui/gtk.c b/ui/gtk.c >>> index c85aea3..1465a38 100644 >>> --- a/ui/gtk.c >>> +++ b/ui/gtk.c >>> @@ -115,7 +115,6 @@ typedef struct VirtualConsole >>> GtkWidget *scrolled_window; >>> CharDriverState *chr; >>> #endif >>> - int fd; >>> } VirtualConsole; >>> =20 >>> typedef struct GtkDisplayState >>> @@ -1162,9 +1161,12 @@ static gboolean gd_focus_out_event(GtkWidget *= widget, >>> =20 >>> static int gd_vc_chr_write(CharDriverState *chr, const uint8_t *buf,= int len) >>> { >>> +#if defined(CONFIG_VTE) >>> VirtualConsole *vc =3D chr->opaque; >>> =20 >>> - return vc ? write(vc->fd, buf, len) : len; >>> + vte_terminal_feed(VTE_TERMINAL(vc->terminal), (const char *)buf,= len); >>> +#endif >>> + return len; >>> } >>> =20 >>> static int nb_vcs; >>> @@ -1190,19 +1192,12 @@ void early_gtk_display_init(void) >>> } >>> =20 >>> #if defined(CONFIG_VTE) >>> -static gboolean gd_vc_in(GIOChannel *chan, GIOCondition cond, void *= opaque) >>> +static gboolean gd_vc_in(VteTerminal *terminal, gchar *text, guint s= ize, >>> + gpointer user_data) >>> { >>> - VirtualConsole *vc =3D opaque; >>> - uint8_t buffer[1024]; >>> - ssize_t len; >>> - >>> - len =3D read(vc->fd, buffer, sizeof(buffer)); >>> - if (len <=3D 0) { >>> - return FALSE; >>> - } >>> - >>> - qemu_chr_be_write(vc->chr, buffer, len); >>> + VirtualConsole *vc =3D user_data; >>> =20 >>> + qemu_chr_be_write(vc->chr, (uint8_t *)text, (unsigned int)size)= ; >>> return TRUE; >>> } >>> #endif >>> @@ -1214,13 +1209,8 @@ static GSList *gd_vc_init(GtkDisplayState *s, = VirtualConsole *vc, int index, GSL >>> const char *label; >>> char buffer[32]; >>> char path[32]; >>> -#if VTE_CHECK_VERSION(0, 26, 0) >>> - VtePty *pty; >>> -#endif >>> - GIOChannel *chan; >>> GtkWidget *scrolled_window; >>> GtkAdjustment *vadjustment; >>> - int master_fd, slave_fd; >>> =20 >>> snprintf(buffer, sizeof(buffer), "vc%d", index); >>> snprintf(path, sizeof(path), "/View/VC%d", index); >>> @@ -1239,16 +1229,7 @@ static GSList *gd_vc_init(GtkDisplayState *s, = VirtualConsole *vc, int index, GSL >>> gtk_accel_map_add_entry(path, GDK_KEY_2 + index, HOTKEY_MODIFIER= S); >>> =20 >>> vc->terminal =3D vte_terminal_new(); >>> - >>> - master_fd =3D qemu_openpty_raw(&slave_fd, NULL); >>> - g_assert(master_fd !=3D -1); >>> - >>> -#if VTE_CHECK_VERSION(0, 26, 0) >>> - pty =3D vte_pty_new_foreign(master_fd, NULL); >>> - vte_terminal_set_pty_object(VTE_TERMINAL(vc->terminal), pty); >>> -#else >>> - vte_terminal_set_pty(VTE_TERMINAL(vc->terminal), master_fd); >>> -#endif >>> + g_signal_connect(vc->terminal, "commit", G_CALLBACK(gd_vc_in), v= c); >>> =20 >>> vte_terminal_set_scrollback_lines(VTE_TERMINAL(vc->terminal), -1= ); >>> =20 >>> @@ -1263,7 +1244,6 @@ static GSList *gd_vc_init(GtkDisplayState *s, V= irtualConsole *vc, int index, GSL >>> =20 >>> vte_terminal_set_size(VTE_TERMINAL(vc->terminal), 80, 25); >>> =20 >>> - vc->fd =3D slave_fd; >>> vc->chr->opaque =3D vc; >>> vc->scrolled_window =3D scrolled_window; >>> =20 >>> @@ -1281,9 +1261,6 @@ static GSList *gd_vc_init(GtkDisplayState *s, V= irtualConsole *vc, int index, GSL >>> vc->chr->init(vc->chr); >>> } >>> =20 >>> - chan =3D g_io_channel_unix_new(vc->fd); >>> - g_io_add_watch(chan, G_IO_IN, gd_vc_in, vc); >>> - >>> #endif /* CONFIG_VTE */ >>> return group; >>> } >>> >> >> This commit somehow messes up the monitor vc: Fire up qemu-system-x86_= 64 >> and switch to console 2 (monitor). You'll find it formatted as if the >> console was only ~10 chars wide during printout of the monitor >> greetings. When typing, everything is fine again. Maybe an ordering >> issue that was only revealed by this commit, dunno yet. >> >=20 > Check out gerd's ui-gtk-next branch, there's a few extra patches relate= d to > vte sizing that might fix it. Looks better thanks to "gtk: zap scrolled_window" (monitor is properly formatted again). But the whole queue spits this out on the terminal: (:13169): Gtk-CRITICAL **: IA__gtk_window_resize: assertion `wid= th > 0' failed (:13169): Gdk-CRITICAL **: IA__gdk_window_set_cursor: assertion = `GDK_IS_WINDOW (window)' failed The last two patches seem to be responsible for this. Jan --llkAoO2rbLhjC0emTTPrPvK5cNCNRPdho Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlNmhhEACgkQitSsb3rl5xSSSQCeJCp4iXDdlnNWm2eruwEAYELD OEQAnA4MapITED952JP0gCDNOO7jz5pm =sTJ4 -----END PGP SIGNATURE----- --llkAoO2rbLhjC0emTTPrPvK5cNCNRPdho--