Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2222077/?format=api
{ "id": 2222077, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2222077/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260410-qemu-vnc-v2-13-231416f76dc3@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.1/projects/14/?format=api", "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": "<20260410-qemu-vnc-v2-13-231416f76dc3@redhat.com>", "date": "2026-04-10T19:18:35", "name": "[v2,13/67] ui/console-vc: introduce QemuVT100", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "c42b90979426a64e5fc727d87fc313c877d25397", "submitter": { "id": 66774, "url": "http://patchwork.ozlabs.org/api/1.1/people/66774/?format=api", "name": "Marc-André Lureau", "email": "marcandre.lureau@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260410-qemu-vnc-v2-13-231416f76dc3@redhat.com/mbox/", "series": [ { "id": 499494, "url": "http://patchwork.ozlabs.org/api/1.1/series/499494/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499494", "date": "2026-04-10T19:18:23", "name": "ui: add standalone VNC server over D-Bus", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/499494/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2222077/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2222077/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=gIBEn14N;\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=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.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 4fsmqJ6SGzz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 11 Apr 2026 05:20:44 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wBHOx-0004hy-Lk; Fri, 10 Apr 2026 15:20:23 -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 1wBHOv-0004g1-QR\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:20:21 -0400", "from us-smtp-delivery-124.mimecast.com ([170.10.129.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 1wBHOs-000170-Vc\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:20:21 -0400", "from mx-prod-mc-03.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-589-jtfE0P7fOAig-na2HDDHVQ-1; Fri,\n 10 Apr 2026 15:20:15 -0400", "from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111])\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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 0A7FA19560BB; Fri, 10 Apr 2026 19:20:14 +0000 (UTC)", "from localhost (unknown [10.44.22.4])\n by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 42DDF1801ACE; Fri, 10 Apr 2026 19:20:10 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1775848818;\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=L+3nHPs9xR2D8mkEMq5b7qsnC0hTkTfJrxig+fdBYlo=;\n b=gIBEn14NZQO7mcnfrXktjhAoxNAW0KldkUyOVebIBw66qTuUi8MKH6mOhwyATWtU6oR7x0\n H7aCpW7UTQspkF5YGwbjS68f0BilNLro39xVH+mk1Q40hHQXmaRi9nGg3QEg+pfdbEAXFc\n E7uWD+WxnKL3WWid7paPTpS8r8oLoDQ=", "X-MC-Unique": "jtfE0P7fOAig-na2HDDHVQ-1", "X-Mimecast-MFC-AGG-ID": "jtfE0P7fOAig-na2HDDHVQ_1775848814", "From": "=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>", "Date": "Fri, 10 Apr 2026 23:18:35 +0400", "Subject": "[PATCH v2 13/67] ui/console-vc: introduce QemuVT100", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "8bit", "Message-Id": "<20260410-qemu-vnc-v2-13-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?= <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=28456;\n i=marcandre.lureau@redhat.com; h=from:subject:message-id;\n bh=5qFx7O1tTryueCgr78HCGFQy8xKJFAZYAw5dmxbXGno=;\n b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBp2U0Usn9NDLkDIVGcTE5NIt0lyX6IA841K3Ff4\n rKXL/HWk6GJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCadlNFAAKCRDa6OEJdZac\n 5aMsD/4yLqeuuM7moJpAaPsfIkXQ+DUt+b0lN0Z7tqn9RiE/9BOxYn+J5qCZk1t1G4V5HxQs3Y1\n oWrH2OJkPMevI6kV8rnlfafM0+ZiGlpCMENcwEK5dS2WBCTwRGVwNaKYzCKETRyKfGQEfYifIW3\n BkFcOpkxYuorm2ghvDt/Ol0KK3nex8To/9SkP1N3RjtDb8FPUP/63yOCRDucRQIMeYJ+qoIQ3yb\n EqXY9OL29OuwxdEIemiPsoR0k0W9EVxqOcbLN03EjqQ4XxgoD4CRa+QWLJuwXtcirmcVHfggt60\n 7tMoI/GNGwTA0Jbfv7rn6+FGULetRnT/Dr4GxDq7bJpx5+1tBPiOKKpI8su+5fmwowNt85ZAyE8\n 2uc+nGGLpRyVBVmcdQpqxGciIJrQprDxcmdr1CeNTQYaPeh38bt7WcgxgiD+GoMoizlhMtXa5lK\n wmsiGVJDDSKwgVUQ5UfJ6UMIsMayar/sDH+ABnOsmz4gJwH4qXOFE9iAc8yVRfPbnD5CxYmzFHS\n vkwVPI/bvdvpl5+pw9R/eCTh7cpAKN6OgnPrxAXYMFYH8IPCAAN/VlypK8cHwxtdrALaHwtQjOT\n 3le8jHQxQeDU99X1w/FWTQFGEWOAuCfdWBuwiZ3wK3uXOFUIT2xBUUXzbVDAwW6BI7azNjbYbLi\n tQreR9yYq3pqBmg==", "X-Developer-Key": "i=marcandre.lureau@redhat.com; a=openpgp;\n fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.111", "Received-SPF": "pass client-ip=170.10.129.124;\n envelope-from=marcandre.lureau@redhat.com;\n 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,\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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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": "Start moving VT100 emulation specific code in a different structure.\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 | 399 +++++++++++++++++++++++++++++---------------------------\n 1 file changed, 210 insertions(+), 189 deletions(-)", "diff": "diff --git a/ui/console-vc.c b/ui/console-vc.c\nindex 7b9acf1adb1..cc061dff769 100644\n--- a/ui/console-vc.c\n+++ b/ui/console-vc.c\n@@ -48,9 +48,7 @@ enum TTYState {\n TTY_STATE_OSC,\n };\n \n-typedef struct QemuTextConsole {\n- QemuConsole parent;\n-\n+typedef struct QemuVT100 {\n int width;\n int height;\n int total_height;\n@@ -66,7 +64,12 @@ typedef struct QemuTextConsole {\n int update_y0;\n int update_x1;\n int update_y1;\n+} QemuVT100;\n \n+typedef struct QemuTextConsole {\n+ QemuConsole parent;\n+\n+ QemuVT100 vt;\n Chardev *chr;\n /* fifo for key pressed */\n Fifo8 out_fifo;\n@@ -183,37 +186,40 @@ static void vga_putcharxy(QemuConsole *s, int x, int y, int ch,\n \n static void invalidate_xy(QemuTextConsole *s, int x, int y)\n {\n+ QemuVT100 *vt = &s->vt;\n+\n if (!qemu_console_is_visible(QEMU_CONSOLE(s))) {\n return;\n }\n- if (s->update_x0 > x * FONT_WIDTH)\n- s->update_x0 = x * FONT_WIDTH;\n- if (s->update_y0 > y * FONT_HEIGHT)\n- s->update_y0 = y * FONT_HEIGHT;\n- if (s->update_x1 < (x + 1) * FONT_WIDTH)\n- s->update_x1 = (x + 1) * FONT_WIDTH;\n- if (s->update_y1 < (y + 1) * FONT_HEIGHT)\n- s->update_y1 = (y + 1) * FONT_HEIGHT;\n+ if (vt->update_x0 > x * FONT_WIDTH)\n+ vt->update_x0 = x * FONT_WIDTH;\n+ if (vt->update_y0 > y * FONT_HEIGHT)\n+ vt->update_y0 = y * FONT_HEIGHT;\n+ if (vt->update_x1 < (x + 1) * FONT_WIDTH)\n+ vt->update_x1 = (x + 1) * FONT_WIDTH;\n+ if (vt->update_y1 < (y + 1) * FONT_HEIGHT)\n+ vt->update_y1 = (y + 1) * FONT_HEIGHT;\n }\n \n static void console_show_cursor(QemuTextConsole *s, int show)\n {\n+ QemuVT100 *vt = &s->vt;\n TextCell *c;\n int y, y1;\n- int x = s->x;\n+ int x = vt->x;\n \n- s->cursor_invalidate = 1;\n+ vt->cursor_invalidate = 1;\n \n- if (x >= s->width) {\n- x = s->width - 1;\n+ if (x >= vt->width) {\n+ x = vt->width - 1;\n }\n- y1 = (s->y_base + s->y) % s->total_height;\n- y = y1 - s->y_displayed;\n+ y1 = (vt->y_base + vt->y) % vt->total_height;\n+ y = y1 - vt->y_displayed;\n if (y < 0) {\n- y += s->total_height;\n+ y += vt->total_height;\n }\n- if (y < s->height) {\n- c = &s->cells[y1 * s->width + x];\n+ if (y < vt->height) {\n+ c = &vt->cells[y1 * vt->width + x];\n if (show && cursor_visible_phase) {\n TextAttributes t_attrib = TEXT_ATTRIBUTES_DEFAULT;\n t_attrib.invers = !(t_attrib.invers); /* invert fg and bg */\n@@ -228,27 +234,28 @@ static void console_show_cursor(QemuTextConsole *s, int show)\n static void console_refresh(QemuTextConsole *s)\n {\n DisplaySurface *surface = qemu_console_surface(QEMU_CONSOLE(s));\n+ QemuVT100 *vt = &s->vt;\n TextCell *c;\n int x, y, y1;\n \n assert(surface);\n- s->text_x[0] = 0;\n- s->text_y[0] = 0;\n- s->text_x[1] = s->width - 1;\n- s->text_y[1] = s->height - 1;\n- s->cursor_invalidate = 1;\n+ vt->text_x[0] = 0;\n+ vt->text_y[0] = 0;\n+ vt->text_x[1] = vt->width - 1;\n+ vt->text_y[1] = vt->height - 1;\n+ vt->cursor_invalidate = 1;\n \n qemu_console_fill_rect(QEMU_CONSOLE(s), 0, 0, surface_width(surface), surface_height(surface),\n color_table_rgb[0][QEMU_COLOR_BLACK]);\n- y1 = s->y_displayed;\n- for (y = 0; y < s->height; y++) {\n- c = s->cells + y1 * s->width;\n- for (x = 0; x < s->width; x++) {\n+ y1 = vt->y_displayed;\n+ for (y = 0; y < vt->height; y++) {\n+ c = vt->cells + y1 * vt->width;\n+ for (x = 0; x < vt->width; x++) {\n vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch,\n &(c->t_attrib));\n c++;\n }\n- if (++y1 == s->total_height) {\n+ if (++y1 == vt->total_height) {\n y1 = 0;\n }\n }\n@@ -259,28 +266,29 @@ static void console_refresh(QemuTextConsole *s)\n \n static void console_scroll(QemuTextConsole *s, int ydelta)\n {\n+ QemuVT100 *vt = &s->vt;\n int i, y1;\n \n if (ydelta > 0) {\n for(i = 0; i < ydelta; i++) {\n- if (s->y_displayed == s->y_base)\n+ if (vt->y_displayed == vt->y_base)\n break;\n- if (++s->y_displayed == s->total_height)\n- s->y_displayed = 0;\n+ if (++vt->y_displayed == vt->total_height)\n+ vt->y_displayed = 0;\n }\n } else {\n ydelta = -ydelta;\n- i = s->backscroll_height;\n- if (i > s->total_height - s->height)\n- i = s->total_height - s->height;\n- y1 = s->y_base - i;\n+ i = vt->backscroll_height;\n+ if (i > vt->total_height - vt->height)\n+ i = vt->total_height - vt->height;\n+ y1 = vt->y_base - i;\n if (y1 < 0)\n- y1 += s->total_height;\n+ y1 += vt->total_height;\n for(i = 0; i < ydelta; i++) {\n- if (s->y_displayed == y1)\n+ if (vt->y_displayed == y1)\n break;\n- if (--s->y_displayed < 0)\n- s->y_displayed = s->total_height - 1;\n+ if (--vt->y_displayed < 0)\n+ vt->y_displayed = vt->total_height - 1;\n }\n }\n console_refresh(s);\n@@ -306,6 +314,7 @@ static void kbd_send_chars(QemuTextConsole *s)\n /* called when an ascii key is pressed */\n void qemu_text_console_handle_keysym(QemuTextConsole *s, int keysym)\n {\n+ QemuVT100 *vt = &s->vt;\n uint8_t buf[16], *q;\n int c;\n uint32_t num_free;\n@@ -338,13 +347,13 @@ void qemu_text_console_handle_keysym(QemuTextConsole *s, int keysym)\n *q++ = '\\033';\n *q++ = '[';\n *q++ = keysym & 0xff;\n- } else if (s->echo && (keysym == '\\r' || keysym == '\\n')) {\n+ } else if (vt->echo && (keysym == '\\r' || keysym == '\\n')) {\n qemu_chr_write(s->chr, (uint8_t *)\"\\r\", 1, true);\n *q++ = '\\n';\n } else {\n *q++ = keysym;\n }\n- if (s->echo) {\n+ if (vt->echo) {\n qemu_chr_write(s->chr, buf, q - buf, true);\n }\n num_free = fifo8_num_free(&s->out_fifo);\n@@ -357,29 +366,30 @@ void qemu_text_console_handle_keysym(QemuTextConsole *s, int keysym)\n static void text_console_update(void *opaque, console_ch_t *chardata)\n {\n QemuTextConsole *s = QEMU_TEXT_CONSOLE(opaque);\n+ QemuVT100 *vt = &s->vt;\n int i, j, src;\n \n- if (s->text_x[0] <= s->text_x[1]) {\n- src = (s->y_base + s->text_y[0]) * s->width;\n- chardata += s->text_y[0] * s->width;\n- for (i = s->text_y[0]; i <= s->text_y[1]; i ++)\n- for (j = 0; j < s->width; j++, src++) {\n+ if (vt->text_x[0] <= vt->text_x[1]) {\n+ src = (vt->y_base + vt->text_y[0]) * vt->width;\n+ chardata += vt->text_y[0] * vt->width;\n+ for (i = vt->text_y[0]; i <= vt->text_y[1]; i ++)\n+ for (j = 0; j < vt->width; j++, src++) {\n console_write_ch(chardata ++,\n- ATTR2CHTYPE(s->cells[src].ch,\n- s->cells[src].t_attrib.fgcol,\n- s->cells[src].t_attrib.bgcol,\n- s->cells[src].t_attrib.bold));\n+ ATTR2CHTYPE(vt->cells[src].ch,\n+ vt->cells[src].t_attrib.fgcol,\n+ vt->cells[src].t_attrib.bgcol,\n+ vt->cells[src].t_attrib.bold));\n }\n- dpy_text_update(QEMU_CONSOLE(s), s->text_x[0], s->text_y[0],\n- s->text_x[1] - s->text_x[0], i - s->text_y[0]);\n- s->text_x[0] = s->width;\n- s->text_y[0] = s->height;\n- s->text_x[1] = 0;\n- s->text_y[1] = 0;\n+ dpy_text_update(QEMU_CONSOLE(s), vt->text_x[0], vt->text_y[0],\n+ vt->text_x[1] - vt->text_x[0], i - vt->text_y[0]);\n+ vt->text_x[0] = vt->width;\n+ vt->text_y[0] = vt->height;\n+ vt->text_x[1] = 0;\n+ vt->text_y[1] = 0;\n }\n- if (s->cursor_invalidate) {\n- dpy_text_cursor(QEMU_CONSOLE(s), s->x, s->y);\n- s->cursor_invalidate = 0;\n+ if (vt->cursor_invalidate) {\n+ dpy_text_cursor(QEMU_CONSOLE(s), vt->x, vt->y);\n+ vt->cursor_invalidate = 0;\n }\n }\n \n@@ -393,76 +403,77 @@ static void text_console_resize(QemuTextConsole *t)\n \n w = surface_width(s->surface) / FONT_WIDTH;\n h = surface_height(s->surface) / FONT_HEIGHT;\n- if (w == t->width && h == t->height) {\n+ if (w == t->vt.width && h == t->vt.height) {\n return;\n }\n \n- last_width = t->width;\n- t->width = w;\n- t->height = h;\n+ last_width = t->vt.width;\n+ t->vt.width = w;\n+ t->vt.height = h;\n \n- w1 = MIN(t->width, last_width);\n+ w1 = MIN(t->vt.width, last_width);\n \n- cells = g_new(TextCell, t->width * t->total_height + 1);\n- for (y = 0; y < t->total_height; y++) {\n- c = &cells[y * t->width];\n+ cells = g_new(TextCell, t->vt.width * t->vt.total_height + 1);\n+ for (y = 0; y < t->vt.total_height; y++) {\n+ c = &cells[y * t->vt.width];\n if (w1 > 0) {\n- c1 = &t->cells[y * last_width];\n+ c1 = &t->vt.cells[y * last_width];\n for (x = 0; x < w1; x++) {\n *c++ = *c1++;\n }\n }\n- for (x = w1; x < t->width; x++) {\n+ for (x = w1; x < t->vt.width; x++) {\n c->ch = ' ';\n c->t_attrib = TEXT_ATTRIBUTES_DEFAULT;\n c++;\n }\n }\n- g_free(t->cells);\n- t->cells = cells;\n+ g_free(t->vt.cells);\n+ t->vt.cells = cells;\n }\n \n static void vc_put_lf(VCChardev *vc)\n {\n QemuTextConsole *s = vc->console;\n+ QemuVT100 *vt = &s->vt;\n TextCell *c;\n int x, y1;\n \n- s->y++;\n- if (s->y >= s->height) {\n- s->y = s->height - 1;\n+ vt->y++;\n+ if (vt->y >= vt->height) {\n+ vt->y = vt->height - 1;\n \n- if (s->y_displayed == s->y_base) {\n- if (++s->y_displayed == s->total_height)\n- s->y_displayed = 0;\n+ if (vt->y_displayed == vt->y_base) {\n+ if (++vt->y_displayed == vt->total_height)\n+ vt->y_displayed = 0;\n }\n- if (++s->y_base == s->total_height)\n- s->y_base = 0;\n- if (s->backscroll_height < s->total_height)\n- s->backscroll_height++;\n- y1 = (s->y_base + s->height - 1) % s->total_height;\n- c = &s->cells[y1 * s->width];\n- for(x = 0; x < s->width; x++) {\n+ if (++vt->y_base == vt->total_height)\n+ vt->y_base = 0;\n+ if (vt->backscroll_height < vt->total_height)\n+ vt->backscroll_height++;\n+ y1 = (vt->y_base + vt->height - 1) % vt->total_height;\n+ c = &vt->cells[y1 * vt->width];\n+ for(x = 0; x < vt->width; x++) {\n c->ch = ' ';\n c->t_attrib = TEXT_ATTRIBUTES_DEFAULT;\n c++;\n }\n- if (s->y_displayed == s->y_base) {\n- s->text_x[0] = 0;\n- s->text_y[0] = 0;\n- s->text_x[1] = s->width - 1;\n- s->text_y[1] = s->height - 1;\n+ if (vt->y_displayed == vt->y_base) {\n+ vt->text_x[0] = 0;\n+ vt->text_y[0] = 0;\n+ vt->text_x[1] = vt->width - 1;\n+ vt->text_y[1] = vt->height - 1;\n \n qemu_console_bitblt(QEMU_CONSOLE(s), 0, FONT_HEIGHT, 0, 0,\n- s->width * FONT_WIDTH,\n- (s->height - 1) * FONT_HEIGHT);\n- qemu_console_fill_rect(QEMU_CONSOLE(s), 0, (s->height - 1) * FONT_HEIGHT,\n- s->width * FONT_WIDTH, FONT_HEIGHT,\n+ vt->width * FONT_WIDTH,\n+ (vt->height - 1) * FONT_HEIGHT);\n+ qemu_console_fill_rect(QEMU_CONSOLE(s), 0, (vt->height - 1) * FONT_HEIGHT,\n+ vt->width * FONT_WIDTH, FONT_HEIGHT,\n color_table_rgb[0][TEXT_ATTRIBUTES_DEFAULT.bgcol]);\n- s->update_x0 = 0;\n- s->update_y0 = 0;\n- s->update_x1 = s->width * FONT_WIDTH;\n- s->update_y1 = s->height * FONT_HEIGHT;\n+ vt->update_x0 = 0;\n+ vt->update_y0 = 0;\n+ vt->update_x1 = vt->width * FONT_WIDTH;\n+ vt->update_y1 = vt->height * FONT_HEIGHT;\n }\n }\n }\n@@ -567,24 +578,25 @@ static void vc_handle_escape(VCChardev *vc)\n static void vc_update_xy(VCChardev *vc, int x, int y)\n {\n QemuTextConsole *s = vc->console;\n+ QemuVT100 *vt = &s->vt;\n TextCell *c;\n int y1, y2;\n \n- s->text_x[0] = MIN(s->text_x[0], x);\n- s->text_x[1] = MAX(s->text_x[1], x);\n- s->text_y[0] = MIN(s->text_y[0], y);\n- s->text_y[1] = MAX(s->text_y[1], y);\n+ vt->text_x[0] = MIN(vt->text_x[0], x);\n+ vt->text_x[1] = MAX(vt->text_x[1], x);\n+ vt->text_y[0] = MIN(vt->text_y[0], y);\n+ vt->text_y[1] = MAX(vt->text_y[1], y);\n \n- y1 = (s->y_base + y) % s->total_height;\n- y2 = y1 - s->y_displayed;\n+ y1 = (vt->y_base + y) % vt->total_height;\n+ y2 = y1 - vt->y_displayed;\n if (y2 < 0) {\n- y2 += s->total_height;\n+ y2 += vt->total_height;\n }\n- if (y2 < s->height) {\n- if (x >= s->width) {\n- x = s->width - 1;\n+ if (y2 < vt->height) {\n+ if (x >= vt->width) {\n+ x = vt->width - 1;\n }\n- c = &s->cells[y1 * s->width + x];\n+ c = &vt->cells[y1 * vt->width + x];\n vga_putcharxy(QEMU_CONSOLE(s), x, y2, c->ch,\n &(c->t_attrib));\n invalidate_xy(s, x, y2);\n@@ -594,11 +606,12 @@ static void vc_update_xy(VCChardev *vc, int x, int y)\n static void vc_clear_xy(VCChardev *vc, int x, int y)\n {\n QemuTextConsole *s = vc->console;\n- int y1 = (s->y_base + y) % s->total_height;\n- if (x >= s->width) {\n- x = s->width - 1;\n+ QemuVT100 *vt = &s->vt;\n+ int y1 = (vt->y_base + y) % vt->total_height;\n+ if (x >= vt->width) {\n+ x = vt->width - 1;\n }\n- TextCell *c = &s->cells[y1 * s->width + x];\n+ TextCell *c = &vt->cells[y1 * vt->width + x];\n c->ch = ' ';\n c->t_attrib = TEXT_ATTRIBUTES_DEFAULT;\n vc_update_xy(vc, x, y);\n@@ -647,19 +660,20 @@ static uint32_t bh_utf8_decode(uint32_t *state, uint32_t *codep, uint32_t byte)\n static void vc_put_one(VCChardev *vc, int ch)\n {\n QemuTextConsole *s = vc->console;\n+ QemuVT100 *vt = &s->vt;\n TextCell *c;\n int y1;\n- if (s->x >= s->width) {\n+ if (vt->x >= vt->width) {\n /* line wrap */\n- s->x = 0;\n+ vt->x = 0;\n vc_put_lf(vc);\n }\n- y1 = (s->y_base + s->y) % s->total_height;\n- c = &s->cells[y1 * s->width + s->x];\n+ y1 = (vt->y_base + vt->y) % vt->total_height;\n+ c = &vt->cells[y1 * vt->width + vt->x];\n c->ch = ch;\n c->t_attrib = vc->t_attrib;\n- vc_update_xy(vc, s->x, s->y);\n- s->x++;\n+ vc_update_xy(vc, vt->x, vt->y);\n+ vt->x++;\n }\n \n static void vc_respond_str(VCChardev *vc, const char *buf)\n@@ -673,6 +687,7 @@ static void vc_respond_str(VCChardev *vc, const char *buf)\n static void vc_set_cursor(VCChardev *vc, int x, int y)\n {\n QemuTextConsole *s = vc->console;\n+ QemuVT100 *vt = &s->vt;\n \n if (x < 0) {\n x = 0;\n@@ -680,15 +695,15 @@ static void vc_set_cursor(VCChardev *vc, int x, int y)\n if (y < 0) {\n y = 0;\n }\n- if (y >= s->height) {\n- y = s->height - 1;\n+ if (y >= vt->height) {\n+ y = vt->height - 1;\n }\n- if (x >= s->width) {\n- x = s->width - 1;\n+ if (x >= vt->width) {\n+ x = vt->width - 1;\n }\n \n- s->x = x;\n- s->y = y;\n+ vt->x = x;\n+ vt->y = y;\n }\n \n /**\n@@ -700,6 +715,7 @@ static void vc_set_cursor(VCChardev *vc, int x, int y)\n static void vc_csi_P(struct VCChardev *vc, unsigned int nr)\n {\n QemuTextConsole *s = vc->console;\n+ QemuVT100 *vt = &s->vt;\n TextCell *c1, *c2;\n unsigned int x1, x2, y;\n unsigned int end, len;\n@@ -707,28 +723,28 @@ static void vc_csi_P(struct VCChardev *vc, unsigned int nr)\n if (!nr) {\n nr = 1;\n }\n- if (nr > s->width - s->x) {\n- nr = s->width - s->x;\n+ if (nr > vt->width - vt->x) {\n+ nr = vt->width - vt->x;\n if (!nr) {\n return;\n }\n }\n \n- x1 = s->x;\n- x2 = s->x + nr;\n- len = s->width - x2;\n+ x1 = vt->x;\n+ x2 = vt->x + nr;\n+ len = vt->width - x2;\n if (len) {\n- y = (s->y_base + s->y) % s->total_height;\n- c1 = &s->cells[y * s->width + x1];\n- c2 = &s->cells[y * s->width + x2];\n+ y = (vt->y_base + vt->y) % vt->total_height;\n+ c1 = &vt->cells[y * vt->width + x1];\n+ c2 = &vt->cells[y * vt->width + x2];\n memmove(c1, c2, len * sizeof(*c1));\n for (end = x1 + len; x1 < end; x1++) {\n- vc_update_xy(vc, x1, s->y);\n+ vc_update_xy(vc, x1, vt->y);\n }\n }\n /* Clear the rest */\n- for (; x1 < s->width; x1++) {\n- vc_clear_xy(vc, x1, s->y);\n+ for (; x1 < vt->width; x1++) {\n+ vc_clear_xy(vc, x1, vt->y);\n }\n }\n \n@@ -741,6 +757,7 @@ static void vc_csi_P(struct VCChardev *vc, unsigned int nr)\n static void vc_csi_at(struct VCChardev *vc, unsigned int nr)\n {\n QemuTextConsole *s = vc->console;\n+ QemuVT100 *vt = &s->vt;\n TextCell *c1, *c2;\n unsigned int x1, x2, y;\n unsigned int end, len;\n@@ -748,28 +765,28 @@ static void vc_csi_at(struct VCChardev *vc, unsigned int nr)\n if (!nr) {\n nr = 1;\n }\n- if (nr > s->width - s->x) {\n- nr = s->width - s->x;\n+ if (nr > vt->width - vt->x) {\n+ nr = vt->width - vt->x;\n if (!nr) {\n return;\n }\n }\n \n- x1 = s->x + nr;\n- x2 = s->x;\n- len = s->width - x1;\n+ x1 = vt->x + nr;\n+ x2 = vt->x;\n+ len = vt->width - x1;\n if (len) {\n- y = (s->y_base + s->y) % s->total_height;\n- c1 = &s->cells[y * s->width + x1];\n- c2 = &s->cells[y * s->width + x2];\n+ y = (vt->y_base + vt->y) % vt->total_height;\n+ c1 = &vt->cells[y * vt->width + x1];\n+ c2 = &vt->cells[y * vt->width + x2];\n memmove(c1, c2, len * sizeof(*c1));\n for (end = x1 + len; x1 < end; x1++) {\n- vc_update_xy(vc, x1, s->y);\n+ vc_update_xy(vc, x1, vt->y);\n }\n }\n /* Insert blanks */\n- for (x1 = s->x; x1 < s->x + nr; x1++) {\n- vc_clear_xy(vc, x1, s->y);\n+ for (x1 = vt->x; x1 < vt->x + nr; x1++) {\n+ vc_clear_xy(vc, x1, vt->y);\n }\n }\n \n@@ -779,9 +796,10 @@ static void vc_csi_at(struct VCChardev *vc, unsigned int nr)\n static void vc_save_cursor(VCChardev *vc)\n {\n QemuTextConsole *s = vc->console;\n+ QemuVT100 *vt = &s->vt;\n \n- vc->x_saved = s->x;\n- vc->y_saved = s->y;\n+ vc->x_saved = vt->x;\n+ vc->y_saved = vt->y;\n vc->t_attrib_saved = vc->t_attrib;\n }\n \n@@ -792,15 +810,17 @@ static void vc_save_cursor(VCChardev *vc)\n static void vc_restore_cursor(VCChardev *vc)\n {\n QemuTextConsole *s = vc->console;\n+ QemuVT100 *vt = &s->vt;\n \n- s->x = vc->x_saved;\n- s->y = vc->y_saved;\n+ vt->x = vc->x_saved;\n+ vt->y = vc->y_saved;\n vc->t_attrib = vc->t_attrib_saved;\n }\n \n static void vc_putchar(VCChardev *vc, int ch)\n {\n QemuTextConsole *s = vc->console;\n+ QemuVT100 *vt = &s->vt;\n int i;\n int x, y;\n g_autofree char *response = NULL;\n@@ -827,21 +847,21 @@ static void vc_putchar(VCChardev *vc, int ch)\n vc->utf8_state = BH_UTF8_ACCEPT;\n switch(ch) {\n case '\\r': /* carriage return */\n- s->x = 0;\n+ vt->x = 0;\n break;\n case '\\n': /* newline */\n vc_put_lf(vc);\n break;\n case '\\b': /* backspace */\n- if (s->x > 0)\n- s->x--;\n+ if (vt->x > 0)\n+ vt->x--;\n break;\n case '\\t': /* tabspace */\n- if (s->x + (8 - (s->x % 8)) > s->width) {\n- s->x = 0;\n+ if (vt->x + (8 - (vt->x % 8)) > vt->width) {\n+ vt->x = 0;\n vc_put_lf(vc);\n } else {\n- s->x = s->x + (8 - (s->x % 8));\n+ vt->x = vt->x + (8 - (vt->x % 8));\n }\n break;\n case '\\a': /* alert aka. bell */\n@@ -909,32 +929,32 @@ static void vc_putchar(VCChardev *vc, int ch)\n if (vc->esc_params[0] == 0) {\n vc->esc_params[0] = 1;\n }\n- vc_set_cursor(vc, s->x, s->y - vc->esc_params[0]);\n+ vc_set_cursor(vc, vt->x, vt->y - vc->esc_params[0]);\n break;\n case 'B':\n /* move cursor down */\n if (vc->esc_params[0] == 0) {\n vc->esc_params[0] = 1;\n }\n- vc_set_cursor(vc, s->x, s->y + vc->esc_params[0]);\n+ vc_set_cursor(vc, vt->x, vt->y + vc->esc_params[0]);\n break;\n case 'C':\n /* move cursor right */\n if (vc->esc_params[0] == 0) {\n vc->esc_params[0] = 1;\n }\n- vc_set_cursor(vc, s->x + vc->esc_params[0], s->y);\n+ vc_set_cursor(vc, vt->x + vc->esc_params[0], vt->y);\n break;\n case 'D':\n /* move cursor left */\n if (vc->esc_params[0] == 0) {\n vc->esc_params[0] = 1;\n }\n- vc_set_cursor(vc, s->x - vc->esc_params[0], s->y);\n+ vc_set_cursor(vc, vt->x - vc->esc_params[0], vt->y);\n break;\n case 'G':\n /* move cursor to column */\n- vc_set_cursor(vc, vc->esc_params[0] - 1, s->y);\n+ vc_set_cursor(vc, vc->esc_params[0] - 1, vt->y);\n break;\n case 'f':\n case 'H':\n@@ -945,9 +965,9 @@ static void vc_putchar(VCChardev *vc, int ch)\n switch (vc->esc_params[0]) {\n case 0:\n /* clear to end of screen */\n- for (y = s->y; y < s->height; y++) {\n- for (x = 0; x < s->width; x++) {\n- if (y == s->y && x < s->x) {\n+ for (y = vt->y; y < vt->height; y++) {\n+ for (x = 0; x < vt->width; x++) {\n+ if (y == vt->y && x < vt->x) {\n continue;\n }\n vc_clear_xy(vc, x, y);\n@@ -956,9 +976,9 @@ static void vc_putchar(VCChardev *vc, int ch)\n break;\n case 1:\n /* clear from beginning of screen */\n- for (y = 0; y <= s->y; y++) {\n- for (x = 0; x < s->width; x++) {\n- if (y == s->y && x > s->x) {\n+ for (y = 0; y <= vt->y; y++) {\n+ for (x = 0; x < vt->width; x++) {\n+ if (y == vt->y && x > vt->x) {\n break;\n }\n vc_clear_xy(vc, x, y);\n@@ -967,8 +987,8 @@ static void vc_putchar(VCChardev *vc, int ch)\n break;\n case 2:\n /* clear entire screen */\n- for (y = 0; y < s->height; y++) {\n- for (x = 0; x < s->width; x++) {\n+ for (y = 0; y < vt->height; y++) {\n+ for (x = 0; x < vt->width; x++) {\n vc_clear_xy(vc, x, y);\n }\n }\n@@ -979,20 +999,20 @@ static void vc_putchar(VCChardev *vc, int ch)\n switch (vc->esc_params[0]) {\n case 0:\n /* clear to eol */\n- for(x = s->x; x < s->width; x++) {\n- vc_clear_xy(vc, x, s->y);\n+ for(x = vt->x; x < vt->width; x++) {\n+ vc_clear_xy(vc, x, vt->y);\n }\n break;\n case 1:\n /* clear from beginning of line */\n- for (x = 0; x <= s->x && x < s->width; x++) {\n- vc_clear_xy(vc, x, s->y);\n+ for (x = 0; x <= vt->x && x < vt->width; x++) {\n+ vc_clear_xy(vc, x, vt->y);\n }\n break;\n case 2:\n /* clear entire line */\n- for(x = 0; x < s->width; x++) {\n- vc_clear_xy(vc, x, s->y);\n+ for(x = 0; x < vt->width; x++) {\n+ vc_clear_xy(vc, x, vt->y);\n }\n break;\n }\n@@ -1012,7 +1032,7 @@ static void vc_putchar(VCChardev *vc, int ch)\n case 6:\n /* report cursor position */\n response = g_strdup_printf(\"\\033[%d;%dR\",\n- s->y + 1, s->x + 1);\n+ vt->y + 1, vt->x + 1);\n vc_respond_str(vc, response);\n break;\n }\n@@ -1063,21 +1083,22 @@ static int vc_chr_write(Chardev *chr, const uint8_t *buf, int len)\n {\n VCChardev *drv = VC_CHARDEV(chr);\n QemuTextConsole *s = drv->console;\n+ QemuVT100 *vt = &s->vt;\n int i;\n \n- s->update_x0 = s->width * FONT_WIDTH;\n- s->update_y0 = s->height * FONT_HEIGHT;\n- s->update_x1 = 0;\n- s->update_y1 = 0;\n+ vt->update_x0 = vt->width * FONT_WIDTH;\n+ vt->update_y0 = vt->height * FONT_HEIGHT;\n+ vt->update_x1 = 0;\n+ vt->update_y1 = 0;\n console_show_cursor(s, 0);\n for(i = 0; i < len; i++) {\n vc_putchar(drv, buf[i]);\n }\n console_show_cursor(s, 1);\n- if (s->update_x0 < s->update_x1) {\n- dpy_gfx_update(QEMU_CONSOLE(s), s->update_x0, s->update_y0,\n- s->update_x1 - s->update_x0,\n- s->update_y1 - s->update_y0);\n+ if (vt->update_x0 < vt->update_x1) {\n+ dpy_gfx_update(QEMU_CONSOLE(s), vt->update_x0, vt->update_y0,\n+ vt->update_x1 - vt->update_x0,\n+ vt->update_y1 - vt->update_y0);\n }\n return len;\n }\n@@ -1136,7 +1157,7 @@ qemu_text_console_init(Object *obj)\n QemuTextConsole *c = QEMU_TEXT_CONSOLE(obj);\n \n fifo8_create(&c->out_fifo, 16);\n- c->total_height = DEFAULT_BACKSCROLL;\n+ c->vt.total_height = DEFAULT_BACKSCROLL;\n QEMU_CONSOLE(c)->hw_ops = &text_console_ops;\n QEMU_CONSOLE(c)->hw = c;\n }\n@@ -1167,12 +1188,12 @@ static void vc_chr_set_echo(Chardev *chr, bool echo)\n {\n VCChardev *drv = VC_CHARDEV(chr);\n \n- drv->console->echo = echo;\n+ drv->console->vt.echo = echo;\n }\n \n void qemu_text_console_update_size(QemuTextConsole *c)\n {\n- dpy_text_resize(QEMU_CONSOLE(c), c->width, c->height);\n+ dpy_text_resize(QEMU_CONSOLE(c), c->vt.width, c->vt.height);\n }\n \n static bool vc_chr_open(Chardev *chr, ChardevBackend *backend, Error **errp)\n", "prefixes": [ "v2", "13/67" ] }