From nobody Thu Nov 28 09:44:14 2024 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693828867; cv=none; d=zohomail.com; s=zohoarc; b=YteLAcU4RsoQmeOz0T+hURAwlfJ6/cXNglPaQZLLCZlZ/5AE82f2WDGBOVodaHfGbvvTL9ELD/jzjZ5x+l18Qcl/zfEb4lkYp3q7BlXKGc4cO4HJjfVnnyWtLsp6vcn0kDTcRz7MdfaplfJ4Z/YsKb2RgwrxU/eHZ/9qYKcxNHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693828867; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Y6wwnPZZJQ4gfCAMJ0lW4JSTVJuLwQHSYqyf0Q1vzN4=; b=f2qYhYFf7C6OxUAVTHMi7xXqUumpvyVrc92O1x2PWSeB2DUwX+MmBQFNGR+ixOheiSuaHkT0ZvkyUq2GeuedK+vNL550qYPuMnvu2AvPecfQuMsABU9fUtqR5HupHVbhKfMqQDndhcVJSBDJEdqSrB7Mgi+USd0+R/ZGi2aNAoY= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693828867271844.8222147051588; Mon, 4 Sep 2023 05:01:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd8AQ-0004kP-Tc; Mon, 04 Sep 2023 07:54:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qd8AL-0004Nr-Kz for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:51 -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 1qd8AI-0000IC-MN for qemu-devel@nongnu.org; Mon, 04 Sep 2023 07:54:49 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-546-REepFEZeM0eEjMLBsKzORg-1; Mon, 04 Sep 2023 07:54:44 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6C5B92999B38 for ; Mon, 4 Sep 2023 11:54:44 +0000 (UTC) Received: from localhost (unknown [10.39.208.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A798140E963; Mon, 4 Sep 2023 11:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693828486; 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=Y6wwnPZZJQ4gfCAMJ0lW4JSTVJuLwQHSYqyf0Q1vzN4=; b=e3CmhYeJWN8/0DPsv+Yd207Rnjw8+9Gjb1MbWQ0CODrsrSbT/a1dXC9+r5VbyBXu3hy23k Hxvp1w/mVgKbiqaYBteliIVbYEJGYIfsdr/pSNH88kAD3UutKW/79TocMjLrlOstrzoWCL r/isJpIytksFRxUSDCtCcThcl040AZU= X-MC-Unique: REepFEZeM0eEjMLBsKzORg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 28/52] ui/vc: move text fields to QemuTextConsole Date: Mon, 4 Sep 2023 15:52:25 +0400 Message-ID: <20230904115251.4161397-29-marcandre.lureau@redhat.com> In-Reply-To: <20230904115251.4161397-1-marcandre.lureau@redhat.com> References: <20230904115251.4161397-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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: 1693828867610100002 From: Marc-Andr=C3=A9 Lureau Now we can instantiate the specific console with its own fields. Pass the most appropriate type to the various functions, and cast up to QEMU_CONSOLE as necessary. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230830093843.3531473-29-marcandre.lureau@redhat.com> --- ui/console.c | 177 ++++++++++++++++++++++++++------------------------- 1 file changed, 91 insertions(+), 86 deletions(-) diff --git a/ui/console.c b/ui/console.c index 3cd4c74eec..335d7ba841 100644 --- a/ui/console.c +++ b/ui/console.c @@ -94,26 +94,6 @@ struct QemuConsole { const GraphicHwOps *hw_ops; void *hw; =20 - /* Text console state */ - int width; - int height; - int total_height; - int backscroll_height; - int x, y; - int y_displayed; - int y_base; - TextCell *cells; - int text_x[2], text_y[2], cursor_invalidate; - int echo; - - int update_x0; - int update_y0; - int update_x1; - int update_y1; - - Chardev *chr; - /* fifo for key pressed */ - Fifo8 out_fifo; CoQueue dump_queue; =20 QTAILQ_ENTRY(QemuConsole) next; @@ -136,6 +116,26 @@ OBJECT_DEFINE_TYPE(QemuGraphicConsole, qemu_graphic_co= nsole, QEMU_GRAPHIC_CONSOL =20 typedef struct QemuTextConsole { QemuConsole parent; + + int width; + int height; + int total_height; + int backscroll_height; + int x, y; + int y_displayed; + int y_base; + TextCell *cells; + int text_x[2], text_y[2], cursor_invalidate; + int echo; + + int update_x0; + int update_y0; + int update_x1; + int update_y1; + + Chardev *chr; + /* fifo for key pressed */ + Fifo8 out_fifo; } QemuTextConsole; =20 typedef QemuConsoleClass QemuTextConsoleClass; @@ -162,7 +162,7 @@ OBJECT_DEFINE_TYPE(QemuFixedTextConsole, qemu_fixed_tex= t_console, QEMU_FIXED_TEX =20 struct VCChardev { Chardev parent; - QemuConsole *console; + QemuTextConsole *console; =20 enum TTYState state; int esc_params[MAX_ESC_PARAMS]; @@ -428,43 +428,44 @@ static void vga_putcharxy(QemuConsole *s, int x, int = y, int ch, &fgcol, &bgcol, x, y, FONT_WIDTH, FONT_HEIGHT= ); } =20 -static void text_console_resize(QemuConsole *s) +static void text_console_resize(QemuTextConsole *t) { + QemuConsole *s =3D QEMU_CONSOLE(t); TextCell *cells, *c, *c1; int w1, x, y, last_width; =20 assert(s->scanout.kind =3D=3D SCANOUT_SURFACE); =20 - last_width =3D s->width; - s->width =3D surface_width(s->surface) / FONT_WIDTH; - s->height =3D surface_height(s->surface) / FONT_HEIGHT; + last_width =3D t->width; + t->width =3D surface_width(s->surface) / FONT_WIDTH; + t->height =3D surface_height(s->surface) / FONT_HEIGHT; =20 w1 =3D last_width; - if (s->width < w1) - w1 =3D s->width; + if (t->width < w1) + w1 =3D t->width; =20 - cells =3D g_new(TextCell, s->width * s->total_height + 1); - for(y =3D 0; y < s->total_height; y++) { - c =3D &cells[y * s->width]; + cells =3D g_new(TextCell, t->width * t->total_height + 1); + for(y =3D 0; y < t->total_height; y++) { + c =3D &cells[y * t->width]; if (w1 > 0) { - c1 =3D &s->cells[y * last_width]; + c1 =3D &t->cells[y * last_width]; for(x =3D 0; x < w1; x++) { *c++ =3D *c1++; } } - for(x =3D w1; x < s->width; x++) { + for(x =3D w1; x < t->width; x++) { c->ch =3D ' '; c->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; c++; } } - g_free(s->cells); - s->cells =3D cells; + g_free(t->cells); + t->cells =3D cells; } =20 -static void invalidate_xy(QemuConsole *s, int x, int y) +static void invalidate_xy(QemuTextConsole *s, int x, int y) { - if (!qemu_console_is_visible(s)) { + if (!qemu_console_is_visible(QEMU_CONSOLE(s))) { return; } if (s->update_x0 > x * FONT_WIDTH) @@ -479,7 +480,7 @@ static void invalidate_xy(QemuConsole *s, int x, int y) =20 static void vc_update_xy(VCChardev *vc, int x, int y) { - QemuConsole *s =3D vc->console; + QemuTextConsole *s =3D vc->console; TextCell *c; int y1, y2; =20 @@ -498,13 +499,13 @@ static void vc_update_xy(VCChardev *vc, int x, int y) x =3D s->width - 1; } c =3D &s->cells[y1 * s->width + x]; - vga_putcharxy(s, x, y2, c->ch, + vga_putcharxy(QEMU_CONSOLE(s), x, y2, c->ch, &(c->t_attrib)); invalidate_xy(s, x, y2); } } =20 -static void console_show_cursor(QemuConsole *s, int show) +static void console_show_cursor(QemuTextConsole *s, int show) { TextCell *c; int y, y1; @@ -525,17 +526,17 @@ static void console_show_cursor(QemuConsole *s, int s= how) if (show && cursor_visible_phase) { TextAttributes t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; t_attrib.invers =3D !(t_attrib.invers); /* invert fg and bg */ - vga_putcharxy(s, x, y, c->ch, &t_attrib); + vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, &t_attrib); } else { - vga_putcharxy(s, x, y, c->ch, &(c->t_attrib)); + vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, &(c->t_attrib)); } invalidate_xy(s, x, y); } } =20 -static void console_refresh(QemuConsole *s) +static void console_refresh(QemuTextConsole *s) { - DisplaySurface *surface =3D qemu_console_surface(s); + DisplaySurface *surface =3D qemu_console_surface(QEMU_CONSOLE(s)); TextCell *c; int x, y, y1; =20 @@ -545,13 +546,13 @@ static void console_refresh(QemuConsole *s) s->text_y[1] =3D s->height - 1; s->cursor_invalidate =3D 1; =20 - vga_fill_rect(s, 0, 0, surface_width(surface), surface_height(surface), + vga_fill_rect(QEMU_CONSOLE(s), 0, 0, surface_width(surface), surface_h= eight(surface), color_table_rgb[0][QEMU_COLOR_BLACK]); y1 =3D s->y_displayed; for (y =3D 0; y < s->height; y++) { c =3D s->cells + y1 * s->width; for (x =3D 0; x < s->width; x++) { - vga_putcharxy(s, x, y, c->ch, + vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, &(c->t_attrib)); c++; } @@ -560,11 +561,11 @@ static void console_refresh(QemuConsole *s) } } console_show_cursor(s, 1); - dpy_gfx_update(s, 0, 0, + dpy_gfx_update(QEMU_CONSOLE(s), 0, 0, surface_width(surface), surface_height(surface)); } =20 -static void console_scroll(QemuConsole *s, int ydelta) +static void console_scroll(QemuTextConsole *s, int ydelta) { int i, y1; =20 @@ -595,7 +596,7 @@ static void console_scroll(QemuConsole *s, int ydelta) =20 static void vc_put_lf(VCChardev *vc) { - QemuConsole *s =3D vc->console; + QemuTextConsole *s =3D vc->console; TextCell *c; int x, y1; =20 @@ -624,10 +625,10 @@ static void vc_put_lf(VCChardev *vc) s->text_x[1] =3D s->width - 1; s->text_y[1] =3D s->height - 1; =20 - vga_bitblt(s, 0, FONT_HEIGHT, 0, 0, + vga_bitblt(QEMU_CONSOLE(s), 0, FONT_HEIGHT, 0, 0, s->width * FONT_WIDTH, (s->height - 1) * FONT_HEIGHT); - vga_fill_rect(s, 0, (s->height - 1) * FONT_HEIGHT, + vga_fill_rect(QEMU_CONSOLE(s), 0, (s->height - 1) * FONT_HEIGH= T, s->width * FONT_WIDTH, FONT_HEIGHT, color_table_rgb[0][TEXT_ATTRIBUTES_DEFAULT.bgcol= ]); s->update_x0 =3D 0; @@ -737,7 +738,7 @@ static void vc_handle_escape(VCChardev *vc) =20 static void vc_clear_xy(VCChardev *vc, int x, int y) { - QemuConsole *s =3D vc->console; + QemuTextConsole *s =3D vc->console; int y1 =3D (s->y_base + y) % s->total_height; if (x >=3D s->width) { x =3D s->width - 1; @@ -750,7 +751,7 @@ static void vc_clear_xy(VCChardev *vc, int x, int y) =20 static void vc_put_one(VCChardev *vc, int ch) { - QemuConsole *s =3D vc->console; + QemuTextConsole *s =3D vc->console; TextCell *c; int y1; if (s->x >=3D s->width) { @@ -777,7 +778,7 @@ static void vc_respond_str(VCChardev *vc, const char *b= uf) /* set cursor, checking bounds */ static void vc_set_cursor(VCChardev *vc, int x, int y) { - QemuConsole *s =3D vc->console; + QemuTextConsole *s =3D vc->console; =20 if (x < 0) { x =3D 0; @@ -798,7 +799,7 @@ static void vc_set_cursor(VCChardev *vc, int x, int y) =20 static void vc_putchar(VCChardev *vc, int ch) { - QemuConsole *s =3D vc->console; + QemuTextConsole *s =3D vc->console; int i; int x, y; char response[40]; @@ -1095,8 +1096,11 @@ void console_select(unsigned int index) } displaychangelistener_display_console(dcl, s, NULL); } - dpy_text_resize(s, s->width, s->height); - text_console_update_cursor(NULL); + + if (QEMU_IS_TEXT_CONSOLE(s)) { + dpy_text_resize(s, QEMU_TEXT_CONSOLE(s)->width, QEMU_TEXT_CONS= OLE(s)->height); + text_console_update_cursor(NULL); + } } } =20 @@ -1107,7 +1111,7 @@ DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV, static int vc_chr_write(Chardev *chr, const uint8_t *buf, int len) { VCChardev *drv =3D VC_CHARDEV(chr); - QemuConsole *s =3D drv->console; + QemuTextConsole *s =3D drv->console; int i; =20 s->update_x0 =3D s->width * FONT_WIDTH; @@ -1120,14 +1124,14 @@ static int vc_chr_write(Chardev *chr, const uint8_t= *buf, int len) } console_show_cursor(s, 1); if (s->update_x0 < s->update_x1) { - dpy_gfx_update(s, s->update_x0, s->update_y0, + dpy_gfx_update(QEMU_CONSOLE(s), s->update_x0, s->update_y0, s->update_x1 - s->update_x0, s->update_y1 - s->update_y0); } return len; } =20 -static void kbd_send_chars(QemuConsole *s) +static void kbd_send_chars(QemuTextConsole *s) { uint32_t len, avail; =20 @@ -1145,13 +1149,14 @@ static void kbd_send_chars(QemuConsole *s) } =20 /* called when an ascii key is pressed */ -void kbd_put_keysym_console(QemuConsole *s, int keysym) +void kbd_put_keysym_console(QemuConsole *con, int keysym) { + QemuTextConsole *s =3D (QemuTextConsole *)object_dynamic_cast(OBJECT(c= on), TYPE_QEMU_TEXT_CONSOLE); uint8_t buf[16], *q; int c; uint32_t num_free; =20 - if (!s || QEMU_IS_GRAPHIC_CONSOLE(s)) + if (!s) return; =20 switch(keysym) { @@ -1251,17 +1256,17 @@ void kbd_put_keysym(int keysym) =20 static void text_console_invalidate(void *opaque) { - QemuConsole *s =3D (QemuConsole *) opaque; + QemuTextConsole *s =3D QEMU_TEXT_CONSOLE(opaque); =20 - if (QEMU_IS_TEXT_CONSOLE(s) && !QEMU_IS_FIXED_TEXT_CONSOLE(s)) { - text_console_resize(s); + if (!QEMU_IS_FIXED_TEXT_CONSOLE(s)) { + text_console_resize(QEMU_TEXT_CONSOLE(s)); } console_refresh(s); } =20 static void text_console_update(void *opaque, console_ch_t *chardata) { - QemuConsole *s =3D (QemuConsole *) opaque; + QemuTextConsole *s =3D QEMU_TEXT_CONSOLE(opaque); int i, j, src; =20 if (s->text_x[0] <=3D s->text_x[1]) { @@ -1275,7 +1280,7 @@ static void text_console_update(void *opaque, console= _ch_t *chardata) s->cells[src].t_attrib.bgcol, s->cells[src].t_attrib.bold)); } - dpy_text_update(s, s->text_x[0], s->text_y[0], + dpy_text_update(QEMU_CONSOLE(s), s->text_x[0], s->text_y[0], s->text_x[1] - s->text_x[0], i - s->text_y[0]); s->text_x[0] =3D s->width; s->text_y[0] =3D s->height; @@ -1283,7 +1288,7 @@ static void text_console_update(void *opaque, console= _ch_t *chardata) s->text_y[1] =3D 0; } if (s->cursor_invalidate) { - dpy_text_cursor(s, s->x, s->y); + dpy_text_cursor(QEMU_CONSOLE(s), s->x, s->y); s->cursor_invalidate =3D 0; } } @@ -2399,12 +2404,14 @@ char *qemu_console_get_label(QemuConsole *con) } } return g_strdup("VGA"); - } else { - if (con->chr && con->chr->label) { - return g_strdup(con->chr->label); + } else if (QEMU_IS_TEXT_CONSOLE(con)) { + QemuTextConsole *c =3D QEMU_TEXT_CONSOLE(con); + if (c->chr && c->chr->label) { + return g_strdup(c->chr->label); } - return g_strdup_printf("vc%d", con->index); } + + return g_strdup_printf("vc%d", con->index); } =20 int qemu_console_get_index(QemuConsole *con) @@ -2466,17 +2473,15 @@ int qemu_console_get_height(QemuConsole *con, int f= allback) static void vc_chr_accept_input(Chardev *chr) { VCChardev *drv =3D VC_CHARDEV(chr); - QemuConsole *s =3D drv->console; =20 - kbd_send_chars(s); + kbd_send_chars(drv->console); } =20 static void vc_chr_set_echo(Chardev *chr, bool echo) { VCChardev *drv =3D VC_CHARDEV(chr); - QemuConsole *s =3D drv->console; =20 - s->echo =3D echo; + drv->console->echo =3D echo; } =20 static void text_console_update_cursor_timer(void) @@ -2514,7 +2519,7 @@ static const GraphicHwOps text_console_ops =3D { static void text_console_do_init(Chardev *chr) { VCChardev *drv =3D VC_CHARDEV(chr); - QemuConsole *s =3D drv->console; + QemuTextConsole *s =3D drv->console; int g_width =3D 80 * FONT_WIDTH; int g_height =3D 24 * FONT_HEIGHT; =20 @@ -2525,17 +2530,17 @@ static void text_console_do_init(Chardev *chr) s->total_height =3D DEFAULT_BACKSCROLL; s->x =3D 0; s->y =3D 0; - if (s->scanout.kind !=3D SCANOUT_SURFACE) { + if (QEMU_CONSOLE(s)->scanout.kind !=3D SCANOUT_SURFACE) { if (active_console && active_console->scanout.kind =3D=3D SCANOUT_= SURFACE) { g_width =3D qemu_console_get_width(active_console, g_width); g_height =3D qemu_console_get_height(active_console, g_height); } - s->surface =3D qemu_create_displaysurface(g_width, g_height); - s->scanout.kind =3D SCANOUT_SURFACE; + QEMU_CONSOLE(s)->surface =3D qemu_create_displaysurface(g_width, g= _height); + QEMU_CONSOLE(s)->scanout.kind =3D SCANOUT_SURFACE; } =20 - s->hw_ops =3D &text_console_ops; - s->hw =3D s; + QEMU_CONSOLE(s)->hw_ops =3D &text_console_ops; + QEMU_CONSOLE(s)->hw =3D s; =20 /* set current text attributes to default */ drv->t_attrib =3D TEXT_ATTRIBUTES_DEFAULT; @@ -2561,7 +2566,7 @@ static void vc_chr_open(Chardev *chr, { ChardevVC *vc =3D backend->u.vc.data; VCChardev *drv =3D VC_CHARDEV(chr); - QemuConsole *s; + QemuTextConsole *s; unsigned width =3D 0; unsigned height =3D 0; =20 @@ -2579,11 +2584,11 @@ static void vc_chr_open(Chardev *chr, =20 trace_console_txt_new(width, height); if (width =3D=3D 0 || height =3D=3D 0) { - s =3D (QemuConsole *)object_new(TYPE_QEMU_TEXT_CONSOLE); + s =3D QEMU_TEXT_CONSOLE(object_new(TYPE_QEMU_TEXT_CONSOLE)); } else { - s =3D (QemuConsole *)object_new(TYPE_QEMU_FIXED_TEXT_CONSOLE); - s->scanout.kind =3D SCANOUT_SURFACE; - s->surface =3D qemu_create_displaysurface(width, height); + s =3D QEMU_TEXT_CONSOLE(object_new(TYPE_QEMU_FIXED_TEXT_CONSOLE)); + QEMU_CONSOLE(s)->scanout.kind =3D SCANOUT_SURFACE; + QEMU_CONSOLE(s)->surface =3D qemu_create_displaysurface(width, hei= ght); } =20 s->chr =3D chr; --=20 2.41.0