{"id":2230545,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2230545/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430-qemu-vnc-v3-10-be96757428d0@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.1/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260430-qemu-vnc-v3-10-be96757428d0@redhat.com>","date":"2026-04-29T21:02:43","name":"[v3,10/26] ui/console-vc: extract vt100_init() and vt100_fini()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"a079c23307ebdba40481851a9eb9e9c512ea9b7c","submitter":{"id":66774,"url":"http://patchwork.ozlabs.org/api/1.1/people/66774/?format=json","name":"Marc-André Lureau","email":"marcandre.lureau@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430-qemu-vnc-v3-10-be96757428d0@redhat.com/mbox/","series":[{"id":502150,"url":"http://patchwork.ozlabs.org/api/1.1/series/502150/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502150","date":"2026-04-29T21:02:34","name":"ui: add standalone VNC server over D-Bus","version":3,"mbox":"http://patchwork.ozlabs.org/series/502150/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2230545/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2230545/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=B6nGDNvR;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5VFV6SZPz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 07:05:34 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wIC4x-00051l-H6; Wed, 29 Apr 2026 17:04:19 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1wIC4v-0004kp-Bn\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 17:04:17 -0400","from us-smtp-delivery-124.mimecast.com ([170.10.133.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1wIC4t-0003La-Ln\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 17:04:17 -0400","from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-594-P11UuIqfNJqca0-HXQcJeA-1; Wed,\n 29 Apr 2026 17:04:13 -0400","from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 560B71956080; Wed, 29 Apr 2026 21:04:12 +0000 (UTC)","from localhost (unknown [10.44.22.2])\n by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 53BAC19560AB; Wed, 29 Apr 2026 21:04:10 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777496655;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=6rzLL/ck02/es3rtCEyzFAswJotjkFyi2i5qTXjS7v4=;\n b=B6nGDNvRFR/pLupDUSF1SrdcwGpwhd9cyfOvdIaYFtzbN2/hrHP8cLp9NFkFHh1fbyWc43\n SbFcqIRIJb3uFsJZehfxEdhttJBJNhAqYhDJt4JVuLoiS4p6WpKPntkVAjGc8v1Ubnosbp\n KpFFW1iNgHWIhWrL7lwhIMCidUDwGFs=","X-MC-Unique":"P11UuIqfNJqca0-HXQcJeA-1","X-Mimecast-MFC-AGG-ID":"P11UuIqfNJqca0-HXQcJeA_1777496652","From":"=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>","Date":"Thu, 30 Apr 2026 01:02:43 +0400","Subject":"[PATCH v3 10/26] ui/console-vc: extract vt100_init() and vt100_fini()","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"8bit","Message-Id":"<20260430-qemu-vnc-v3-10-be96757428d0@redhat.com>","References":"<20260430-qemu-vnc-v3-0-be96757428d0@redhat.com>","In-Reply-To":"<20260430-qemu-vnc-v3-0-be96757428d0@redhat.com>","To":"qemu-devel@nongnu.org","Cc":"=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n\t=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","X-Developer-Signature":"v=1; a=openpgp-sha256; l=4232;\n i=marcandre.lureau@redhat.com; h=from:subject:message-id;\n bh=lnxoLHdniGID3jNMfTck0VEAWspSpAGOyq5lUI50G/Q=;\n b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBp8nILmU/orWtNu+2WtCK8xEhL8XgWVfB94j9B+\n BB1bf1ud76JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCafJyCwAKCRDa6OEJdZac\n 5THNEACn//+1E9J9b7nW9Len4aZpbMeiQ/CdDsqQeTl70yiAQtT3/xQPnjALcMdRYWDagCvA7pW\n 9GDfcmml40F/0dvyQ7f7UU5V3VqTCt76JJAzJ7eGSpwA4rupjknxOELeAGb2vnCgLqE0iYR109N\n AFwuvJvelfwHpdgVFDbMQgbLl+O2iyxRWWvLn7Ir28/ZIbH2knBIlN8hfkaXtjw+6BKpas5Fzrw\n bJ274bx1Ql07EPm20MKAnyBxoEx5msNLlOte5kqyJCkTPEmPsP5Dsf9i9cCqFOAnZVTk1He/PRF\n /Xqti53tQU7uPopszY2k8h0WPDFsr2/On4XSrrWzQKoCNng94EZk9l3fEVwkDbSPTONMHG3I0iq\n 7qx/oy+wsiDBbcIaEJ9277DqwBEmoMexPUbnMdXv8F7s/ySJmkkwBiQmgfbwwMmVZVN7SHxO6Sr\n NhtAIbhG+Cd13lbzJaju3MqUYjQ4fcf9WpLfrIxRvdW1O2BvDsTyuhQfSuoggG1rswgy+UfnIwO\n kVv3NXGGfuEC6qa/dsbUV9k8SLYED65YJt43VsT3dqKt6MYY0GGP08ieax0du1C0QLG3JZHTAix\n CNNB0EoIamY1BBfFmnxDsz5PGbrzRrU4NFdrYAU3UCQHX3pD9nMr7xsNkDZ1Fuw0Y7vWXukqTdU\n tAWydH0mNja7MBA==","X-Developer-Key":"i=marcandre.lureau@redhat.com; a=openpgp;\n fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.12","Received-SPF":"pass client-ip=170.10.133.124;\n envelope-from=marcandre.lureau@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com","X-Spam_score_int":"12","X-Spam_score":"1.2","X-Spam_bar":"+","X-Spam_report":"(1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,\n RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001,\n 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 <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"Consolidate VT100 initialization and finalization into dedicated\nfunctions, continuing the extraction of the VT100 layer from the\nconsole/chardev code.\n\nvt100_init() gathers the scattered setup (cursor timer, list insertion,\nFIFO creation, default attributes, and image) that was previously spread\nacross vc_chr_open() and qemu_text_console_class_init().\n\nvt100_fini() pairs with it by handling list removal, FIFO destruction,\nand cells cleanup, replacing the open-coded QTAILQ_REMOVE in\nqemu_text_console_finalize().\n\nReviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n---\n ui/console-vc.c | 55 +++++++++++++++++++++++++++++++++++++------------------\n 1 file changed, 37 insertions(+), 18 deletions(-)","diff":"diff --git a/ui/console-vc.c b/ui/console-vc.c\nindex 9f5f49413d2..b58fe5de827 100644\n--- a/ui/console-vc.c\n+++ b/ui/console-vc.c\n@@ -331,7 +331,7 @@ static void vt100_write(QemuVT100 *vt, const void *buf, size_t len)\n     vt->out_flush(vt);\n }\n \n-static int vt100_input(QemuVT100 *vt, const uint8_t *buf, int len);\n+static size_t vt100_input(QemuVT100 *vt, const uint8_t *buf, size_t len);\n \n static void vt100_keysym(QemuVT100 *vt, int keysym)\n {\n@@ -1129,12 +1129,19 @@ static void text_console_invalidate(void *opaque)\n     vt100_refresh(&s->vt);\n }\n \n+static void vt100_fini(QemuVT100 *vt)\n+{\n+    QTAILQ_REMOVE(&vt100s, vt, list);\n+    fifo8_destroy(&vt->out_fifo);\n+    g_free(vt->cells);\n+}\n+\n static void\n qemu_text_console_finalize(Object *obj)\n {\n     QemuTextConsole *s = QEMU_TEXT_CONSOLE(obj);\n \n-    QTAILQ_REMOVE(&vt100s, &s->vt, list);\n+    vt100_fini(&s->vt);\n }\n \n static void\n@@ -1142,10 +1149,6 @@ qemu_text_console_class_init(ObjectClass *oc, const void *data)\n {\n     QemuConsoleClass *cc = QEMU_CONSOLE_CLASS(oc);\n \n-    if (!cursor_timer) {\n-        cursor_timer = timer_new_ms(QEMU_CLOCK_REALTIME, cursor_timer_cb, NULL);\n-    }\n-\n     cc->get_label = qemu_text_console_get_label;\n }\n \n@@ -1211,6 +1214,27 @@ static void text_console_out_flush(QemuVT100 *vt)\n     qemu_text_console_out_flush(console);\n }\n \n+static void vt100_init(QemuVT100 *vt,\n+                       pixman_image_t *image,\n+                       ChardevVCEncoding encoding,\n+                       void (*image_update)(QemuVT100 *vt, int x, int y, int w, int h),\n+                       void (*out_flush)(QemuVT100 *vt))\n+{\n+    if (!cursor_timer) {\n+        cursor_timer = timer_new_ms(QEMU_CLOCK_REALTIME, cursor_timer_cb, NULL);\n+    }\n+\n+    vt->encoding = encoding;\n+    QTAILQ_INSERT_HEAD(&vt100s, vt, list);\n+    fifo8_create(&vt->out_fifo, 16);\n+    vt->total_height = DEFAULT_BACKSCROLL;\n+    vt->image_update = image_update;\n+    vt->out_flush = out_flush;\n+    /* set current text attributes to default */\n+    vt->t_attrib = TEXT_ATTRIBUTES_DEFAULT;\n+    vt100_set_image(vt, image);\n+}\n+\n static bool vc_chr_open(Chardev *chr, ChardevBackend *backend, Error **errp)\n {\n     ChardevVC *vc = backend->u.vc.data;\n@@ -1240,22 +1264,17 @@ static bool vc_chr_open(Chardev *chr, ChardevBackend *backend, Error **errp)\n         s = QEMU_TEXT_CONSOLE(object_new(TYPE_QEMU_FIXED_TEXT_CONSOLE));\n     }\n \n-    QTAILQ_INSERT_HEAD(&vt100s, &s->vt, list);\n-    fifo8_create(&s->vt.out_fifo, 16);\n-    s->vt.total_height = DEFAULT_BACKSCROLL;\n     dpy_gfx_replace_surface(QEMU_CONSOLE(s), qemu_create_displaysurface(width, height));\n-    s->vt.image_update = text_console_image_update;\n-    s->vt.out_flush = text_console_out_flush;\n-\n-    s->chr = chr;\n-    drv->console = s;\n     if (vc->has_encoding) {\n-        drv->encoding = s->vt.encoding = vc->encoding;\n+        drv->encoding = vc->encoding;\n     }\n+    vt100_init(&s->vt, QEMU_CONSOLE(s)->surface->image,\n+               drv->encoding,\n+               text_console_image_update,\n+               text_console_out_flush);\n \n-    /* set current text attributes to default */\n-    s->vt.t_attrib = TEXT_ATTRIBUTES_DEFAULT;\n-    vt100_set_image(&s->vt, QEMU_CONSOLE(s)->surface->image);\n+    s->chr = chr;\n+    drv->console = s;\n \n     if (chr->label) {\n         char *msg;\n","prefixes":["v3","10/26"]}