From nobody Sat Apr 11 13:59:06 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=1775848915; cv=none; d=zohomail.com; s=zohoarc; b=HbuuPQWK8q1kbzyeEuV/+H9zLGQM7z9Y6j7zPqC4JnkzuON1B265JU7ZyV6RS2gvV2WHMaUFjlT3B8Ev2T2FLfn7KY1MXE3hoLugyrb4aQ1WOMSXs45eBGISjzuGPlF+ERM6DkwhTZk9HYgjUm/GnjxrEjcCk59Lu0XlAHu/Qrk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775848915; 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=HrbyBCyRCrUTpCfsw4FXQ87PN8E4xHrqUwFNeptatsY=; b=W49KhTysuBHCjEWWgnbcD6pn4Pf40fIG5IsTWbI5MR/m/FEwRs64HrfBatOLS413qBvMJp79P3AgefZNZIqBsvtfly1x+Hi4Akk40mqd98Uf/05jRWzlbSN+9ybsKLwZ8ADru6NeVMwJ+LGZjmdrD9qrhuqwUvUyHFHohBH0GmA= 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 1775848915097877.51539383457; Fri, 10 Apr 2026 12:21:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wBHPo-0006em-Cm; Fri, 10 Apr 2026 15:21:16 -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 1wBHPj-0005wP-P8 for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:21:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wBHPi-0001aq-8s for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:21:11 -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-209-2ArQdatZMJKQFVrASN263Q-1; Fri, 10 Apr 2026 15:21:07 -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 8888819560AA; Fri, 10 Apr 2026 19:21:06 +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 159FB1800357; Fri, 10 Apr 2026 19:21:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775848869; 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=HrbyBCyRCrUTpCfsw4FXQ87PN8E4xHrqUwFNeptatsY=; b=ETf79tEtEDc2c9YmK71Xu8/AjQuJdMW4CsFKqe27Ydnp83ibnQMMeqYfl3zU6mkN4kxmz1 2WRo7QLa9UzmLHlTNGOErBXt/TR8+Om8UwDqdx/H8ht7tU1jgZIrMI2M5T/msqIcnUkBCA mDjldvS3Kfahl0VdUc8E39f0Rrj+SvQ= X-MC-Unique: 2ArQdatZMJKQFVrASN263Q-1 X-Mimecast-MFC-AGG-ID: 2ArQdatZMJKQFVrASN263Q_1775848866 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 10 Apr 2026 23:18:44 +0400 Subject: [PATCH v2 22/67] ui/console-vc: refactor text_console_resize() into vt100_set_image() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260410-qemu-vnc-v2-22-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=3458; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=hGNex5Z8ktmnpUuKhaz5DK+qq1hXD5X1R8yragDrE5U=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBp2U0U+HIV6XWW8Qz/7MOjA4aUz0nyXldqx1LE/ BwtXpzSRiiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCadlNFAAKCRDa6OEJdZac 5aF0EACOYeHXi6Btb2ohEhaIeQA05wJCLLgak/Hz884HpdYIetGTvquYONb5bVlTX4B4ANhmLNS Yo9iNdGwpEhCPqo/x6cKlx1V+8xtJnZv7Im/3evQO6a+PIxCwxiryfEX8UJnpFjVN+3HSA/+uJH HSZQDKytWq1UcCPnaeD7Xjb9ltPyqbik+lJ+QourrHILp9170d+E9gyRAtmnLARt+QoAxcSHgxD gkKDC6mCgPCxOAc2vFnL4n/Ku60jZxV9MbtmRf+z/GspQEBHb5XFKp4G1S0o9oUCFAPeETk5p/V ZXaWO4iGc7Sas/SxKsvNS1+cA+odxpjBpnDcWeYA6bxoOvN0zZBXsbEUWZ9LA2Gh2/Q0VnZtUhQ GVPch1iUpf3+CtkfIqTmJDD4vHJtVIJwz8ML5+WV0zEpIjkVf3EPiKXfjf5xsPwjbL+6E5RpWTt VPwDYRzHZ0Hhfq8GVut5UxbhPG1SsFguqAJCqe9+yhAW2LLGopx0On+g/uqRCwaEpVCo4Z8mujl Zr7FxdNskKkuMnEw1ZgHpOEhfLBJpRpNmMtDS6sCyYnbGqQHW9yEu8pPwO7Ma3BtOAkIuWTWj/i qcYEqO4d4x/RPlEUivfdutKupSRi/NF7Sz+7FWHLZnG5EJxRtzLNT6oQxp6j/AOMleOD2STpvyN 3UXRk2/m35ksEyQ== 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.129.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_H4=0.001, RCVD_IN_MSPIKE_WL=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: 1775848915430158500 Decouple the resize logic from QemuTextConsole by operating on QemuVT100 and taking a pixman_image_t directly, instead of reaching into the console's scanout surface. The callers now pass the image explicitly, which makes the VT100 layer independent of the console object hierarchy. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/console-vc.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/ui/console-vc.c b/ui/console-vc.c index c6846af3697..85c794062fc 100644 --- a/ui/console-vc.c +++ b/ui/console-vc.c @@ -12,6 +12,7 @@ #include "ui/console.h" #include "ui/cp437.h" =20 +#include "pixman.h" #include "trace.h" #include "console-priv.h" =20 @@ -397,44 +398,41 @@ static void text_console_update(void *opaque, console= _ch_t *chardata) } } =20 -static void text_console_resize(QemuTextConsole *t) +static void vt100_set_image(QemuVT100 *vt, pixman_image_t *image) { - QemuConsole *s =3D QEMU_CONSOLE(t); TextCell *cells, *c, *c1; int w1, x, y, last_width, w, h; =20 - assert(s->scanout.kind =3D=3D SCANOUT_SURFACE); - - t->vt.image =3D s->surface->image; - w =3D pixman_image_get_width(t->vt.image) / FONT_WIDTH; - h =3D pixman_image_get_height(t->vt.image) / FONT_HEIGHT; - if (w =3D=3D t->vt.width && h =3D=3D t->vt.height) { + vt->image =3D image; + w =3D pixman_image_get_width(image) / FONT_WIDTH; + h =3D pixman_image_get_height(image) / FONT_HEIGHT; + if (w =3D=3D vt->width && h =3D=3D vt->height) { return; } =20 - last_width =3D t->vt.width; - t->vt.width =3D w; - t->vt.height =3D h; + last_width =3D vt->width; + vt->width =3D w; + vt->height =3D h; =20 - w1 =3D MIN(t->vt.width, last_width); + w1 =3D MIN(vt->width, last_width); =20 - cells =3D g_new(TextCell, t->vt.width * t->vt.total_height + 1); - for (y =3D 0; y < t->vt.total_height; y++) { - c =3D &cells[y * t->vt.width]; + cells =3D g_new(TextCell, vt->width * vt->total_height + 1); + for (y =3D 0; y < vt->total_height; y++) { + c =3D &cells[y * vt->width]; if (w1 > 0) { - c1 =3D &t->vt.cells[y * last_width]; + c1 =3D &vt->cells[y * last_width]; for (x =3D 0; x < w1; x++) { *c++ =3D *c1++; } } - for (x =3D w1; x < t->vt.width; x++) { + for (x =3D w1; x < vt->width; x++) { c->ch =3D ' '; c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; c++; } } - g_free(t->vt.cells); - t->vt.cells =3D cells; + g_free(vt->cells); + vt->cells =3D cells; } =20 static void vc_put_lf(VCChardev *vc) @@ -1137,7 +1135,7 @@ static void text_console_invalidate(void *opaque) QemuTextConsole *s =3D QEMU_TEXT_CONSOLE(opaque); =20 if (!QEMU_IS_FIXED_TEXT_CONSOLE(s)) { - text_console_resize(QEMU_TEXT_CONSOLE(s)); + vt100_set_image(&s->vt, QEMU_CONSOLE(s)->surface->image); } vt100_refresh(&s->vt); } @@ -1257,7 +1255,7 @@ static bool vc_chr_open(Chardev *chr, ChardevBackend = *backend, Error **errp) =20 /* set current text attributes to default */ drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; - text_console_resize(s); + vt100_set_image(&s->vt, QEMU_CONSOLE(s)->surface->image); =20 if (chr->label) { char *msg; --=20 2.53.0