From nobody Sat Apr 11 13:59:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1775848959; cv=none; d=zohomail.com; s=zohoarc; b=Nke8CtRwxg83780PF0/INaX98YEg5a2PHTtrdrd9xpOdXQU0j3bJ1rxx9qCzXrJ7JlMLyrjvkywDP3llRodFztO0byxSPMVvenLxl7/H0nt8YQksESbW9ziaUlFMPvLuDvycowqPTkYsqMXtoqx5JHcy8IUIRvuEAm8BNrxGC74= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775848958; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Nlf2o8mRqacvDJSwzpHGOMMjfkTarzsBxasECZnZ52w=; b=gY3sd6nU3TSgzHyDmLkR7dH1ybOMCi63N/Zw25o86u3TSqLv5+LHCJsmy3ce2a/cmrqFbd8NNjlo/9z568VQ3Fk2kwKPiodW0hvGtsTcBRwWZHvr5eJVLB+iUrMXIV7q50FxGVqnfj17+tiv0bXIsH53fU+iV00g/P75ufLKXfA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1775848958991287.88921961103847; Fri, 10 Apr 2026 12:22:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wBHQI-0000Xt-D3; Fri, 10 Apr 2026 15:21:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wBHQ9-0008Lq-IJ for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:21:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wBHQ7-0001dN-Tw for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:21:37 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-iGkVYhm7Mp27tI82cdbnXw-1; Fri, 10 Apr 2026 15:21:31 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0573B195609D; Fri, 10 Apr 2026 19:21:31 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EB5E11800357; Fri, 10 Apr 2026 19:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775848895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nlf2o8mRqacvDJSwzpHGOMMjfkTarzsBxasECZnZ52w=; b=SI2xdqCST6qvYRJ06ADo3p61qOaJFnVsGFAuAL9OKj4Tmo3oETNupjlIkm1vkIv9NoYT+K at1tc0q4mmKeeahZI0Rdlmwu7MqZ/DQ5WWxlT2QWmMKjV8HEpL/0OA2eA7/YLhHh1Nbt2e PIAJDQbYca7vzPtvYYwaba9C0ZVwJ2k= X-MC-Unique: iGkVYhm7Mp27tI82cdbnXw-1 X-Mimecast-MFC-AGG-ID: iGkVYhm7Mp27tI82cdbnXw_1775848891 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 10 Apr 2026 23:18:48 +0400 Subject: [PATCH v2 26/67] ui/console-vc: extract vt100_input() from vc_chr_write() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260410-qemu-vnc-v2-26-231416f76dc3@redhat.com> References: <20260410-qemu-vnc-v2-0-231416f76dc3@redhat.com> In-Reply-To: <20260410-qemu-vnc-v2-0-231416f76dc3@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=2581; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=TYkIOGSAidOPC1GAUAmf1ai1B20Ef3cKVdaaYTLqsSc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBp2U0UC+ZcTORFPunFNKAFArqyjf73drBZpEU6O PZgTCUA3QqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCadlNFAAKCRDa6OEJdZac 5d76EACknccvmeujT9lmEtJYNq5TH/2P28Av+Tfxl13hAFDh5fKsr1Zc8VthN9h4y/E7CqM92Hh PJYFcbtZrRYIhltxj/dKCstiB+kll0R40PG2jyNsTNDE886PXgX0LbC2dJZykKrYX++FVqW6RBX 6jPYMT5DLohLmRYSF+5SoyS6uVo+Uz98HvKFWNoYtiOtKpcS+5zFAGzCyKeFKbUXZIRN0sxCrMc MHqRy8MqaLSBtluQ+M1xwajPoimVHbEsRMqHTRImGDUTinEY0LA2VQg8dcaCcTDrrUqqowT3V/j +pKxCXCRmm311+O4jNIu5UwMAl7BTBmSctGO6MrvcvhiZnccsVDOGypIsfddB4NUOqRKQahM7F8 WZ0Ze/xCV2ozfpur9cZ+2iXYAr1STvBaXDQ3F/kvBFqRpHzaxPVyAeqdMK0YetZqa9QtJbcBW0G 2Tpe8FOS7v9z423UCOnBDHNLkG66BdmlX7FZVlx06ilqiyLB9fYo1nV51e6hZiYQN7Ce9cItaoV I9naMIlfdsftN1gBt6z/JBhtRng270pBeMQZ4GgSwibU8l7Xms5nx+hkG4qaCnmhIsUSbLE6dRj a18bwhiD0PvkAGsVc2OaX0F15EK9XGD9fz81CorQX8FWWCWCPy/CVF6sZdTmRKIq6ZuSG/kdt1z uT10k5nel20LK6Q== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 7 X-Spam_score: 0.7 X-Spam_bar: / X-Spam_report: (0.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1775848959876154100 Move the VT100 input processing logic out of vc_chr_write() into a new vt100_input() function that operates on QemuVT100 directly, rather than going through the Chardev/VCChardev layers. This continues the effort to decouple the VT100 emulation from the chardev backend, making the VT100 layer self-contained and reusable. vc_chr_write() becomes a thin wrapper that extracts the QemuVT100 from the chardev and delegates to vt100_input(). Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/console-vc.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/ui/console-vc.c b/ui/console-vc.c index 5cfb3dfcf72..15600128380 100644 --- a/ui/console-vc.c +++ b/ui/console-vc.c @@ -1057,29 +1057,35 @@ static void vt100_putchar(QemuVT100 *vt, int ch) DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV, TYPE_CHARDEV_VC) =20 -static int vc_chr_write(Chardev *chr, const uint8_t *buf, int len) +static size_t vt100_input(QemuVT100 *vt, const uint8_t *buf, size_t len) { - VCChardev *drv =3D VC_CHARDEV(chr); - QemuTextConsole *s =3D drv->console; int i; =20 - s->vt.update_x0 =3D s->vt.width * FONT_WIDTH; - s->vt.update_y0 =3D s->vt.height * FONT_HEIGHT; - s->vt.update_x1 =3D 0; - s->vt.update_y1 =3D 0; - vt100_show_cursor(&s->vt, 0); + vt->update_x0 =3D vt->width * FONT_WIDTH; + vt->update_y0 =3D vt->height * FONT_HEIGHT; + vt->update_x1 =3D 0; + vt->update_y1 =3D 0; + vt100_show_cursor(vt, 0); for(i =3D 0; i < len; i++) { - vt100_putchar(&s->vt, buf[i]); + vt100_putchar(vt, buf[i]); } - vt100_show_cursor(&s->vt, 1); - if (s->vt.update_x0 < s->vt.update_x1) { - vt100_image_update(&s->vt, s->vt.update_x0, s->vt.update_y0, - s->vt.update_x1 - s->vt.update_x0, - s->vt.update_y1 - s->vt.update_y0); + vt100_show_cursor(vt, 1); + if (vt->update_x0 < vt->update_x1) { + vt100_image_update(vt, vt->update_x0, vt->update_y0, + vt->update_x1 - vt->update_x0, + vt->update_y1 - vt->update_y0); } return len; } =20 +static int vc_chr_write(Chardev *chr, const uint8_t *buf, int len) +{ + VCChardev *drv =3D VC_CHARDEV(chr); + QemuTextConsole *s =3D drv->console; + + return vt100_input(&s->vt, buf, len); +} + void vt100_update_cursor(void) { QemuVT100 *vt; --=20 2.53.0