From nobody Sat Apr 11 13:56:04 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=1775849189; cv=none; d=zohomail.com; s=zohoarc; b=B3UthcjF0hxb2fKOLDlZzDJ52Q88bi22cX/EpHWg60qUwVYWsqxTEgRlJ/NxM+YTX62wy/AsrK3Ti4fg2OsIl1fd//Mf0B2TA12wgM9u0HW1TyXo4OO00+XPXmsPIiKDiyNssSeqDUV256Qp3nLNO63dyVNWlBqGN0PUfNR0Hig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775849189; 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=W8WmhM62vcjlMfIWeknYsUyZb9ok8DBEJ8pMwnWqNZk=; b=hKaWYGADN6E7DpWd0Efo5znV9jQF4niRZi73KZJ5uP3ywUmid1QvyB4p/hjLqJmaJglcDN9alw1LMpoMCnORAW6G8KO+XlcAQOrnxuNo7SacSJHMBwYHXng6DaRT0wXilhJqkqn/wQO3UIREtFG5LcOin2YG0SyyB58avBegDTw= 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 1775849189275604.8940374070171; Fri, 10 Apr 2026 12:26:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wBHQS-0002NZ-0t; Fri, 10 Apr 2026 15:21:56 -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 1wBHQP-0001x7-Rs for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:21:53 -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 1wBHQN-0001mJ-SX for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:21:53 -0400 Received: from mx-prod-mc-05.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-610-FmmBAiSbMoSOL0urhiJNYw-1; Fri, 10 Apr 2026 15:21:48 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 218051956088 for ; Fri, 10 Apr 2026 19:21:48 +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 D8A17180049F; Fri, 10 Apr 2026 19:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775848911; 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=W8WmhM62vcjlMfIWeknYsUyZb9ok8DBEJ8pMwnWqNZk=; b=AH6CX3QkvOC3ozdFKMRLVrfv3WRLwm8Lnl6xBv/vjc3fGoQiadjAUf7lz+YdUF26aki9dK p7pw2A+UCEJdxqpRoeMzu1qgUJocHztobJ2WHoCaWqqGLSd/jZ9exEZ8RFjtOm1UdA0OOe DL3Gn6cmgnq5gNqJ/r3a0nF1ZZa/MGU= X-MC-Unique: FmmBAiSbMoSOL0urhiJNYw-1 X-Mimecast-MFC-AGG-ID: FmmBAiSbMoSOL0urhiJNYw_1775848908 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 10 Apr 2026 23:18:51 +0400 Subject: [PATCH v2 29/67] ui/console: remove console_ch_t typedef and console_write_ch() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260410-qemu-vnc-v2-29-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?= X-Developer-Signature: v=1; a=openpgp-sha256; l=10951; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=TFoUqmf0MRQP1GY4HXtM1qmABrYOg9lFPh2W1ZlgYQE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBp2U0VuTQ6eLEqSkAwpuBAjf2MRQycpgVk7jnxy vCbwxS9ddGJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCadlNFQAKCRDa6OEJdZac 5aC7EACxDdrbsbhfwiaHpj2NtGrEFgC3pfc34bdKMX+Oivwdv31KTFosV+6rCsUiCVOLRcvJQDn +30zmuf9gbkLUi65RRU7U6a2pooCHeM0uDLlqsS1xr4aQo7NE2VQ3mPplC+4iGuhFmg2/v1WPbM dPay863O29wkZYb5x3K/mb82d/cAHRB/KRBrFPF4+Z8g/9WGByUvamK/PdPVz9elD11Gj9rVbDF RfPu4iCp64AzEh0nkRc8nDLfD3Jg0oWPFpAJLCNn/mRfG476h5h7Ure/742AOi2L2u1eAI4PboR 2F422hGN2nSUw3lmfqI4eZ75PBkS6dfL3zPVvzh8JYthcHWVmR///4iW9SZd165JTNx8ObBukQv nnBIeQYqoffPJYo9a++EmWtzkp3TpFZjlK9KS/mF31P5CBJLEkeapFiAKVTDZ3ewXcnVUN6Y8AG rqd7u5qp82DWl4WkPpY4WMuUQPE00y0A2F/+Z3mMGkCN0dgKRwQd4Y2gsPWAZCo8sLWSh16SG1l o/ngf6mxHzo+9VD9g6408iLj5xfa6oL0Pjv531GciB5+BvhCKXvEdM9MM+pqfKKjT30m+XSKPbL x2NgQOQ0ORrP3XMeMfIfWCe3ovDg7GYCNfTLX2Aw6WXVfv7qJGpkBCJlfzq8CoTkW59Uw5eGxAo TZosQnysXe0pPIA== 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: 1775849190918158500 Since commit e2f82e924d05 ("console: purge curses bits from console.h"), console_ch_t is a plain uint32_t typedef and console_write_ch() is a trivial assignment (*dest =3D ch). These abstractions were originally needed because console_ch_t was the curses chtype when CONFIG_CURSES was enabled, and console_write_ch() handled VGA-to-curses character translation. That commit moved the curses logic into curses_update(), making the typedef and helper dead abstractions. Replace console_ch_t with uint32_t and console_write_ch() calls with direct assignments. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/console.h | 11 ++--------- hw/display/jazz_led.c | 10 +++++----- hw/display/vga.c | 16 ++++++++-------- hw/display/virtio-gpu-base.c | 2 +- hw/display/virtio-vga.c | 2 +- hw/display/vmware_vga.c | 2 +- ui/console-vc.c | 11 +++++------ ui/console.c | 2 +- ui/curses.c | 6 +++--- 9 files changed, 27 insertions(+), 35 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 5b5bba46ec2..75cd48ed7ad 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -350,13 +350,6 @@ int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGLCo= ntext ctx); =20 bool console_has_gl(QemuConsole *con); =20 -typedef uint32_t console_ch_t; - -static inline void console_write_ch(console_ch_t *dest, uint32_t ch) -{ - *dest =3D ch; -} - enum { GRAPHIC_FLAGS_NONE =3D 0, /* require a console/display with GL callbacks */ @@ -370,7 +363,7 @@ typedef struct GraphicHwOps { void (*invalidate)(void *opaque); void (*gfx_update)(void *opaque); bool gfx_update_async; /* if true, calls graphic_hw_update_done() */ - void (*text_update)(void *opaque, console_ch_t *text); + void (*text_update)(void *opaque, uint32_t *text); void (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info); void (*gl_block)(void *opaque, bool block); } GraphicHwOps; @@ -386,7 +379,7 @@ void graphic_console_close(QemuConsole *con); void graphic_hw_update(QemuConsole *con); void graphic_hw_update_done(QemuConsole *con); void graphic_hw_invalidate(QemuConsole *con); -void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata); +void graphic_hw_text_update(QemuConsole *con, uint32_t *chardata); void graphic_hw_gl_block(QemuConsole *con, bool block); =20 void qemu_console_early_init(void); diff --git a/hw/display/jazz_led.c b/hw/display/jazz_led.c index 9d62e51bed9..d5783982950 100644 --- a/hw/display/jazz_led.c +++ b/hw/display/jazz_led.c @@ -226,7 +226,7 @@ static void jazz_led_invalidate_display(void *opaque) s->state |=3D REDRAW_SEGMENTS | REDRAW_BACKGROUND; } =20 -static void jazz_led_text_update(void *opaque, console_ch_t *chardata) +static void jazz_led_text_update(void *opaque, uint32_t *chardata) { LedState *s =3D opaque; char buf[3]; @@ -236,10 +236,10 @@ static void jazz_led_text_update(void *opaque, consol= e_ch_t *chardata) =20 /* TODO: draw the segments */ snprintf(buf, 3, "%02hhx", s->segments); - console_write_ch(chardata++, ATTR2CHTYPE(buf[0], QEMU_COLOR_BLUE, - QEMU_COLOR_BLACK, 1)); - console_write_ch(chardata++, ATTR2CHTYPE(buf[1], QEMU_COLOR_BLUE, - QEMU_COLOR_BLACK, 1)); + *chardata++ =3D ATTR2CHTYPE(buf[0], QEMU_COLOR_BLUE, + QEMU_COLOR_BLACK, 1); + *chardata++ =3D ATTR2CHTYPE(buf[1], QEMU_COLOR_BLUE, + QEMU_COLOR_BLACK, 1); =20 dpy_text_update(s->con, 0, 0, 2, 1); } diff --git a/hw/display/vga.c b/hw/display/vga.c index ee7d97b5c21..36cfc59a74e 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -1899,13 +1899,13 @@ static void vga_reset(void *opaque) ((v & 0x00000800) << 10) | ((v & 0x00007000) >> 1)) /* relay text rendering to the display driver * instead of doing a full vga_update_display() */ -static void vga_update_text(void *opaque, console_ch_t *chardata) +static void vga_update_text(void *opaque, uint32_t *chardata) { VGACommonState *s =3D opaque; int graphic_mode, i, cursor_offset, cursor_visible; int cw, cheight, width, height, size, c_min, c_max; uint32_t *src; - console_ch_t *dst, val; + uint32_t *dst, val; char msg_buffer[80]; int full_update =3D 0; =20 @@ -2005,14 +2005,14 @@ static void vga_update_text(void *opaque, console_c= h_t *chardata) =20 if (full_update) { for (i =3D 0; i < size; src ++, dst ++, i ++) - console_write_ch(dst, VMEM2CHTYPE(le32_to_cpu(*src))); + *dst =3D VMEM2CHTYPE(le32_to_cpu(*src)); =20 dpy_text_update(s->con, 0, 0, width, height); } else { c_max =3D 0; =20 for (i =3D 0; i < size; src ++, dst ++, i ++) { - console_write_ch(&val, VMEM2CHTYPE(le32_to_cpu(*src))); + val =3D VMEM2CHTYPE(le32_to_cpu(*src)); if (*dst !=3D val) { *dst =3D val; c_max =3D i; @@ -2021,7 +2021,7 @@ static void vga_update_text(void *opaque, console_ch_= t *chardata) } c_min =3D i; for (; i < size; src ++, dst ++, i ++) { - console_write_ch(&val, VMEM2CHTYPE(le32_to_cpu(*src))); + val =3D VMEM2CHTYPE(le32_to_cpu(*src)); if (*dst !=3D val) { *dst =3D val; c_max =3D i; @@ -2059,14 +2059,14 @@ static void vga_update_text(void *opaque, console_c= h_t *chardata) dpy_text_resize(s->con, s->last_width, height); =20 for (dst =3D chardata, i =3D 0; i < s->last_width * height; i ++) - console_write_ch(dst ++, ' '); + *dst++ =3D ' '; =20 size =3D strlen(msg_buffer); width =3D (s->last_width - size) / 2; dst =3D chardata + s->last_width + width; for (i =3D 0; i < size; i ++) - console_write_ch(dst ++, ATTR2CHTYPE(msg_buffer[i], QEMU_COLOR_BLU= E, - QEMU_COLOR_BLACK, 1)); + *dst++ =3D ATTR2CHTYPE(msg_buffer[i], QEMU_COLOR_BLUE, + QEMU_COLOR_BLACK, 1); =20 dpy_text_update(s->con, 0, 0, s->last_width, height); } diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index cb76302e2d8..7b107509510 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -87,7 +87,7 @@ static void virtio_gpu_update_display(void *opaque) { } =20 -static void virtio_gpu_text_update(void *opaque, console_ch_t *chardata) +static void virtio_gpu_text_update(void *opaque, uint32_t *chardata) { } =20 diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index 5e087169f2f..02fb36b31fc 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -31,7 +31,7 @@ static void virtio_vga_base_update_display(void *opaque) } } =20 -static void virtio_vga_base_text_update(void *opaque, console_ch_t *charda= ta) +static void virtio_vga_base_text_update(void *opaque, uint32_t *chardata) { VirtIOVGABase *vvga =3D opaque; VirtIOGPUBase *g =3D vvga->vgpu; diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index c2c6bc76e90..1e154e7f99e 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -1183,7 +1183,7 @@ static void vmsvga_invalidate_display(void *opaque) s->invalidated =3D 1; } =20 -static void vmsvga_text_update(void *opaque, console_ch_t *chardata) +static void vmsvga_text_update(void *opaque, uint32_t *chardata) { struct vmsvga_state_s *s =3D opaque; =20 diff --git a/ui/console-vc.c b/ui/console-vc.c index 84944f845e1..d58917c1850 100644 --- a/ui/console-vc.c +++ b/ui/console-vc.c @@ -381,7 +381,7 @@ void qemu_text_console_handle_keysym(QemuTextConsole *s= , int keysym) vt100_keysym(&s->vt, keysym); } =20 -static void text_console_update(void *opaque, console_ch_t *chardata) +static void text_console_update(void *opaque, uint32_t *chardata) { QemuTextConsole *s =3D QEMU_TEXT_CONSOLE(opaque); int i, j, src; @@ -391,11 +391,10 @@ static void text_console_update(void *opaque, console= _ch_t *chardata) chardata +=3D s->vt.text_y[0] * s->vt.width; for (i =3D s->vt.text_y[0]; i <=3D s->vt.text_y[1]; i ++) for (j =3D 0; j < s->vt.width; j++, src++) { - console_write_ch(chardata ++, - ATTR2CHTYPE(s->vt.cells[src].ch, - s->vt.cells[src].t_attrib.fgc= ol, - s->vt.cells[src].t_attrib.bgc= ol, - s->vt.cells[src].t_attrib.bol= d)); + *chardata++ =3D ATTR2CHTYPE(s->vt.cells[src].ch, + s->vt.cells[src].t_attrib.fgcol, + s->vt.cells[src].t_attrib.bgcol, + s->vt.cells[src].t_attrib.bold); } dpy_text_update(QEMU_CONSOLE(s), s->vt.text_x[0], s->vt.text_y[0], s->vt.text_x[1] - s->vt.text_x[0], i - s->vt.text_= y[0]); diff --git a/ui/console.c b/ui/console.c index 8af1dee0e22..b2b879e8533 100644 --- a/ui/console.c +++ b/ui/console.c @@ -214,7 +214,7 @@ void graphic_hw_invalidate(QemuConsole *con) } } =20 -void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata) +void graphic_hw_text_update(QemuConsole *con, uint32_t *chardata) { if (con && con->hw_ops->text_update) { con->hw_ops->text_update(con->hw, chardata); diff --git a/ui/curses.c b/ui/curses.c index 161f78c35c3..78f21d940e3 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -57,7 +57,7 @@ enum maybe_keycode { }; =20 static DisplayChangeListener *dcl; -static console_ch_t *screen; +static uint32_t *screen; static WINDOW *screenpad =3D NULL; static int width, height, gwidth, gheight, invalidate; static int px, py, sminx, sminy, smaxx, smaxy; @@ -68,7 +68,7 @@ static cchar_t *vga_to_curses; static void curses_update(DisplayChangeListener *dcl, int x, int y, int w, int h) { - console_ch_t *line; + uint32_t *line; g_autofree cchar_t *curses_line =3D g_new(cchar_t, width); wchar_t wch[CCHARW_MAX]; attr_t attrs; @@ -796,7 +796,7 @@ static void curses_display_init(DisplayState *ds, Displ= ayOptions *opts) if (opts->u.curses.charset) { font_charset =3D opts->u.curses.charset; } - screen =3D g_new0(console_ch_t, 160 * 100); + screen =3D g_new0(uint32_t, 160 * 100); vga_to_curses =3D g_new0(cchar_t, 256); curses_setup(); curses_keyboard_setup(); --=20 2.53.0