From nobody Tue Apr 28 22:56:22 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=1777388903; cv=none; d=zohomail.com; s=zohoarc; b=PkV2KJpxbQOgWcwZoE0KQ9JkC0ofHSnAlXh0Kya//vF7pcm5FIvW/iabs4ofKj40I6N8it88YNYa2Nq67hyGH54yccK/xT40CkE++i11NNYOl7+oiZ6vkuGwOsBswryxDhGhVhj2nxsjObmoCrpVTcXtvXPIvMVGlmeVLKF6kOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388903; 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=wP/Ru80yHhGUP0sq9wta8Fv1o5i9JRd5+TNCkCPLPnY=; b=Vv4BENx37DLnLq3kJWxSNrKTiQUYyjjZ/aWEe2SI6KCeHaUtJoTxy02MWougg3V0JMNSdTIB4lInJG4mSdQ6Hc064BYARsItQ09C9cBb+b1u+cQYXbYhjVwVwMd8gZ1vaY61rH0Bc47z5hsKMuuoLW6QMgGKEqgnZBtoR1sQHOg= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388903034447.83545491906943; Tue, 28 Apr 2026 08:08:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk2P-00020B-Uo; Tue, 28 Apr 2026 11:07:50 -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 1wHk2M-0001za-0n for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:07:46 -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 1wHk2J-0000ZA-0J for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:07:44 -0400 Received: from mx-prod-mc-03.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-53-v27IlPbkNMqafHGdFvRAVg-1; Tue, 28 Apr 2026 11:07:38 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 825D11956048; Tue, 28 Apr 2026 15:07:37 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 84FDF1800446; Tue, 28 Apr 2026 15:07:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388862; 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=wP/Ru80yHhGUP0sq9wta8Fv1o5i9JRd5+TNCkCPLPnY=; b=bHH15V7M5Es6WpUzrF6VN50eK6M8rlAMynt+OetaAuP240+qjmqPSxYLBSpS4oM3oU7/sJ G36SdIvyZRtT90XkYiAYptoUqmvQWlPh1sAMiQLn/4g0PQclLbxSJiN8s1IxNk0XXaqPyx 3MPEHsAd5pOFJkf/lg0ZX5cwxSnQCTM= X-MC-Unique: v27IlPbkNMqafHGdFvRAVg-1 X-Mimecast-MFC-AGG-ID: v27IlPbkNMqafHGdFvRAVg_1777388857 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL v2 01/15] ui: move FONT_WIDTH/HEIGHT to vgafont.h Date: Tue, 28 Apr 2026 19:07:11 +0400 Message-ID: <20260428150726.1659814-2-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.4.1 on 10.30.177.111 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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388906095154100 From: Marc-Andr=C3=A9 Lureau Since those values are related to the VGA font, it make sense to move them here. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/console-priv.h | 5 ----- ui/vgafont.h | 6 +++++- ui/console-vc.c | 1 + ui/console.c | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ui/console-priv.h b/ui/console-priv.h index 8bcdb79d914..39798c3e9d7 100644 --- a/ui/console-priv.h +++ b/ui/console-priv.h @@ -9,11 +9,6 @@ #include "qemu/coroutine.h" #include "qemu/timer.h" =20 -#include "vgafont.h" - -#define FONT_HEIGHT 16 -#define FONT_WIDTH 8 - struct QemuConsole { Object parent; =20 diff --git a/ui/vgafont.h b/ui/vgafont.h index 54aeeb7d192..d24b5d47a95 100644 --- a/ui/vgafont.h +++ b/ui/vgafont.h @@ -6,6 +6,10 @@ =20 #include =20 -extern const uint8_t vgafont16[256 * 16]; +/* supports only vga 8x16 */ +#define FONT_WIDTH 8 +#define FONT_HEIGHT 16 + +extern const uint8_t vgafont16[256 * FONT_HEIGHT]; =20 #endif diff --git a/ui/console-vc.c b/ui/console-vc.c index 107294af1cc..6163e21d2c6 100644 --- a/ui/console-vc.c +++ b/ui/console-vc.c @@ -10,6 +10,7 @@ #include "qemu/option.h" #include "qemu/queue.h" #include "ui/console.h" +#include "ui/vgafont.h" =20 #include "pixman.h" #include "trace.h" diff --git a/ui/console.c b/ui/console.c index a7bd22515b9..9606da7b1a6 100644 --- a/ui/console.c +++ b/ui/console.c @@ -24,6 +24,7 @@ =20 #include "qemu/osdep.h" #include "ui/console.h" +#include "ui/vgafont.h" #include "hw/core/qdev.h" #include "qapi/error.h" #include "qapi/qapi-commands-ui.h" --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388902; cv=none; d=zohomail.com; s=zohoarc; b=NqR0lqm+GDToP+QPGsEfDz8gxcRCQU67p9npi7VRjH14PXSTXJmddsBB4Dhl5zsJZgtQ5xEf9wN/LyQ5Z8eJc76gzADYjfiDhDlUIPnzEHYgBbcfB/gmDYyNwaRJVj2pWIh4zYfg+uiks9iYtTcDuB3EEymLTlbDvA93FaKaU18= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388902; 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=5/Xm9LflU3SgsoDBnOsWibNxJZvmoY9IP/DgB7vXa18=; b=G2+W2tWPS6zGpF0rGj3fWFZy7nGFjZcRiWf95Ml2ESwL5RBSEt0jcut3H5mCCWxTofIn7FaNBzpH417ns6DbDoEfO0XAjA/0vGiDPwlW+NiD2QT1NMO5Qj9NQC73aUXO+pV+7wPxBqUUZLyuUBSp0+VkoGpsaYm6zexBcgSfDUk= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388902797885.3131829922493; Tue, 28 Apr 2026 08:08:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk2V-00021O-0u; Tue, 28 Apr 2026 11:07:55 -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 1wHk2Q-00020e-2k for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:07:51 -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 1wHk2N-0000aX-PV for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:07:49 -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-99-IZI9QCPtOH2Tv8A5W6faWg-1; Tue, 28 Apr 2026 11:07:44 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 A5DDE19560AF; Tue, 28 Apr 2026 15:07:43 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 34B5C1943295; Tue, 28 Apr 2026 15:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388866; 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=5/Xm9LflU3SgsoDBnOsWibNxJZvmoY9IP/DgB7vXa18=; b=aur0xz+5YKtdUa0+3ybgtUN8Px3FiQd1mRfYOEMG1MSGz1kFyV9rc/FHtbVkuWlQfFdF9L Iwptj1+Z5SSUmeohWH5dCnwn4p/3raRNrbtxKfnAYsLK0HDEaX0tf8i8m92lBZB76Lctcj qOzm1ox1XNwipFhw3pdZfeLdEN5We8w= X-MC-Unique: IZI9QCPtOH2Tv8A5W6faWg-1 X-Mimecast-MFC-AGG-ID: IZI9QCPtOH2Tv8A5W6faWg_1777388863 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL v2 02/15] ui: move DisplaySurface functions to display-surface.c Date: Tue, 28 Apr 2026 19:07:12 +0400 Message-ID: <20260428150726.1659814-3-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.0 on 10.30.177.17 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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388906188154100 From: Marc-Andr=C3=A9 Lureau Extract DisplaySurface creation and destruction functions from console.c into their own file to reduce the size of console.c and improve code organization. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/console.c | 96 -------------------------------------- ui/display-surface.c | 107 +++++++++++++++++++++++++++++++++++++++++++ ui/meson.build | 1 + 3 files changed, 108 insertions(+), 96 deletions(-) create mode 100644 ui/display-surface.c diff --git a/ui/console.c b/ui/console.c index 9606da7b1a6..475a72aa08f 100644 --- a/ui/console.c +++ b/ui/console.c @@ -505,102 +505,6 @@ qemu_graphic_console_init(Object *obj) { } =20 -void qemu_displaysurface_set_share_handle(DisplaySurface *surface, - qemu_pixman_shareable handle, - uint32_t offset) -{ - assert(surface->share_handle =3D=3D SHAREABLE_NONE); - - surface->share_handle =3D handle; - surface->share_handle_offset =3D offset; - -} - -DisplaySurface *qemu_create_displaysurface(int width, int height) -{ - trace_displaysurface_create(width, height); - - return qemu_create_displaysurface_from( - width, height, - PIXMAN_x8r8g8b8, - width * 4, NULL - ); -} - -DisplaySurface *qemu_create_displaysurface_from(int width, int height, - pixman_format_code_t forma= t, - int linesize, uint8_t *dat= a) -{ - DisplaySurface *surface =3D g_new0(DisplaySurface, 1); - - trace_displaysurface_create_from(surface, width, height, format); - surface->share_handle =3D SHAREABLE_NONE; - - if (data) { - surface->image =3D pixman_image_create_bits(format, - width, height, - (void *)data, linesize); - } else { - qemu_pixman_image_new_shareable(&surface->image, - &surface->share_handle, - "displaysurface", - format, - width, - height, - linesize, - &error_abort); - surface->flags =3D QEMU_ALLOCATED_FLAG; - } - - assert(surface->image !=3D NULL); - return surface; -} - -DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image) -{ - DisplaySurface *surface =3D g_new0(DisplaySurface, 1); - - trace_displaysurface_create_pixman(surface); - surface->share_handle =3D SHAREABLE_NONE; - surface->image =3D pixman_image_ref(image); - - return surface; -} - -DisplaySurface *qemu_create_placeholder_surface(int w, int h, - const char *msg) -{ - DisplaySurface *surface =3D qemu_create_displaysurface(w, h); -#ifdef CONFIG_PIXMAN - pixman_color_t bg =3D QEMU_PIXMAN_COLOR_BLACK; - pixman_color_t fg =3D QEMU_PIXMAN_COLOR_GRAY; - pixman_image_t *glyph; - int len, x, y, i; - - len =3D strlen(msg); - x =3D (w / FONT_WIDTH - len) / 2; - y =3D (h / FONT_HEIGHT - 1) / 2; - for (i =3D 0; i < len; i++) { - glyph =3D qemu_pixman_glyph_from_vgafont(FONT_HEIGHT, vgafont16, m= sg[i]); - qemu_pixman_glyph_render(glyph, surface->image, &fg, &bg, - x+i, y, FONT_WIDTH, FONT_HEIGHT); - qemu_pixman_image_unref(glyph); - } -#endif - surface->flags |=3D QEMU_PLACEHOLDER_FLAG; - return surface; -} - -void qemu_free_displaysurface(DisplaySurface *surface) -{ - if (surface =3D=3D NULL) { - return; - } - trace_displaysurface_free(surface); - qemu_pixman_image_unref(surface->image); - g_free(surface); -} - bool console_has_gl(QemuConsole *con) { return con->gl !=3D NULL; diff --git a/ui/display-surface.c b/ui/display-surface.c new file mode 100644 index 00000000000..38e408513cc --- /dev/null +++ b/ui/display-surface.c @@ -0,0 +1,107 @@ +/* + * QEMU graphical console surface helper + * + * Copyright (c) 2004 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + */ +#include "qemu/osdep.h" +#include "ui/console.h" +#include "ui/vgafont.h" +#include "trace.h" + +void qemu_displaysurface_set_share_handle(DisplaySurface *surface, + qemu_pixman_shareable handle, + uint32_t offset) +{ + assert(surface->share_handle =3D=3D SHAREABLE_NONE); + + surface->share_handle =3D handle; + surface->share_handle_offset =3D offset; + +} + +DisplaySurface *qemu_create_displaysurface(int width, int height) +{ + trace_displaysurface_create(width, height); + + return qemu_create_displaysurface_from( + width, height, + PIXMAN_x8r8g8b8, + width * 4, NULL + ); +} + +DisplaySurface *qemu_create_displaysurface_from(int width, int height, + pixman_format_code_t forma= t, + int linesize, uint8_t *dat= a) +{ + DisplaySurface *surface =3D g_new0(DisplaySurface, 1); + + trace_displaysurface_create_from(surface, width, height, format); + surface->share_handle =3D SHAREABLE_NONE; + + if (data) { + surface->image =3D pixman_image_create_bits(format, + width, height, + (void *)data, linesize); + } else { + qemu_pixman_image_new_shareable(&surface->image, + &surface->share_handle, + "displaysurface", + format, + width, + height, + linesize, + &error_abort); + surface->flags =3D QEMU_ALLOCATED_FLAG; + } + + assert(surface->image !=3D NULL); + return surface; +} + +DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image) +{ + DisplaySurface *surface =3D g_new0(DisplaySurface, 1); + + trace_displaysurface_create_pixman(surface); + surface->share_handle =3D SHAREABLE_NONE; + surface->image =3D pixman_image_ref(image); + + return surface; +} + +DisplaySurface *qemu_create_placeholder_surface(int w, int h, + const char *msg) +{ + DisplaySurface *surface =3D qemu_create_displaysurface(w, h); +#ifdef CONFIG_PIXMAN + pixman_color_t bg =3D QEMU_PIXMAN_COLOR_BLACK; + pixman_color_t fg =3D QEMU_PIXMAN_COLOR_GRAY; + pixman_image_t *glyph; + int len, x, y, i; + + len =3D strlen(msg); + x =3D (w / FONT_WIDTH - len) / 2; + y =3D (h / FONT_HEIGHT - 1) / 2; + for (i =3D 0; i < len; i++) { + glyph =3D qemu_pixman_glyph_from_vgafont(FONT_HEIGHT, vgafont16, m= sg[i]); + qemu_pixman_glyph_render(glyph, surface->image, &fg, &bg, + x + i, y, FONT_WIDTH, FONT_HEIGHT); + qemu_pixman_image_unref(glyph); + } +#endif + surface->flags |=3D QEMU_PLACEHOLDER_FLAG; + return surface; +} + +void qemu_free_displaysurface(DisplaySurface *surface) +{ + if (surface =3D=3D NULL) { + return; + } + trace_displaysurface_free(surface); + qemu_pixman_image_unref(surface->image); + g_free(surface); +} diff --git a/ui/meson.build b/ui/meson.build index 4e533d30460..3d15ff96287 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -4,6 +4,7 @@ system_ss.add(files( 'clipboard.c', 'console.c', 'cursor.c', + 'display-surface.c', 'dmabuf.c', 'input-keymap.c', 'input-legacy.c', --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388929; cv=none; d=zohomail.com; s=zohoarc; b=nUM1RyPHkW9/U2Drgye+vj/JBVPUJDJj0XL4KjMR8+zAPWKW6hxAzuhVG7lIEFTPjr7uMJbfuLq5I43844W2NTD2u+QfIStct6lNJmmAYEppxodUlO2VSfyHyF1/gzz1ItYImOMDvWTZcd9orkUL/v70bF4S4TrcXTdIdHY/2DA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388929; 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=LJzJL64QU8J/bKVNeTm8rPqAE4poab6BQAvl3IlDee4=; b=Zu+9iWoHGpuHLU+2bHPbGoKJ/ZPBRWAo0jArSW9gApdoQug7T39wR7AtNJNRx2Sudxr/jCZkn/V+itUWLT/sllHVtleynvnHVoE03RbB5YjfcG5L3ARCJNt9x00j/NpNCRdnm8RpgowJXbSqa6A3wVFuhY0riVvp24hBTmv3jwk= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388929490796.6658656627238; Tue, 28 Apr 2026 08:08:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk2Y-00022j-6g; Tue, 28 Apr 2026 11:07:58 -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 1wHk2X-00022U-6r for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:07:57 -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 1wHk2V-0000bI-Oj for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:07:56 -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-614-Amw2fIpuPyG8_T62k32QgQ-1; Tue, 28 Apr 2026 11:07:51 -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 C676319560BB; Tue, 28 Apr 2026 15:07:49 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2584F1800345; Tue, 28 Apr 2026 15:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388875; 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=LJzJL64QU8J/bKVNeTm8rPqAE4poab6BQAvl3IlDee4=; b=ZXQtc461fN8xDjPldyDGwf3f3X14UOcp9GmBeVYNVDhJehwmPHUhlKr3LKfHru7ngBXXuU ZrRtVgqLKVLKpybhtzfEsqjzpCgnnFmqgN5Agm/h/U1FT61zWnAbFaZbawbNdaBDUAaHQ3 bhQ+uCp+b34t+Jgy15tsvq5T7F4CxG8= X-MC-Unique: Amw2fIpuPyG8_T62k32QgQ-1 X-Mimecast-MFC-AGG-ID: Amw2fIpuPyG8_T62k32QgQ_1777388869 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL v2 03/15] ui: make qemu_default_pixelformat() static inline Date: Tue, 28 Apr 2026 19:07:13 +0400 Message-ID: <20260428150726.1659814-4-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388957624154100 From: Marc-Andr=C3=A9 Lureau The function is a trivial wrapper around qemu_default_pixman_format() and qemu_pixelformat_from_pixman(), so make it static inline in qemu-pixman.h instead of a standalone function in console.c, allowing to be easily reused. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/qemu-pixman.h | 8 ++++++++ include/ui/surface.h | 2 -- ui/console.c | 7 ------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h index 2ca0ed7029c..4bc7a59698e 100644 --- a/include/ui/qemu-pixman.h +++ b/include/ui/qemu-pixman.h @@ -73,6 +73,14 @@ typedef struct PixelFormat { =20 PixelFormat qemu_pixelformat_from_pixman(pixman_format_code_t format); pixman_format_code_t qemu_default_pixman_format(int bpp, bool native_endia= n); + +static inline PixelFormat qemu_default_pixelformat(int bpp) +{ + pixman_format_code_t fmt =3D qemu_default_pixman_format(bpp, true); + PixelFormat pf =3D qemu_pixelformat_from_pixman(fmt); + return pf; +} + pixman_format_code_t qemu_drm_format_to_pixman(uint32_t drm_format); uint32_t qemu_pixman_to_drm_format(pixman_format_code_t pixman); int qemu_pixman_get_type(int rshift, int gshift, int bshift, int endian); diff --git a/include/ui/surface.h b/include/ui/surface.h index d2542d3ace5..8e5f3e35e8c 100644 --- a/include/ui/surface.h +++ b/include/ui/surface.h @@ -24,8 +24,6 @@ typedef struct DisplaySurface { uint32_t share_handle_offset; } DisplaySurface; =20 -PixelFormat qemu_default_pixelformat(int bpp); - DisplaySurface *qemu_create_displaysurface_from(int width, int height, pixman_format_code_t forma= t, int linesize, uint8_t *dat= a); diff --git a/ui/console.c b/ui/console.c index 475a72aa08f..ff561617657 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1390,13 +1390,6 @@ DisplaySurface *qemu_console_surface(QemuConsole *co= nsole) } } =20 -PixelFormat qemu_default_pixelformat(int bpp) -{ - pixman_format_code_t fmt =3D qemu_default_pixman_format(bpp, true); - PixelFormat pf =3D qemu_pixelformat_from_pixman(fmt); - return pf; -} - static QemuDisplay *dpys[DISPLAY_TYPE__MAX]; =20 void qemu_display_register(QemuDisplay *ui) --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388908; cv=none; d=zohomail.com; s=zohoarc; b=hHMnLeOHk/6oPs8ZoJb4lpmlOxLpc3XNArBKyoW86exiwU478fXe3eQyVibSnTlZOtVp51p6wkElbcOdRviqZ1K9G10S7d2OCPCl848Ma7OBJqYCDG/fXPkYnzk/Ztclj7qABzBcyVKsESx3v4GY39o6bJmhPNhUg6zBQOs1fS4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388908; 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=IkpGl3HAWG84Lz32oL5MSfzi+OkueOYg3GOHztW+s3g=; b=maZw40zWZz8sUD3gym9NaWOyP3KNzI4cPxioQ4ALvhjPq443isCEqO9FeuFVdxSFIfE57zTZVmtmdyA6QOSXHsB3ncpooDBvy+00CVaIOXJZeaGg2AlGkltKzEnvXiEQPU8QZ7kLW6kPbZmXQocCQ/RJOitCYlD+0cvhyILkwXI= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388908492489.43058355941344; Tue, 28 Apr 2026 08:08:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk2f-00024X-ML; Tue, 28 Apr 2026 11:08:05 -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 1wHk2d-00024E-Jm for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:03 -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 1wHk2c-0000bo-2X for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:03 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-101-Usu81tE1OMa3kbZ-1pUDgQ-1; Tue, 28 Apr 2026 11:07:57 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BCDCA18005B6; Tue, 28 Apr 2026 15:07:55 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 85F8D1800446; Tue, 28 Apr 2026 15:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388881; 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=IkpGl3HAWG84Lz32oL5MSfzi+OkueOYg3GOHztW+s3g=; b=g9/70Sahn1n43Qxz0YNj4OzfsxIUbiC1Ss+qisCo5o7tDPd91vSRV194z629DHDylnUgU3 EK5dwHBCyff5UADFddfEcAPFRVZ4byaLHksEmuHSnFxktuL4PePOSWMxXiv3RKnFiTRhtm npS6YH+8h0JtJEiTMCbdyZhETop0XLA= X-MC-Unique: Usu81tE1OMa3kbZ-1pUDgQ-1 X-Mimecast-MFC-AGG-ID: Usu81tE1OMa3kbZ-1pUDgQ_1777388875 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL v2 04/15] ui: make unregister_displaychangelistener() skip unregistered Date: Tue, 28 Apr 2026 19:07:14 +0400 Message-ID: <20260428150726.1659814-5-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.4.1 on 10.30.177.111 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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388909828154100 From: Marc-Andr=C3=A9 Lureau If the listener doesn't have associate ds / display state, it is already unregistered. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/console.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/console.c b/ui/console.c index ff561617657..8f65308958a 100644 --- a/ui/console.c +++ b/ui/console.c @@ -675,6 +675,9 @@ void unregister_displaychangelistener(DisplayChangeList= ener *dcl) { DisplayState *ds =3D dcl->ds; trace_displaychangelistener_unregister(dcl, dcl->ops->dpy_name); + if (!ds) { + return; + } if (dcl->con) { dcl->con->dcls--; } --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388913; cv=none; d=zohomail.com; s=zohoarc; b=T6KjwybrfYE9Ci2mHOgv4HHqsDbi6wiQ2YhgSf01QhqeJPJV0lVZ4RyhFPgAeFXitdlWksQfUbWgI57qqcJ+nG2YgvMNa5kHacC4gexRlhc0BbAIhi52vohUTyEQReCLhZZ4rhRVSkGNagJm6Q98U6zD69iptuEL0I35LBiOdZQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388913; 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=xcpKhY7XLUys4G2b71IeM+bUSCB6UyTf3Ja3T4QV14k=; b=ZqMW47yRJ9ObJgDh4YC2Dxx567VWG28IvhXqveFkXd2PxxI9SAOgiFDxtatbaMOrP3Y3lpHSpgwf86dK3YKQG7cmx+a2/+N/0Yd6DtU+XBkBCrhqGoJYvKzkbLc0XfJlt2AYp7JBZmoiFWbDyoxkw6pBGauyCJZnfbPuRyUb2i4= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388912999431.0777042578752; Tue, 28 Apr 2026 08:08:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk2j-000254-67; Tue, 28 Apr 2026 11:08:09 -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 1wHk2g-00024m-PB for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:06 -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 1wHk2f-0000cH-Ap for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:06 -0400 Received: from mx-prod-mc-03.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-569-3Xp1XgEyOhGZKAgjWJWSDA-1; Tue, 28 Apr 2026 11:08:02 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B55331956052; Tue, 28 Apr 2026 15:08:01 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 45CC819560AB; Tue, 28 Apr 2026 15:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388884; 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=xcpKhY7XLUys4G2b71IeM+bUSCB6UyTf3Ja3T4QV14k=; b=BTCpXKvpU6b0i8CSwmbgq5Uw0Sr2o5Di8N4PNU3JYB9OA9atz5amW6R9H/9hpyvQzfdXRA lNbTvIAMhIvX9nJJ1bEGJL3B+zysOZUKOygT74ShS46fPmuWwok3TxagM+Uq4CCpXfgwhh xmxYvAulxI8pqdYJGRPt36c2jzoWoCU= X-MC-Unique: 3Xp1XgEyOhGZKAgjWJWSDA-1 X-Mimecast-MFC-AGG-ID: 3Xp1XgEyOhGZKAgjWJWSDA_1777388882 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL v2 05/15] ui: minor code simplification Date: Tue, 28 Apr 2026 19:07:15 +0400 Message-ID: <20260428150726.1659814-6-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.0 on 10.30.177.12 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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388914118154100 From: Marc-Andr=C3=A9 Lureau Drop memset() usage. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/sdl2.c | 8 ++++---- ui/vnc.c | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ui/sdl2.c b/ui/sdl2.c index 987ad334bbe..5dd612d9a6a 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -600,10 +600,10 @@ static void handle_windowevent(SDL_Event *ev) switch (ev->window.event) { case SDL_WINDOWEVENT_RESIZED: { - QemuUIInfo info; - memset(&info, 0, sizeof(info)); - info.width =3D ev->window.data1; - info.height =3D ev->window.data2; + QemuUIInfo info =3D { + .width =3D ev->window.data1, + .height =3D ev->window.data2, + }; dpy_set_ui_info(scon->dcl.con, &info, true); } sdl2_redraw(scon); diff --git a/ui/vnc.c b/ui/vnc.c index ad8d58a23d7..16dbb0cd6c2 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -43,6 +43,7 @@ #include "qapi/qapi-events-ui.h" #include "qapi/error.h" #include "qapi/qapi-commands-ui.h" +#include "ui/console.h" #include "ui/input.h" #include "crypto/hash.h" #include "crypto/tlscreds.h" @@ -2639,10 +2640,7 @@ static int protocol_client_msg(VncState *vs, uint8_t= *data, size_t len) =20 trace_vnc_msg_client_set_desktop_size(vs, vs->ioc, w, h, screens); if (dpy_ui_info_supported(vs->vd->dcl.con)) { - QemuUIInfo info; - memset(&info, 0, sizeof(info)); - info.width =3D w; - info.height =3D h; + QemuUIInfo info =3D { .width =3D w, .height =3D h }; dpy_set_ui_info(vs->vd->dcl.con, &info, false); vnc_desktop_resize_ext(vs, 4 /* Request forwarded */); } else { --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388953; cv=none; d=zohomail.com; s=zohoarc; b=VpyKIxaaCeymmNZN9WCv8XBauhndESWXRMYyl74m+sn2+I6fLaD4s9cgkd0OrKgwERdE0CXHlyVGTFMJqu9uqIfyc09jonDngzW+I0lKAgMsEv9etiVzhvqCTpQNtGgYGI4udkAE+aPUF+yBNoBRprzISQ6E71MbHtdFnEHnSXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388953; 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=EE6I4Y7uJB/7Fj6higSfUyqejKTnpEcfeyTTOwYcfLA=; b=FC+eDC694vDjkBbJjr1IUHC/Nq5V6A0sLO+heTWqnvI63/dMbHsBXMvt7dJsTNEEK5yMAIBlFmR8B8+QXgcdUmyCluCLIZ+Ydvyg9GTlaKN2spof53rDdljVQ4pQlHQ0+VJAWtKqnChN73wJj9qJTQzkIzVtw+zHuUdGK6xVpvU= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388953701207.662787741035; Tue, 28 Apr 2026 08:09:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk2q-00025r-Nt; Tue, 28 Apr 2026 11:08: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 1wHk2o-00025a-OF for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:14 -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 1wHk2n-0000f0-8n for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:14 -0400 Received: from mx-prod-mc-03.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-683-aXhtddxVNryXPPctK3o0mg-1; Tue, 28 Apr 2026 11:08:09 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 496F41956056; Tue, 28 Apr 2026 15:08:08 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8C74B180047F; Tue, 28 Apr 2026 15:08:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388892; 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=EE6I4Y7uJB/7Fj6higSfUyqejKTnpEcfeyTTOwYcfLA=; b=KhsMQvf7votzs1F/epnDcfZArZqp9daL4nK0W3uGUmwAQIvdGuezzuM80FPA+OMP1dYTxn QnuaVfFso+rrJ2XEAfwCnPtyytYJm/iVRLB3FeEXwUpCOVH7oqT/KEr5zuWS9yVx9iLA/3 hqOuQp3ML/EaXn+5hZ3mWBntJolKkvU= X-MC-Unique: aXhtddxVNryXPPctK3o0mg-1 X-Mimecast-MFC-AGG-ID: aXhtddxVNryXPPctK3o0mg_1777388888 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL v2 06/15] ui: rename init_keyboard_layout->kbd_layout_new() Date: Tue, 28 Apr 2026 19:07:16 +0400 Message-ID: <20260428150726.1659814-7-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388954951158500 From: Marc-Andr=C3=A9 Lureau Use a more convential name. Suggested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/keymaps.h | 4 ++-- ui/curses.c | 4 ++-- ui/input-barrier.c | 4 ++-- ui/keymaps.c | 4 ++-- ui/vnc.c | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ui/keymaps.h b/ui/keymaps.h index e8917e56404..89bfbb2704d 100644 --- a/ui/keymaps.h +++ b/ui/keymaps.h @@ -52,8 +52,8 @@ typedef struct { =20 typedef struct kbd_layout_t kbd_layout_t; =20 -kbd_layout_t *init_keyboard_layout(const name2keysym_t *table, - const char *language, Error **errp); +kbd_layout_t *kbd_layout_new(const name2keysym_t *table, + const char *language, Error **errp); void kbd_layout_free(kbd_layout_t *k); int keysym2scancode(kbd_layout_t *k, int keysym, QKbdState *kbd, bool down); diff --git a/ui/curses.c b/ui/curses.c index 161f78c35c3..af4ccb4227d 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -770,8 +770,8 @@ static void curses_keyboard_setup(void) keyboard_layout =3D "en-us"; #endif if(keyboard_layout) { - kbd_layout =3D init_keyboard_layout(name2keysym, keyboard_layout, - &error_fatal); + kbd_layout =3D kbd_layout_new(name2keysym, keyboard_layout, + &error_fatal); } } =20 diff --git a/ui/input-barrier.c b/ui/input-barrier.c index 0a2198ca500..74724be8f45 100644 --- a/ui/input-barrier.c +++ b/ui/input-barrier.c @@ -679,8 +679,8 @@ static void input_barrier_instance_init(Object *obj) /* always use generic keymaps */ if (keyboard_layout && !kbd_layout) { /* We use X11 key id, so use VNC name2keysym */ - kbd_layout =3D init_keyboard_layout(name2keysym, keyboard_layout, - &error_fatal); + kbd_layout =3D kbd_layout_new(name2keysym, keyboard_layout, + &error_fatal); } =20 ib->saddr.type =3D SOCKET_ADDRESS_TYPE_INET; diff --git a/ui/keymaps.c b/ui/keymaps.c index d1b3f43dc8a..6822c097be7 100644 --- a/ui/keymaps.c +++ b/ui/keymaps.c @@ -187,8 +187,8 @@ void kbd_layout_free(kbd_layout_t *k) g_free(k); } =20 -kbd_layout_t *init_keyboard_layout(const name2keysym_t *table, - const char *language, Error **errp) +kbd_layout_t *kbd_layout_new(const name2keysym_t *table, + const char *language, Error **errp) { kbd_layout_t *k; =20 diff --git a/ui/vnc.c b/ui/vnc.c index 16dbb0cd6c2..c87d1f61a0a 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3443,10 +3443,10 @@ void vnc_display_init(const char *id, Error **errp) =20 if (keyboard_layout) { trace_vnc_key_map_init(keyboard_layout); - vd->kbd_layout =3D init_keyboard_layout(name2keysym, - keyboard_layout, errp); + vd->kbd_layout =3D kbd_layout_new(name2keysym, + keyboard_layout, errp); } else { - vd->kbd_layout =3D init_keyboard_layout(name2keysym, "en-us", errp= ); + vd->kbd_layout =3D kbd_layout_new(name2keysym, "en-us", errp); } =20 if (!vd->kbd_layout) { --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388994; cv=none; d=zohomail.com; s=zohoarc; b=cyEj6f+b/HxY4cL2sse15tBTrFn7SfknrXyE15H3zyxm/izh3vW6agxTh9T66TBmTaM5HfnduaFY+aUZL84XPQaqrCtBhh1lnw40juTz4kMyEZychP7lPJrbIj5ieC5DqUIXuRnB+BBbEbMEUGiTTtI44HTuL0Q2zgRwbjUvq+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388994; 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=Q40IFlP5UbJ9de0udgFY1frJ1gOfFdIuGGwIuM2O9o8=; b=UnilBFl42oWwRt515c4ni2w2UyIbJr6BwY8xGCw43MIYzI8uvBsGpRH1kUHSYC5/QbbJafw0gtFZAgssPZuTdgOaBfBqoEWlTw88PtgAQRAhgH7ms2VneDqjlNFN4iTo3eed4A5lTDN2nPTX/y84qA4AcslzPoJdnCXueifT+Nk= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388994609971.6914482693194; Tue, 28 Apr 2026 08:09:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk2v-00026b-IX; Tue, 28 Apr 2026 11:08:21 -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 1wHk2t-000269-9j for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:19 -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 1wHk2r-0000gQ-Mw for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:19 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-649-v9MKjmmdPu6S00vqvWadbA-1; Tue, 28 Apr 2026 11:08:15 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 358A7180036E; Tue, 28 Apr 2026 15:08:14 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E32C31800446; Tue, 28 Apr 2026 15:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388897; 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=Q40IFlP5UbJ9de0udgFY1frJ1gOfFdIuGGwIuM2O9o8=; b=GzygR4TUL9OMJtkgRjIqtNprTvSDQeDzWQlmRP9xhInN+bdvp4sQ1YYcvRlRLgYoQCF1A3 ZRz2dku8m3XUtz4nS2coAlsXS5pqxQe2Th1psSgYRrv9QpHyAw+2eSOe837Khw9dziEX0D /QFtyztRpdMqOGadTdF/s8mV+szgTWQ= X-MC-Unique: v9MKjmmdPu6S00vqvWadbA-1 X-Mimecast-MFC-AGG-ID: v9MKjmmdPu6S00vqvWadbA_1777388894 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL v2 07/15] ui/console: remove qemu_console_is_visible() Date: Tue, 28 Apr 2026 19:07:17 +0400 Message-ID: <20260428150726.1659814-8-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.4.1 on 10.30.177.111 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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388997253154100 From: Marc-Andr=C3=A9 Lureau Drop the bookkeeping, we can simply afford an empty "foreach". Notice that dpy_gfx_update_texture() is now called even when there are no listeners. This is more correct, as the texture is not fully refreshed when a listener connects, so it may be outdated/garbaged. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/console.h | 1 - ui/console-priv.h | 1 - ui/console.c | 29 ----------------------------- 3 files changed, 31 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index e2e5ff76ec1..f04844263b9 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -399,7 +399,6 @@ QemuConsole *qemu_console_lookup_by_device(DeviceState = *dev, uint32_t head); QemuConsole *qemu_console_lookup_by_device_name(const char *device_id, uint32_t head, Error **err= p); QEMUCursor *qemu_console_get_cursor(QemuConsole *con); -bool qemu_console_is_visible(QemuConsole *con); bool qemu_console_is_graphic(QemuConsole *con); bool qemu_console_is_fixedsize(QemuConsole *con); bool qemu_console_is_gl_blocked(QemuConsole *con); diff --git a/ui/console-priv.h b/ui/console-priv.h index 39798c3e9d7..2299898984d 100644 --- a/ui/console-priv.h +++ b/ui/console-priv.h @@ -16,7 +16,6 @@ struct QemuConsole { DisplayState *ds; DisplaySurface *surface; DisplayScanout scanout; - int dcls; DisplayGLCtx *gl; int gl_block; QEMUTimer *gl_unblock_timer; diff --git a/ui/console.c b/ui/console.c index 8f65308958a..abb6cba2826 100644 --- a/ui/console.c +++ b/ui/console.c @@ -648,9 +648,6 @@ void register_displaychangelistener(DisplayChangeListen= er *dcl) dcl->ds =3D get_alloc_displaystate(); QLIST_INSERT_HEAD(&dcl->ds->listeners, dcl, next); gui_setup_refresh(dcl->ds); - if (dcl->con) { - dcl->con->dcls++; - } displaychangelistener_display_console(dcl, &error_fatal); if (QEMU_IS_GRAPHIC_CONSOLE(dcl->con)) { dcl_set_graphic_cursor(dcl, QEMU_GRAPHIC_CONSOLE(dcl->con)); @@ -678,9 +675,6 @@ void unregister_displaychangelistener(DisplayChangeList= ener *dcl) if (!ds) { return; } - if (dcl->con) { - dcl->con->dcls--; - } QLIST_REMOVE(dcl, next); dcl->ds =3D NULL; gui_setup_refresh(ds); @@ -745,9 +739,6 @@ void dpy_gfx_update(QemuConsole *con, int x, int y, int= w, int h) w =3D MIN(w, width - x); h =3D MIN(h, height - y); =20 - if (!qemu_console_is_visible(con)) { - return; - } dpy_gfx_update_texture(con, con->surface, x, y, w, h); QLIST_FOREACH(dcl, &s->listeners, next) { if (con !=3D dcl->con) { @@ -846,9 +837,6 @@ void dpy_text_cursor(QemuConsole *con, int x, int y) DisplayState *s =3D con->ds; DisplayChangeListener *dcl; =20 - if (!qemu_console_is_visible(con)) { - return; - } QLIST_FOREACH(dcl, &s->listeners, next) { if (con !=3D dcl->con) { continue; @@ -864,9 +852,6 @@ void dpy_text_update(QemuConsole *con, int x, int y, in= t w, int h) DisplayState *s =3D con->ds; DisplayChangeListener *dcl; =20 - if (!qemu_console_is_visible(con)) { - return; - } QLIST_FOREACH(dcl, &s->listeners, next) { if (con !=3D dcl->con) { continue; @@ -882,9 +867,6 @@ void dpy_text_resize(QemuConsole *con, int w, int h) DisplayState *s =3D con->ds; DisplayChangeListener *dcl; =20 - if (!qemu_console_is_visible(con)) { - return; - } QLIST_FOREACH(dcl, &s->listeners, next) { if (con !=3D dcl->con) { continue; @@ -904,9 +886,6 @@ void dpy_mouse_set(QemuConsole *c, int x, int y, bool o= n) con->cursor_x =3D x; con->cursor_y =3D y; con->cursor_on =3D on; - if (!qemu_console_is_visible(c)) { - return; - } QLIST_FOREACH(dcl, &s->listeners, next) { if (c !=3D dcl->con) { continue; @@ -925,9 +904,6 @@ void dpy_cursor_define(QemuConsole *c, QEMUCursor *curs= or) =20 cursor_unref(con->cursor); con->cursor =3D cursor_ref(cursor); - if (!qemu_console_is_visible(c)) { - return; - } QLIST_FOREACH(dcl, &s->listeners, next) { if (c !=3D dcl->con) { continue; @@ -1285,11 +1261,6 @@ QEMUCursor *qemu_console_get_cursor(QemuConsole *con) return QEMU_IS_GRAPHIC_CONSOLE(con) ? QEMU_GRAPHIC_CONSOLE(con)->curso= r : NULL; } =20 -bool qemu_console_is_visible(QemuConsole *con) -{ - return con->dcls > 0; -} - bool qemu_console_is_graphic(QemuConsole *con) { return con && QEMU_IS_GRAPHIC_CONSOLE(con); --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388929; cv=none; d=zohomail.com; s=zohoarc; b=cw8xUB3xBZ0lYh8PFKkk/EpgA9WlqdFEM20rNI8CAr9fn5viTZtWNP6RSEbEzilvOPc7zE7kqRZr8CasZjtnjdCSL4V0F8617JUeMeUFuuYs7gGvfrwKnCoeyPb2KEIDGFG6Us89F5gdaN99kpo8x8dQ94Ta8ZLzC/GgHWyeiJA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388929; 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=twk5bN/c9zdW8WMPP3xJRHocmGhqop4Vir91q7y6U9w=; b=Sh53eEKPQpBx2IlafE/cjsYVQGgoaAUzGoDdwAozdnK3PHDfaEIlhPTnqzs+Yx04tuBVNwZAofOn243fgKmbZBExJRJeVhtckf8Jr3RWRULAIoJEP8a0DsWv5SjETyNGC/JUtpwP/KzNjeEQwm3v/YQNQl4tj4ZSAyvKxNLePrM= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388929078225.13318259293123; Tue, 28 Apr 2026 08:08:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk3L-0003IY-8u; Tue, 28 Apr 2026 11:08:47 -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 1wHk3G-00033m-Vc for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:43 -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 1wHk3C-0000me-V9 for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:42 -0400 Received: from mx-prod-mc-03.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-104-r7s6JQv5MNe2Zdx2qkUipg-1; Tue, 28 Apr 2026 11:08:34 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 133DF1955DBD; Tue, 28 Apr 2026 15:08:23 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6C10F19560AB; Tue, 28 Apr 2026 15:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388918; 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=twk5bN/c9zdW8WMPP3xJRHocmGhqop4Vir91q7y6U9w=; b=esPbTcltjyw9ru3dBRfN1D79L1CXYfr51yDOR2zBalmLzawd80EGzLKUF7JatGfR33/9ZJ msWr+P41HM2AHcdgKyJIEw34GzuvICJ+eOytoKCXnl4h4Ay+2IpOg5YcoubRMfHhPXFaeR 4NwPTYmAX3hhZJpFEIt4r7thzdhVVlg= X-MC-Unique: r7s6JQv5MNe2Zdx2qkUipg-1 X-Mimecast-MFC-AGG-ID: r7s6JQv5MNe2Zdx2qkUipg_1777388904 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Jan Kiszka , Peter Maydell , Phil Dennis-Jordan , Richard Henderson , Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Mark Cave-Ayland , Samuel Tardieu , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Rikalo , Jean-Christophe Dubois , Laurent Vivier , Thomas Huth , BALATON Zoltan , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Akihiko Odaki , Dmitry Osipenko , "Michael S. Tsirkin" , Dmitry Fleytman , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , Alistair Francis , Alex Williamson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-arm@nongnu.org (open list:Musicpal), qemu-ppc@nongnu.org (open list:sam460ex), xen-devel@lists.xenproject.org (open list:X86 Xen CPUs) Subject: [PULL v2 08/15] ui/console: return completion status from gfx_update callback Date: Tue, 28 Apr 2026 19:07:18 +0400 Message-ID: <20260428150726.1659814-9-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.0 on 10.30.177.12 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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388930904154100 From: Marc-Andr=C3=A9 Lureau Replace the two-field design (gfx_update void callback + gfx_update_async flag) with a single bool return value from gfx_update. Returning true means the update completed synchronously and graphic_hw_update_done() should be called by the console layer. Returning false means the update is deferred and the device will call graphic_hw_update_done() itself later (as done by QXL/SPICE and Apple GFX). This simplifies the interface and makes the async contract explicit at each call site rather than relying on a separate struct field. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/display/qxl.h | 2 +- include/ui/console.h | 11 ++++++++--- hw/arm/musicpal.c | 3 ++- hw/display/artist.c | 4 +++- hw/display/bcm2835_fb.c | 7 ++++--- hw/display/bochs-display.c | 6 ++++-- hw/display/cg3.c | 5 +++-- hw/display/dm163.c | 4 +++- hw/display/exynos4210_fimd.c | 6 ++++-- hw/display/g364fb.c | 9 ++++++--- hw/display/imx6ul_lcdif.c | 7 ++++--- hw/display/jazz_led.c | 6 ++++-- hw/display/macfb.c | 6 ++++-- hw/display/next-fb.c | 4 +++- hw/display/omap_lcdc.c | 14 ++++++++------ hw/display/pl110.c | 5 +++-- hw/display/qxl-render.c | 6 +++--- hw/display/qxl.c | 7 +++---- hw/display/ramfb-standalone.c | 4 +++- hw/display/sm501.c | 8 +++++--- hw/display/ssd0303.c | 10 ++++++---- hw/display/ssd0323.c | 11 ++++++----- hw/display/tcx.c | 6 ++++-- hw/display/vga.c | 4 +++- hw/display/virtio-gpu-base.c | 3 ++- hw/display/virtio-vga.c | 6 +++--- hw/display/vmware_vga.c | 7 ++++--- hw/display/xenfb.c | 6 ++++-- hw/display/xlnx_dp.c | 10 ++++++---- hw/vfio/display.c | 17 ++++++++++------- ui/console.c | 7 +------ hw/display/apple-gfx.m | 10 +++++----- 32 files changed, 132 insertions(+), 89 deletions(-) diff --git a/hw/display/qxl.h b/hw/display/qxl.h index e0a85a5ca49..ad8a9128785 100644 --- a/hw/display/qxl.h +++ b/hw/display/qxl.h @@ -187,7 +187,7 @@ int qxl_log_command(PCIQXLDevice *qxl, const char *ring= , QXLCommandExt *ext); =20 /* qxl-render.c */ void qxl_render_resize(PCIQXLDevice *qxl); -void qxl_render_update(PCIQXLDevice *qxl); +bool qxl_render_update(PCIQXLDevice *qxl); int qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext); void qxl_render_update_area_done(PCIQXLDevice *qxl, QXLCookie *cookie); void qxl_render_update_area_bh(void *opaque); diff --git a/include/ui/console.h b/include/ui/console.h index f04844263b9..0bc9e544fad 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -368,9 +368,14 @@ enum { typedef struct GraphicHwOps { int (*get_flags)(void *opaque); /* optional, default 0 */ 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); + /* + * Returns true if the update is handled synchronously, false if defer= red + * and graphic_hw_update_done() will be called when ready (to resume w= aiting + * tasks/coroutines). + * Optional. + */ + bool (*gfx_update)(void *opaque); + 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; diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 441a11100a3..ba88ed756e2 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -152,7 +152,7 @@ static inline void set_lcd_pixel32(musicpal_lcd_state *= s, } } =20 -static void lcd_refresh(void *opaque) +static bool lcd_refresh(void *opaque) { musicpal_lcd_state *s =3D opaque; int x, y, col; @@ -171,6 +171,7 @@ static void lcd_refresh(void *opaque) } =20 dpy_gfx_update(s->con, 0, 0, 128*3, 64*3); + return true; } =20 static void lcd_invalidate(void *opaque) diff --git a/hw/display/artist.c b/hw/display/artist.c index 206f77afba1..a07508378c7 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -1311,7 +1311,7 @@ static void artist_draw_line(void *opaque, uint8_t *d= , const uint8_t *src, } } =20 -static void artist_update_display(void *opaque) +static bool artist_update_display(void *opaque) { ARTISTState *s =3D opaque; DisplaySurface *surface =3D qemu_console_surface(s->con); @@ -1326,6 +1326,8 @@ static void artist_update_display(void *opaque) if (first >=3D 0) { dpy_gfx_update(s->con, 0, first, s->width, last - first + 1); } + + return true; } =20 static void artist_invalidate(void *opaque) diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c index 75d7c0f8499..83c4c03c7ca 100644 --- a/hw/display/bcm2835_fb.c +++ b/hw/display/bcm2835_fb.c @@ -150,7 +150,7 @@ static bool fb_use_offsets(BCM2835FBConfig *config) config->yres_virtual > config->yres; } =20 -static void fb_update_display(void *opaque) +static bool fb_update_display(void *opaque) { BCM2835FBState *s =3D opaque; DisplaySurface *surface =3D qemu_console_surface(s->con); @@ -161,7 +161,7 @@ static void fb_update_display(void *opaque) uint32_t xoff =3D 0, yoff =3D 0; =20 if (s->lock || !s->config.xres) { - return; + return true; } =20 src_width =3D bcm2835_fb_get_pitch(&s->config); @@ -174,7 +174,7 @@ static void fb_update_display(void *opaque) =20 switch (surface_bits_per_pixel(surface)) { case 0: - return; + return true; case 8: break; case 15: @@ -212,6 +212,7 @@ static void fb_update_display(void *opaque) } =20 s->invalidate =3D false; + return true; } =20 void bcm2835_fb_validate_config(BCM2835FBConfig *config) diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c index 5fb6b733cb5..8ef9b76cf85 100644 --- a/hw/display/bochs-display.c +++ b/hw/display/bochs-display.c @@ -198,7 +198,7 @@ static int bochs_display_get_mode(BochsDisplayState *s, return 0; } =20 -static void bochs_display_update(void *opaque) +static bool bochs_display_update(void *opaque) { BochsDisplayState *s =3D opaque; DirtyBitmapSnapshot *snap =3D NULL; @@ -212,7 +212,7 @@ static void bochs_display_update(void *opaque) ret =3D bochs_display_get_mode(s, &mode); if (ret < 0) { /* no (valid) video mode */ - return; + return true; } =20 if (memcmp(&s->mode, &mode, sizeof(mode)) !=3D 0) { @@ -255,6 +255,8 @@ static void bochs_display_update(void *opaque) =20 g_free(snap); } + + return true; } =20 static const GraphicHwOps bochs_display_gfx_ops =3D { diff --git a/hw/display/cg3.c b/hw/display/cg3.c index 0a413fbb7ec..963bb3427a6 100644 --- a/hw/display/cg3.c +++ b/hw/display/cg3.c @@ -85,7 +85,7 @@ struct CG3State { uint8_t dac_index, dac_state; }; =20 -static void cg3_update_display(void *opaque) +static bool cg3_update_display(void *opaque) { CG3State *s =3D opaque; DisplaySurface *surface =3D qemu_console_surface(s->con); @@ -98,7 +98,7 @@ static void cg3_update_display(void *opaque) DirtyBitmapSnapshot *snap =3D NULL; =20 if (surface_bits_per_pixel(surface) !=3D 32) { - return; + return true; } width =3D s->width; height =3D s->height; @@ -154,6 +154,7 @@ static void cg3_update_display(void *opaque) qemu_irq_raise(s->irq); } g_free(snap); + return true; } =20 static void cg3_invalidate_display(void *opaque) diff --git a/hw/display/dm163.c b/hw/display/dm163.c index 4feae912945..9ea62cb4f76 100644 --- a/hw/display/dm163.c +++ b/hw/display/dm163.c @@ -285,7 +285,7 @@ static uint32_t *update_display_of_row(DM163State *s, u= int32_t *dest, return dest; } =20 -static void dm163_update_display(void *opaque) +static bool dm163_update_display(void *opaque) { DM163State *s =3D (DM163State *)opaque; DisplaySurface *surface =3D qemu_console_surface(s->console); @@ -300,6 +300,8 @@ static void dm163_update_display(void *opaque) } dest =3D update_display_of_row(s, dest, row); } + + return true; } =20 static const GraphicHwOps dm163_ops =3D { diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c index 2d8fa7ee944..a91f04aaf79 100644 --- a/hw/display/exynos4210_fimd.c +++ b/hw/display/exynos4210_fimd.c @@ -1270,7 +1270,7 @@ static void exynos4210_update_resolution(Exynos4210fi= mdState *s) } } =20 -static void exynos4210_fimd_update(void *opaque) +static bool exynos4210_fimd_update(void *opaque) { Exynos4210fimdState *s =3D (Exynos4210fimdState *)opaque; DisplaySurface *surface; @@ -1287,7 +1287,7 @@ static void exynos4210_fimd_update(void *opaque) =20 if (!s || !s->console || !s->enabled || surface_bits_per_pixel(qemu_console_surface(s->console)) =3D=3D 0)= { - return; + return true; } =20 global_width =3D (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1; @@ -1348,6 +1348,8 @@ static void exynos4210_fimd_update(void *opaque) exynos4210_fimd_enable(s, false); } exynos4210_fimd_update_irq(s); + + return true; } =20 static void exynos4210_fimd_reset(DeviceState *d) diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c index 50952e9934b..bd15f6f0acc 100644 --- a/hw/display/g364fb.c +++ b/hw/display/g364fb.c @@ -238,15 +238,16 @@ static void g364fb_draw_blank(G364State *s) s->blanked =3D 1; } =20 -static void g364fb_update_display(void *opaque) +static bool g364fb_update_display(void *opaque) { G364State *s =3D opaque; DisplaySurface *surface =3D qemu_console_surface(s->con); =20 qemu_flush_coalesced_mmio_buffer(); =20 - if (s->width =3D=3D 0 || s->height =3D=3D 0) - return; + if (s->width =3D=3D 0 || s->height =3D=3D 0) { + return true; + } =20 if (s->width !=3D surface_width(surface) || s->height !=3D surface_height(surface)) { @@ -262,6 +263,8 @@ static void g364fb_update_display(void *opaque) } =20 qemu_irq_raise(s->irq); + + return true; } =20 static inline void g364fb_invalidate_display(void *opaque) diff --git a/hw/display/imx6ul_lcdif.c b/hw/display/imx6ul_lcdif.c index 33cd00fbe16..afcd0805ca4 100644 --- a/hw/display/imx6ul_lcdif.c +++ b/hw/display/imx6ul_lcdif.c @@ -152,7 +152,7 @@ static void imx6ul_lcdif_draw_line_xrgb8888(void *opaqu= e, uint8_t *dst, } } =20 -static void imx6ul_lcdif_update_display(void *opaque) +static bool imx6ul_lcdif_update_display(void *opaque) { IMX6ULLCDIFState *s =3D opaque; DisplaySurface *surface =3D qemu_console_surface(s->con); @@ -167,7 +167,7 @@ static void imx6ul_lcdif_update_display(void *opaque) int src_width; =20 if (!imx6ul_lcdif_is_running(s) || width =3D=3D 0 || height =3D=3D 0) { - return; + return true; } =20 switch (FIELD_EX32(ctrl, CTRL, WORD_LENGTH)) { @@ -180,7 +180,7 @@ static void imx6ul_lcdif_update_display(void *opaque) fn =3D imx6ul_lcdif_draw_line_xrgb8888; break; default: - return; + return true; } =20 if (surface_width(surface) !=3D width || surface_height(surface) !=3D = height) { @@ -207,6 +207,7 @@ static void imx6ul_lcdif_update_display(void *opaque) } =20 s->invalidate =3D false; + return true; } =20 static void imx6ul_lcdif_invalidate_display(void *opaque) diff --git a/hw/display/jazz_led.c b/hw/display/jazz_led.c index 9d62e51bed9..7d1a020d4d9 100644 --- a/hw/display/jazz_led.c +++ b/hw/display/jazz_led.c @@ -144,7 +144,7 @@ static void draw_vertical_line(DisplaySurface *ds, } } =20 -static void jazz_led_update_display(void *opaque) +static bool jazz_led_update_display(void *opaque) { LedState *s =3D opaque; DisplaySurface *surface =3D qemu_console_surface(s->con); @@ -186,7 +186,7 @@ static void jazz_led_update_display(void *opaque) color_led =3D rgb_to_pixel32(0x00, 0xff, 0x00); break; default: - return; + return true; } =20 /* display segments */ @@ -218,6 +218,8 @@ static void jazz_led_update_display(void *opaque) =20 s->state =3D REDRAW_NONE; dpy_gfx_update_full(s->con); + + return true; } =20 static void jazz_led_invalidate_display(void *opaque) diff --git a/hw/display/macfb.c b/hw/display/macfb.c index b8115c2be13..848c3c282bd 100644 --- a/hw/display/macfb.c +++ b/hw/display/macfb.c @@ -454,7 +454,7 @@ static gchar *macfb_mode_list(void) } =20 =20 -static void macfb_update_display(void *opaque) +static bool macfb_update_display(void *opaque) { MacfbState *s =3D opaque; DisplaySurface *surface =3D qemu_console_surface(s->con); @@ -462,7 +462,7 @@ static void macfb_update_display(void *opaque) qemu_flush_coalesced_mmio_buffer(); =20 if (s->width =3D=3D 0 || s->height =3D=3D 0) { - return; + return true; } =20 if (s->width !=3D surface_width(surface) || @@ -471,6 +471,8 @@ static void macfb_update_display(void *opaque) } =20 macfb_draw_graphic(s); + + return true; } =20 static void macfb_update_irq(MacfbState *s) diff --git a/hw/display/next-fb.c b/hw/display/next-fb.c index 3d97702fce5..e758b223ef7 100644 --- a/hw/display/next-fb.c +++ b/hw/display/next-fb.c @@ -67,7 +67,7 @@ static void nextfb_draw_line(void *opaque, uint8_t *d, co= nst uint8_t *s, } } =20 -static void nextfb_update(void *opaque) +static bool nextfb_update(void *opaque) { NeXTFbState *s =3D NEXTFB(opaque); int dest_width =3D 4; @@ -90,6 +90,8 @@ static void nextfb_update(void *opaque) s, &first, &last); =20 dpy_gfx_update(s->con, 0, 0, s->cols, s->rows); + + return true; } =20 static void nextfb_invalidate(void *opaque) diff --git a/hw/display/omap_lcdc.c b/hw/display/omap_lcdc.c index c41c65bb2e0..1e8385ebffb 100644 --- a/hw/display/omap_lcdc.c +++ b/hw/display/omap_lcdc.c @@ -197,7 +197,7 @@ static void draw_line16_32(void *opaque, uint8_t *d, co= nst uint8_t *s, } while (-- width !=3D 0); } =20 -static void omap_update_display(void *opaque) +static bool omap_update_display(void *opaque) { struct omap_lcd_panel_s *omap_lcd =3D opaque; DisplaySurface *surface; @@ -207,12 +207,12 @@ static void omap_update_display(void *opaque) hwaddr frame_base; =20 if (!omap_lcd || omap_lcd->plm =3D=3D 1 || !omap_lcd->enable) { - return; + return true; } =20 surface =3D qemu_console_surface(omap_lcd->con); if (!surface_bits_per_pixel(surface)) { - return; + return true; } =20 frame_offset =3D 0; @@ -256,7 +256,7 @@ static void omap_update_display(void *opaque) =20 default: /* Unsupported at the moment. */ - return; + return true; } =20 /* Resolution */ @@ -278,7 +278,7 @@ static void omap_update_display(void *opaque) omap_lcd->sync_error =3D 1; omap_lcd_interrupts(omap_lcd); omap_lcd->enable =3D 0; - return; + return true; } =20 /* Content */ @@ -291,7 +291,7 @@ static void omap_update_display(void *opaque) omap_lcd->dma->current_frame ^=3D 1; =20 if (!surface_bits_per_pixel(surface)) { - return; + return true; } =20 first =3D 0; @@ -323,6 +323,8 @@ static void omap_update_display(void *opaque) dpy_gfx_update(omap_lcd->con, 0, first, width, last - first + 1); } omap_lcd->invalidate =3D 0; + + return true; } =20 static void omap_invalidate_display(void *opaque) { diff --git a/hw/display/pl110.c b/hw/display/pl110.c index 4cd62a98757..e134ac28eb6 100644 --- a/hw/display/pl110.c +++ b/hw/display/pl110.c @@ -210,7 +210,7 @@ static int pl110_enabled(PL110State *s) return (s->cr & PL110_CR_EN) && (s->cr & PL110_CR_PWR); } =20 -static void pl110_update_display(void *opaque) +static bool pl110_update_display(void *opaque) { PL110State *s =3D (PL110State *)opaque; DisplaySurface *surface =3D qemu_console_surface(s->con); @@ -221,7 +221,7 @@ static void pl110_update_display(void *opaque) int last; =20 if (!pl110_enabled(s)) { - return; + return true; } =20 if (s->cr & PL110_CR_BGR) @@ -306,6 +306,7 @@ static void pl110_update_display(void *opaque) dpy_gfx_update(s->con, 0, first, s->cols, last - first + 1); } s->invalidate =3D 0; + return true; } =20 static void pl110_invalidate_display(void * opaque) diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c index c6a9ac1da10..5b4f8842011 100644 --- a/hw/display/qxl-render.c +++ b/hw/display/qxl-render.c @@ -173,7 +173,7 @@ end: * callbacks are called by spice_server thread, deferring to bh called fro= m the * io thread. */ -void qxl_render_update(PCIQXLDevice *qxl) +bool qxl_render_update(PCIQXLDevice *qxl) { QXLCookie *cookie; =20 @@ -183,8 +183,7 @@ void qxl_render_update(PCIQXLDevice *qxl) qxl->mode =3D=3D QXL_MODE_UNDEFINED) { qxl_render_update_area_unlocked(qxl); qemu_mutex_unlock(&qxl->ssd.lock); - graphic_hw_update_done(qxl->ssd.dcl.con); - return; + return true; } =20 qxl->guest_primary.commands =3D 0; @@ -195,6 +194,7 @@ void qxl_render_update(PCIQXLDevice *qxl) qxl_set_rect_to_surface(qxl, &cookie->u.render.area); qxl_spice_update_area(qxl, 0, &cookie->u.render.area, NULL, 0, 1 /* clear_dirty_region */, QXL_ASYNC, cookie= ); + return false; } =20 void qxl_render_update_area_bh(void *opaque) diff --git a/hw/display/qxl.c b/hw/display/qxl.c index f8fd7ee0698..0a3c42c8ec2 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -122,7 +122,7 @@ static void qxl_reset_memslots(PCIQXLDevice *d); static void qxl_reset_surfaces(PCIQXLDevice *d); static void qxl_ring_set_dirty(PCIQXLDevice *qxl); =20 -static void qxl_hw_update(void *opaque); +static bool qxl_hw_update(void *opaque); =20 void qxl_set_guest_bug(PCIQXLDevice *qxl, const char *msg, ...) { @@ -1144,7 +1144,6 @@ static const QXLInterface qxl_interface =3D { =20 static const GraphicHwOps qxl_ops =3D { .gfx_update =3D qxl_hw_update, - .gfx_update_async =3D true, }; =20 static void qxl_enter_vga_mode(PCIQXLDevice *d) @@ -1928,11 +1927,11 @@ static void qxl_send_events(PCIQXLDevice *d, uint32= _t events) =20 /* graphics console */ =20 -static void qxl_hw_update(void *opaque) +static bool qxl_hw_update(void *opaque) { PCIQXLDevice *qxl =3D opaque; =20 - qxl_render_update(qxl); + return qxl_render_update(qxl); } =20 static void qxl_dirty_one_surface(PCIQXLDevice *qxl, QXLPHYSICAL pqxl, diff --git a/hw/display/ramfb-standalone.c b/hw/display/ramfb-standalone.c index f1958be32ad..27f0ba19f90 100644 --- a/hw/display/ramfb-standalone.c +++ b/hw/display/ramfb-standalone.c @@ -20,7 +20,7 @@ struct RAMFBStandaloneState { bool use_legacy_x86_rom; }; =20 -static void display_update_wrapper(void *dev) +static bool display_update_wrapper(void *dev) { RAMFBStandaloneState *ramfb =3D RAMFB(dev); =20 @@ -29,6 +29,8 @@ static void display_update_wrapper(void *dev) } else { ramfb_display_update(ramfb->con, ramfb->state); } + + return true; } =20 static const GraphicHwOps wrapper_ops =3D { diff --git a/hw/display/sm501.c b/hw/display/sm501.c index a07aa9886f9..a3993ceba29 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1716,7 +1716,7 @@ static void draw_hwc_line_32(uint8_t *d, const uint8_= t *s, int width, } } =20 -static void sm501_update_display(void *opaque) +static bool sm501_update_display(void *opaque) { SM501State *s =3D opaque; DisplaySurface *surface =3D qemu_console_surface(s->con); @@ -1740,7 +1740,7 @@ static void sm501_update_display(void *opaque) =20 if (!((crt ? s->dc_crt_control : s->dc_panel_control) & SM501_DC_CRT_CONTROL_ENABLE)) { - return; + return true; } =20 palette =3D (uint32_t *)(crt ? &s->dc_palette[SM501_DC_CRT_PALETTE - @@ -1761,7 +1761,7 @@ static void sm501_update_display(void *opaque) default: qemu_log_mask(LOG_GUEST_ERROR, "sm501: update display" "invalid control register value.\n"); - return; + return true; } =20 /* set up to draw hardware cursor */ @@ -1833,6 +1833,8 @@ static void sm501_update_display(void *opaque) if (y_start >=3D 0) { dpy_gfx_update(s->con, 0, y_start, width, y - y_start); } + + return true; } =20 static const GraphicHwOps sm501_ops =3D { diff --git a/hw/display/ssd0303.c b/hw/display/ssd0303.c index 87781438cd5..229856cc427 100644 --- a/hw/display/ssd0303.c +++ b/hw/display/ssd0303.c @@ -203,7 +203,7 @@ static int ssd0303_event(I2CSlave *i2c, enum i2c_event = event) return 0; } =20 -static void ssd0303_update_display(void *opaque) +static bool ssd0303_update_display(void *opaque) { ssd0303_state *s =3D (ssd0303_state *)opaque; DisplaySurface *surface =3D qemu_console_surface(s->con); @@ -218,11 +218,11 @@ static void ssd0303_update_display(void *opaque) uint8_t mask; =20 if (!s->redraw) - return; + return true; =20 switch (surface_bits_per_pixel(surface)) { case 0: - return; + return true; case 15: dest_width =3D 2; break; @@ -237,7 +237,7 @@ static void ssd0303_update_display(void *opaque) break; default: BADF("Bad color depth\n"); - return; + return true; } dest_width *=3D MAGNIFY; memset(colortab, 0xff, dest_width); @@ -269,6 +269,8 @@ static void ssd0303_update_display(void *opaque) } s->redraw =3D 0; dpy_gfx_update(s->con, 0, 0, 96 * MAGNIFY, 16 * MAGNIFY); + + return true; } =20 static void ssd0303_invalidate_display(void * opaque) diff --git a/hw/display/ssd0323.c b/hw/display/ssd0323.c index af5ff4fecdc..67db16086c8 100644 --- a/hw/display/ssd0323.c +++ b/hw/display/ssd0323.c @@ -181,7 +181,7 @@ static uint32_t ssd0323_transfer(SSIPeripheral *dev, ui= nt32_t data) return 0; } =20 -static void ssd0323_update_display(void *opaque) +static bool ssd0323_update_display(void *opaque) { ssd0323_state *s =3D (ssd0323_state *)opaque; DisplaySurface *surface =3D qemu_console_surface(s->con); @@ -197,11 +197,11 @@ static void ssd0323_update_display(void *opaque) int dest_width; =20 if (!s->redraw) - return; + return true; =20 switch (surface_bits_per_pixel(surface)) { case 0: - return; + return true; case 15: dest_width =3D 2; break; @@ -216,7 +216,7 @@ static void ssd0323_update_display(void *opaque) break; default: BADF("Bad color depth\n"); - return; + return true; } p =3D colortab; for (i =3D 0; i < 16; i++) { @@ -240,7 +240,7 @@ static void ssd0323_update_display(void *opaque) break; default: BADF("Bad color depth\n"); - return; + return true; } p +=3D dest_width; } @@ -271,6 +271,7 @@ static void ssd0323_update_display(void *opaque) } s->redraw =3D 0; dpy_gfx_update(s->con, 0, 0, 128 * MAGNIFY, 64 * MAGNIFY); + return true; } =20 static void ssd0323_invalidate_display(void * opaque) diff --git a/hw/display/tcx.c b/hw/display/tcx.c index ea92a48400c..cedbf5c7acd 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -209,7 +209,7 @@ static inline void tcx24_draw_line32(TCXState *s1, uint= 8_t *d, /* Fixed line length 1024 allows us to do nice tricks not possible on VGA... */ =20 -static void tcx_update_display(void *opaque) +static bool tcx_update_display(void *opaque) { TCXState *ts =3D opaque; DisplaySurface *surface =3D qemu_console_surface(ts->con); @@ -257,9 +257,10 @@ static void tcx_update_display(void *opaque) ts->width, y - y_start); } g_free(snap); + return true; } =20 -static void tcx24_update_display(void *opaque) +static bool tcx24_update_display(void *opaque) { TCXState *ts =3D opaque; DisplaySurface *surface =3D qemu_console_surface(ts->con); @@ -312,6 +313,7 @@ static void tcx24_update_display(void *opaque) ts->width, y - y_start); } g_free(snap); + return true; } =20 static void tcx_invalidate_display(void *opaque) diff --git a/hw/display/vga.c b/hw/display/vga.c index 0d69a53f27a..776aa443246 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -1783,7 +1783,7 @@ static void vga_draw_blank(VGACommonState *s, int ful= l_update) #define GMODE_GRAPH 1 #define GMODE_BLANK 2 =20 -static void vga_update_display(void *opaque) +static bool vga_update_display(void *opaque) { VGACommonState *s =3D opaque; DisplaySurface *surface =3D qemu_console_surface(s->con); @@ -1818,6 +1818,8 @@ static void vga_update_display(void *opaque) break; } } + + return true; } =20 /* force a full display refresh */ diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index cb76302e2d8..94cf362d152 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -83,8 +83,9 @@ static void virtio_gpu_invalidate_display(void *opaque) { } =20 -static void virtio_gpu_update_display(void *opaque) +static bool virtio_gpu_update_display(void *opaque) { + return true; } =20 static void virtio_gpu_text_update(void *opaque, console_ch_t *chardata) diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index 5e087169f2f..f4713b91a66 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -19,15 +19,15 @@ static void virtio_vga_base_invalidate_display(void *op= aque) } } =20 -static void virtio_vga_base_update_display(void *opaque) +static bool virtio_vga_base_update_display(void *opaque) { VirtIOVGABase *vvga =3D opaque; VirtIOGPUBase *g =3D vvga->vgpu; =20 if (g->enable) { - g->hw_ops->gfx_update(g); + return g->hw_ops->gfx_update(g); } else { - vvga->vga.hw_ops->gfx_update(&vvga->vga); + return vvga->vga.hw_ops->gfx_update(&vvga->vga); } } =20 diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 2b95787ddfd..c84c84a445e 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -1135,14 +1135,13 @@ static inline void vmsvga_check_size(struct vmsvga_= state_s *s) } } =20 -static void vmsvga_update_display(void *opaque) +static bool vmsvga_update_display(void *opaque) { struct vmsvga_state_s *s =3D opaque; =20 if (!s->enable || !s->config) { /* in standard vga mode */ - s->vga.hw_ops->gfx_update(&s->vga); - return; + return s->vga.hw_ops->gfx_update(&s->vga); } =20 vmsvga_check_size(s); @@ -1154,6 +1153,8 @@ static void vmsvga_update_display(void *opaque) s->invalidated =3D 0; dpy_gfx_update_full(s->vga.con); } + + return true; } =20 static void vmsvga_reset(DeviceState *dev) diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index ba886a940ee..2e431e27be6 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -709,14 +709,14 @@ static void xenfb_send_refresh_period(struct XenFB *x= enfb, int period) * Our screen might be inactive. When asked for * an update we know it is active. */ -static void xenfb_update(void *opaque) +static bool xenfb_update(void *opaque) { struct XenFB *xenfb =3D opaque; DisplaySurface *surface; int i; =20 if (xenfb->c.xendev.be_state !=3D XenbusStateConnected) - return; + return true; =20 if (!xenfb->feature_update) { /* we don't get update notifications, thus use the @@ -770,6 +770,8 @@ static void xenfb_update(void *opaque) } xenfb->up_count =3D 0; xenfb->up_fullscreen =3D 0; + + return true; } =20 static void xenfb_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info) diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index 7d037b46a35..50e6ef10984 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -1252,12 +1252,12 @@ static inline void xlnx_dp_blend_surface(XlnxDPStat= e *s) surface_height(s->g_plane.surface)); } =20 -static void xlnx_dp_update_display(void *opaque) +static bool xlnx_dp_update_display(void *opaque) { XlnxDPState *s =3D XLNX_DP(opaque); =20 if ((s->core_registers[DP_TRANSMITTER_ENABLE] & 0x01) =3D=3D 0) { - return; + return true; } =20 xlnx_dpdma_trigger_vsync_irq(s->dpdma); @@ -1272,14 +1272,14 @@ static void xlnx_dp_update_display(void *opaque) */ s->core_registers[DP_INT_STATUS] |=3D (1 << 21); xlnx_dp_update_irq(s); - return; + return true; } =20 if (xlnx_dp_global_alpha_enabled(s)) { if (!xlnx_dpdma_start_operation(s->dpdma, 0, false)) { s->core_registers[DP_INT_STATUS] |=3D (1 << 21); xlnx_dp_update_irq(s); - return; + return true; } xlnx_dp_blend_surface(s); } @@ -1288,6 +1288,8 @@ static void xlnx_dp_update_display(void *opaque) * XXX: We might want to update only what changed. */ dpy_gfx_update_full(s->console); + + return true; } =20 static const GraphicHwOps xlnx_dp_gfx_ops =3D { diff --git a/hw/vfio/display.c b/hw/vfio/display.c index 5a42a6f7a29..4a9a58036e3 100644 --- a/hw/vfio/display.c +++ b/hw/vfio/display.c @@ -285,7 +285,7 @@ static void vfio_display_free_dmabufs(VFIOPCIDevice *vd= ev) } } =20 -static void vfio_display_dmabuf_update(void *opaque) +static bool vfio_display_dmabuf_update(void *opaque) { VFIOPCIDevice *vdev =3D opaque; VFIODisplay *dpy =3D vdev->dpy; @@ -298,7 +298,7 @@ static void vfio_display_dmabuf_update(void *opaque) if (dpy->ramfb) { ramfb_display_update(dpy->con, dpy->ramfb); } - return; + return true; } =20 width =3D qemu_dmabuf_get_width(primary->buf); @@ -340,6 +340,8 @@ static void vfio_display_dmabuf_update(void *opaque) if (free_bufs) { vfio_display_free_dmabufs(vdev); } + + return true; } =20 static int vfio_display_get_flags(void *opaque) @@ -399,7 +401,7 @@ void vfio_display_reset(VFIOPCIDevice *vdev) dpy_gfx_update_full(vdev->dpy->con); } =20 -static void vfio_display_region_update(void *opaque) +static bool vfio_display_region_update(void *opaque) { VFIOPCIDevice *vdev =3D opaque; VFIODisplay *dpy =3D vdev->dpy; @@ -414,18 +416,18 @@ static void vfio_display_region_update(void *opaque) if (ret < 0) { error_report("ioctl VFIO_DEVICE_QUERY_GFX_PLANE: %s", strerror(errno)); - return; + return true; } if (!plane.drm_format || !plane.size) { if (dpy->ramfb) { ramfb_display_update(dpy->con, dpy->ramfb); dpy->region.surface =3D NULL; } - return; + return true; } format =3D qemu_drm_format_to_pixman(plane.drm_format); if (!format) { - return; + return true; } =20 if (dpy->region.buffer.size && @@ -476,11 +478,12 @@ static void vfio_display_region_update(void *opaque) dpy_gfx_update(dpy->con, 0, 0, surface_width(dpy->region.surface), surface_height(dpy->region.surface)); - return; + return true; =20 err: vfio_region_exit(&dpy->region.buffer); vfio_region_finalize(&dpy->region.buffer); + return true; } =20 static const GraphicHwOps vfio_display_region_ops =3D { diff --git a/ui/console.c b/ui/console.c index abb6cba2826..a608c29b843 100644 --- a/ui/console.c +++ b/ui/console.c @@ -136,15 +136,10 @@ void graphic_hw_update_done(QemuConsole *con) =20 void graphic_hw_update(QemuConsole *con) { - bool async =3D false; if (!con) { return; } - if (con->hw_ops->gfx_update) { - con->hw_ops->gfx_update(con->hw); - async =3D con->hw_ops->gfx_update_async; - } - if (!async) { + if (!con->hw_ops->gfx_update || con->hw_ops->gfx_update(con->hw)) { graphic_hw_update_done(con); } } diff --git a/hw/display/apple-gfx.m b/hw/display/apple-gfx.m index e0a765fcb1f..77d80fb7cef 100644 --- a/hw/display/apple-gfx.m +++ b/hw/display/apple-gfx.m @@ -330,25 +330,25 @@ static void apple_gfx_render_frame_completed_bh(void = *opaque) } } =20 -static void apple_gfx_fb_update_display(void *opaque) +static bool apple_gfx_fb_update_display(void *opaque) { AppleGFXState *s =3D opaque; + bool done =3D true; =20 assert(bql_locked()); if (s->new_frame_ready) { dpy_gfx_update_full(s->con); s->new_frame_ready =3D false; - graphic_hw_update_done(s->con); } else if (s->pending_frames > 0) { s->gfx_update_requested =3D true; - } else { - graphic_hw_update_done(s->con); + done =3D false; } + + return done; } =20 static const GraphicHwOps apple_gfx_fb_ops =3D { .gfx_update =3D apple_gfx_fb_update_display, - .gfx_update_async =3D true, }; =20 /* ------ Mouse cursor and display mode setting ------ */ --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388941; cv=none; d=zohomail.com; s=zohoarc; b=ZOBCy9tTIQuyr5u1g3CpC1b+KQrX3ZT7nOzneVP+i1bIf+RrgBe8mBSy201g0uhg19Fw8jmTdajp9qRlvW+aF/bXtZPB7f0DGThuYMR1B8o92JL8r7vaaU7OzBgwQFHi+ECEZZggFQVbFG944MjJ2Uh4HJf4ePHfOwT2JnIHYn0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388941; 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=l2i3x+eDYXXk9cfWr/IeBQOYE2X03s17Dn3GAzkjgRY=; b=jFFRwJidOeFgr5v7HFpQnQ3DTu1n+JRIXP92TbrtkldGZO/hNy9kffF8sw9SLuH5SnGC5YmsISPPV9trY/hu9KxdRQ03b4dZFtYagDvUte74MK2jei1IdxoIbRCp3quGJ19etynL9XUp3lDwIVwF87hNHMmkDjJ2qkg8u+pxnH0= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388941768421.1961075822377; Tue, 28 Apr 2026 08:09:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk3E-0002tf-7w; Tue, 28 Apr 2026 11:08:40 -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 1wHk3B-0002jZ-FV for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:37 -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 1wHk39-0000ka-EV for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:37 -0400 Received: from mx-prod-mc-03.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-655-1zk_ZmlzNyKvsRS6mNQPSA-1; Tue, 28 Apr 2026 11:08:30 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1B9F21956056; Tue, 28 Apr 2026 15:08:29 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B2DD5180047F; Tue, 28 Apr 2026 15:08:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388914; 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=l2i3x+eDYXXk9cfWr/IeBQOYE2X03s17Dn3GAzkjgRY=; b=BpauzZ8nkfXwVf/eeombGxd11b/P6N/k7/rt/AITGsahE/ZmIUJ2lEL2t+ua8tzPfnM/Hs 8YiCSLGzy9lW9XCNgzb5Ga0JViqsOzSkbgT+yv0sRmHm/H7aUnP9l/6TDJflvHIOzIXUAo MLDDloJ7PVShJCVtAKRvEvxqkiJluq8= X-MC-Unique: 1zk_ZmlzNyKvsRS6mNQPSA-1 X-Mimecast-MFC-AGG-ID: 1zk_ZmlzNyKvsRS6mNQPSA_1777388909 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL v2 09/15] ui/console: move console_handle_touch_event() to input Date: Tue, 28 Apr 2026 19:07:19 +0400 Message-ID: <20260428150726.1659814-10-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388944687154100 From: Marc-Andr=C3=A9 Lureau The function uses input.c functions to provide a simpler abstraction for touch events. Let's move it from the already overloaded console.c, and to avoid some unnecessary dependency from console.c on input.c. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/console.h | 14 ---------- include/ui/input.h | 15 ++++++++++ ui/console.c | 65 -------------------------------------------- ui/dbus-console.c | 6 ++-- ui/gtk.c | 8 +++--- ui/input.c | 65 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 87 insertions(+), 86 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 0bc9e544fad..27eacc39cc0 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -111,20 +111,6 @@ void qemu_text_console_put_keysym(QemuTextConsole *s, = int keysym); bool qemu_text_console_put_qcode(QemuTextConsole *s, int qcode, bool ctrl); void qemu_text_console_put_string(QemuTextConsole *s, const char *str, int= len); =20 -/* Touch devices */ -typedef struct touch_slot { - int x; - int y; - int tracking_id; -} touch_slot; - -void console_handle_touch_event(QemuConsole *con, - struct touch_slot touch_slots[INPUT_EVENT_= SLOTS_MAX], - uint64_t num_slot, - int width, int height, - double x, double y, - InputMultiTouchType type, - Error **errp); /* consoles */ =20 struct QemuConsoleClass { diff --git a/include/ui/input.h b/include/ui/input.h index 8f9aac562ed..52c164bde57 100644 --- a/include/ui/input.h +++ b/include/ui/input.h @@ -70,6 +70,21 @@ void qemu_input_queue_mtt_abs(QemuConsole *src, InputAxi= s axis, int value, int min_in, int max_in, int slot, int tracking_id); =20 +/* Touch devices */ +typedef struct touch_slot { + int x; + int y; + int tracking_id; +} touch_slot; + +void qemu_input_touch_event(QemuConsole *con, + struct touch_slot touch_slots[INPUT_EVENT_SLOT= S_MAX], + uint64_t num_slot, + int width, int height, + double x, double y, + InputMultiTouchType type, + Error **errp); + void qemu_input_check_mode_change(void); void qemu_add_mouse_mode_change_notifier(Notifier *notify); void qemu_remove_mouse_mode_change_notifier(Notifier *notify); diff --git a/ui/console.c b/ui/console.c index a608c29b843..799d61ec1a5 100644 --- a/ui/console.c +++ b/ui/console.c @@ -548,71 +548,6 @@ static bool console_compatible_with(QemuConsole *con, return true; } =20 -void console_handle_touch_event(QemuConsole *con, - struct touch_slot touch_slots[INPUT_EVENT_= SLOTS_MAX], - uint64_t num_slot, - int width, int height, - double x, double y, - InputMultiTouchType type, - Error **errp) -{ - struct touch_slot *slot; - bool needs_sync =3D false; - int update; - int i; - - if (num_slot >=3D INPUT_EVENT_SLOTS_MAX) { - error_setg(errp, - "Unexpected touch slot number: % " PRId64" >=3D %d", - num_slot, INPUT_EVENT_SLOTS_MAX); - return; - } - - slot =3D &touch_slots[num_slot]; - slot->x =3D x; - slot->y =3D y; - - if (type =3D=3D INPUT_MULTI_TOUCH_TYPE_BEGIN) { - slot->tracking_id =3D num_slot; - } - - for (i =3D 0; i < INPUT_EVENT_SLOTS_MAX; ++i) { - if (i =3D=3D num_slot) { - update =3D type; - } else { - update =3D INPUT_MULTI_TOUCH_TYPE_UPDATE; - } - - slot =3D &touch_slots[i]; - - if (slot->tracking_id =3D=3D -1) { - continue; - } - - if (update =3D=3D INPUT_MULTI_TOUCH_TYPE_END) { - slot->tracking_id =3D -1; - qemu_input_queue_mtt(con, update, i, slot->tracking_id); - needs_sync =3D true; - } else { - qemu_input_queue_mtt(con, update, i, slot->tracking_id); - qemu_input_queue_btn(con, INPUT_BUTTON_TOUCH, true); - qemu_input_queue_mtt_abs(con, - INPUT_AXIS_X, (int) slot->x, - 0, width, - i, slot->tracking_id); - qemu_input_queue_mtt_abs(con, - INPUT_AXIS_Y, (int) slot->y, - 0, height, - i, slot->tracking_id); - needs_sync =3D true; - } - } - - if (needs_sync) { - qemu_input_event_sync(); - } -} - void qemu_console_set_display_gl_ctx(QemuConsole *con, DisplayGLCtx *gl) { /* display has opengl support */ diff --git a/ui/dbus-console.c b/ui/dbus-console.c index 85e215ef233..564f004bd86 100644 --- a/ui/dbus-console.c +++ b/ui/dbus-console.c @@ -424,9 +424,9 @@ dbus_touch_send_event(DBusDisplayConsole *ddc, width =3D qemu_console_get_width(ddc->dcl.con, 0); height =3D qemu_console_get_height(ddc->dcl.con, 0); =20 - console_handle_touch_event(ddc->dcl.con, touch_slots, - num_slot, width, height, - x, y, kind, &error); + qemu_input_touch_event(ddc->dcl.con, touch_slots, + num_slot, width, height, + x, y, kind, &error); if (error !=3D NULL) { g_dbus_method_invocation_return_error( invocation, DBUS_DISPLAY_ERROR, diff --git a/ui/gtk.c b/ui/gtk.c index 9ebe7e8df0d..8fd39c90c29 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1201,10 +1201,10 @@ static gboolean gd_touch_event(GtkWidget *widget, G= dkEventTouch *touch, return FALSE; } =20 - console_handle_touch_event(vc->gfx.dcl.con, touch_slots, - num_slot, surface_width(vc->gfx.ds), - surface_height(vc->gfx.ds), touch->x, - touch->y, type, &err); + qemu_input_touch_event(vc->gfx.dcl.con, touch_slots, + num_slot, surface_width(vc->gfx.ds), + surface_height(vc->gfx.ds), touch->x, + touch->y, type, &err); if (err) { warn_report_err(err); } diff --git a/ui/input.c b/ui/input.c index 147e69c1c3c..57e7817878a 100644 --- a/ui/input.c +++ b/ui/input.c @@ -609,3 +609,68 @@ bool qemu_mouse_set(int index, Error **errp) notifier_list_notify(&mouse_mode_notifiers, NULL); return true; } + +void qemu_input_touch_event(QemuConsole *con, + struct touch_slot touch_slots[INPUT_EVENT_SLOT= S_MAX], + uint64_t num_slot, + int width, int height, + double x, double y, + InputMultiTouchType type, + Error **errp) +{ + struct touch_slot *slot; + bool needs_sync =3D false; + int update; + int i; + + if (num_slot >=3D INPUT_EVENT_SLOTS_MAX) { + error_setg(errp, + "Unexpected touch slot number: % " PRId64" >=3D %d", + num_slot, INPUT_EVENT_SLOTS_MAX); + return; + } + + slot =3D &touch_slots[num_slot]; + slot->x =3D x; + slot->y =3D y; + + if (type =3D=3D INPUT_MULTI_TOUCH_TYPE_BEGIN) { + slot->tracking_id =3D num_slot; + } + + for (i =3D 0; i < INPUT_EVENT_SLOTS_MAX; ++i) { + if (i =3D=3D num_slot) { + update =3D type; + } else { + update =3D INPUT_MULTI_TOUCH_TYPE_UPDATE; + } + + slot =3D &touch_slots[i]; + + if (slot->tracking_id =3D=3D -1) { + continue; + } + + if (update =3D=3D INPUT_MULTI_TOUCH_TYPE_END) { + slot->tracking_id =3D -1; + qemu_input_queue_mtt(con, update, i, slot->tracking_id); + needs_sync =3D true; + } else { + qemu_input_queue_mtt(con, update, i, slot->tracking_id); + qemu_input_queue_btn(con, INPUT_BUTTON_TOUCH, true); + qemu_input_queue_mtt_abs(con, + INPUT_AXIS_X, (int) slot->x, + 0, width, + i, slot->tracking_id); + qemu_input_queue_mtt_abs(con, + INPUT_AXIS_Y, (int) slot->y, + 0, height, + i, slot->tracking_id); + needs_sync =3D true; + } + } + + if (needs_sync) { + qemu_input_event_sync(); + } +} --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388968; cv=none; d=zohomail.com; s=zohoarc; b=VE2n0nz+x15cc3NTHgT1i4uMBEUVCpNtMs5D3a/PKolaKFVQHiUQYXTe9hr8UJFajtGHFeu2KkhPD9ntF3Zxs8vjonXRlAicif/d43NNdWcaSHvFyhKyjvcWQjfTgb2vS6LeAjrqshrl5O/qui1ChgMQV4R/mgYJBTluNTLEmzo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388968; 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=2qYOlV1SmWsUXxHnuxYiPGAE5z0mVJxCFAeqLYhhApk=; b=HPKn7vZBhWaEw7o8Jjl8XTrWCI1tTnmt6DWAg7tf0b4AbTJmfjxXa4A1b1BZgJ1Na/ZL3kMXFSbRJMXxGfnHZJLgIkIJiFXclx7dbPMhfXqJT3wGP1SdtuMUmFL27kKvUcYaKP4XuBDutsj3w8TyKRDEA0vvBgjDUg5zP1uAfx0= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388968507208.51768988186313; Tue, 28 Apr 2026 08:09:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk3H-000343-TT; Tue, 28 Apr 2026 11:08:44 -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 1wHk3E-0002vQ-Fw for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:40 -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 1wHk3C-0000mb-Tc for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:40 -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-509-_0qAWUZEPm65M7b0VACiqw-1; Tue, 28 Apr 2026 11:08:36 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 6B3D8195608F; Tue, 28 Apr 2026 15:08:35 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EF585300756E; Tue, 28 Apr 2026 15:08:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388918; 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=2qYOlV1SmWsUXxHnuxYiPGAE5z0mVJxCFAeqLYhhApk=; b=F45mtmXOyLNtt2naoOwjOGIzYv5gook96lBzTNxcLX6GNgvvLazrQyb3TQzYMl+GQnUdIm 4PoImWQU3FZsIrwsXZ+CdtP1ulZ9N2+QlRM7Ntkn47ENJsPQX+LiaHFUt5Lefiqmvt+wQ9 bF3AXJMJgrhdjyYQbq+u/udlQd5wYfE= X-MC-Unique: _0qAWUZEPm65M7b0VACiqw-1 X-Mimecast-MFC-AGG-ID: _0qAWUZEPm65M7b0VACiqw_1777388915 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL v2 10/15] ui/dbus: fix warning for clients without "Interfaces" property Date: Tue, 28 Apr 2026 19:07:20 +0400 Message-ID: <20260428150726.1659814-11-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.4.1 on 10.30.177.4 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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388969003158500 From: Marc-Andr=C3=A9 Lureau The "Interfaces" property is not strictly required. We can just assume the peer doesn't implement the given interface. Fix warning: GLib: g_strv_contains: assertion 'strv !=3D NULL' failed Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- ui/dbus-listener.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 37945236e11..e5ce92d1257 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -1026,9 +1026,11 @@ static bool dbus_display_listener_implements(DBusDisplayListener *ddl, const char *ifa= ce) { QemuDBusDisplay1Listener *l =3D QEMU_DBUS_DISPLAY1_LISTENER(ddl->proxy= ); + const char * const *interfaces; bool implements; =20 - implements =3D g_strv_contains(qemu_dbus_display1_listener_get_interfa= ces(l), iface); + interfaces =3D qemu_dbus_display1_listener_get_interfaces(l); + implements =3D interfaces && g_strv_contains(interfaces, iface); if (!implements) { g_debug("Display listener does not implement: `%s`", iface); } --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388955; cv=none; d=zohomail.com; s=zohoarc; b=dK/mamk37s7vZXc5b1HRDfiGXkDlwAJRum9VKBQTmsq+cHARPVvsHUrLgsWcj7HXku7s/rgM2QpD/lPUB8GPwgfb2UNi6EUEWPQ6FfGffuNRTkfpv6QyznfQejqAFIMOT/l+M01tIJO8wQ3Y/ZOZKLmK+VmtIx/FK95+G+Taie8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388955; 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=/4dw0TKad5+u05fn1weSA41ZKAGASs/MiPnBMcB8wio=; b=X3oMhoXgkODIWrliJa1YAodux3VvPh8yfJSe/gomZltQuy39oJyTYWgiZdid5mxC18zMAOpMINNi5opDgkjaHmmGqubmXNWIMJT8oSgQQ6NUtoWhMhrLG/e1069BS1i9BDIVf+8aU1SGQwYihy52Q3dytBlDQGWYduFcbq/2czk= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388955154338.3347627302087; Tue, 28 Apr 2026 08:09:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk3Q-0003dp-Jl; Tue, 28 Apr 2026 11:08:52 -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 1wHk3M-0003N4-Fa for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:48 -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 1wHk3K-0000o3-VK for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:48 -0400 Received: from mx-prod-mc-03.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-121-ADwhjxkFMbGUAqQifHPa1g-1; Tue, 28 Apr 2026 11:08:42 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 81F701935305; Tue, 28 Apr 2026 15:08:41 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B12D4195608E; Tue, 28 Apr 2026 15:08:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388926; 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=/4dw0TKad5+u05fn1weSA41ZKAGASs/MiPnBMcB8wio=; b=PtLgB6rzyFZyTanS1vRUfYyMRaZUPvsVNQYIjbJ1BCKY7Uo/BkApsRiAF8cxLBeuHB1qVr Ne2jUkPaX007ba7rEVyscB/hoRW0H8rLPtk5iD6IPtjg6tsDRT5vcvDBY2BTriPSqsQ5fJ ZkVR1pDK85h44K3bepgp5vTd/hExNc8= X-MC-Unique: ADwhjxkFMbGUAqQifHPa1g-1 X-Mimecast-MFC-AGG-ID: ADwhjxkFMbGUAqQifHPa1g_1777388921 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, Akihiko Odaki , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL v2 11/15] audio: Avoid unsigned sample wraparound Date: Tue, 28 Apr 2026 19:07:21 +0400 Message-ID: <20260428150726.1659814-12-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.0 on 10.30.177.17 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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388957141154100 From: Akihiko Odaki When !defined(SIGNED), nv - HALF will wrap around if nv < HALF because nv and HALF are unsigned. Fix it by casting nv to mixeng_real, which is signed. Signed-off-by: Akihiko Odaki Acked-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260423-audio-v1-1-e1d6b65c76f9@rsg.ci.i.u-tokyo.ac.jp> --- audio/mixeng_template.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/audio/mixeng_template.h b/audio/mixeng_template.h index bc8509e423f..881653c44bf 100644 --- a/audio/mixeng_template.h +++ b/audio/mixeng_template.h @@ -43,13 +43,13 @@ static inline mixeng_real glue (conv_, ET) (IN_T v) #ifdef SIGNED return nv * (2.f / ((mixeng_real)IN_MAX - IN_MIN)); #else - return (nv - HALF) * (2.f / (mixeng_real)IN_MAX); + return ((mixeng_real)nv - HALF) * (2.f / (mixeng_real)IN_MAX); #endif #else /* !RECIPROCAL */ #ifdef SIGNED return nv / (((mixeng_real)IN_MAX - IN_MIN) / 2.f); #else - return (nv - HALF) / ((mixeng_real)IN_MAX / 2.f); + return ((mixeng_real)nv - HALF) / ((mixeng_real)IN_MAX / 2.f); #endif #endif } --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388970; cv=none; d=zohomail.com; s=zohoarc; b=W88MSLrZpIJ3U8Wg14UUQIRtCYSmH9kFhVFvaQ4+t/wa7aNDh6d9hBwChMDdUQSjCA1WD6OV7ZRZvbX+V+YX6jnU8mO3oO0z9RUl2iNsCl2CXu+QBE0f1GX8YfSMUNe/wmrIpMoaOqEV4Vl+pvUg/05lcO9muilUrEJzQYpKIKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388970; 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=C1siF59IQLLkwWV4Hr2hpuNpiCtK/UTs8uPqiiiQpCo=; b=X9xd05A6XkzZEEczGaXSFJAxxlz6gdCfAZO8Gf+a8NSLKOROypj3fSfoo/LL6OzfPrILBLxaZ3XiAeFNqCtS32xC90Brje2Zh2Frti7LwfcJaOH9Gn67Xy2yNoQ7VwtE4+cIjmhB/4PfcMDftz4Wo3LJI74EPqULweZFj4yTjYw= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388970494490.9065128175838; Tue, 28 Apr 2026 08:09:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk3Y-00045p-KU; Tue, 28 Apr 2026 11:09:01 -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 1wHk3U-0003sT-HC for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:56 -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 1wHk3T-0000pv-0r for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:08:56 -0400 Received: from mx-prod-mc-03.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-365-vUPXfbJ0MqurTAMYq5-mdA-1; Tue, 28 Apr 2026 11:08:49 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1E3501954B1B; Tue, 28 Apr 2026 15:08:48 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 952B619560B7; Tue, 28 Apr 2026 15:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388934; 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=C1siF59IQLLkwWV4Hr2hpuNpiCtK/UTs8uPqiiiQpCo=; b=M6zUa8iVzpGOsFJDRXgTMIBm+uJW8c9khUx18ad+n+JhHF5EZxdAgGrHixxLz6tddxfnk5 /yrutyMQQQ7GBQT8Og3cWauJIAov1qMcSb/XyDOou4b1l24q/gPy8ZKKZCiiKYrImwpk6B RhSO8yIlCDsD2KY/QY39nP5rxqcKewc= X-MC-Unique: vUPXfbJ0MqurTAMYq5-mdA-1 X-Mimecast-MFC-AGG-ID: vUPXfbJ0MqurTAMYq5-mdA_1777388928 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, Akihiko Odaki , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL v2 12/15] audio: Clamp unsigned sample conversion Date: Tue, 28 Apr 2026 19:07:22 +0400 Message-ID: <20260428150726.1659814-13-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.0 on 10.30.177.12 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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388971608158500 From: Akihiko Odaki clip_*_uint32_t() returns 0 when v =3D=3D 1.f because it computes the result as (IN_T)((v * ((mixeng_real)IN_MAX / 2.f)) + HALF): - (v * ((mixeng_real)IN_MAX / 2.f)) + HALF =3D=3D 0x100000000.f, which does not fit in uint32_t. - (v * ((mixeng_real)IN_MAX / 2.f)) =3D=3D 0x80000000.f - ((mixeng_real)IN_MAX / 2.f) =3D=3D 0x80000000.f - (mixeng_real)IN_MAX =3D=3D 0x100000000.f because 0xffffffff cannot be represented exactly in float. - HALF =3D=3D 0x7fffffff, which is implicitly converted to 0x80000000.f. Clamp the result to avoid the overflow. Signed-off-by: Akihiko Odaki Acked-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260423-audio-v1-2-e1d6b65c76f9@rsg.ci.i.u-tokyo.ac.jp> --- audio/mixeng_template.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/audio/mixeng_template.h b/audio/mixeng_template.h index 881653c44bf..5b0014bdd9a 100644 --- a/audio/mixeng_template.h +++ b/audio/mixeng_template.h @@ -65,7 +65,9 @@ static inline IN_T glue (clip_, ET) (mixeng_real v) #ifdef SIGNED return ENDIAN_CONVERT((IN_T)(v * (((mixeng_real)IN_MAX - IN_MIN) / 2.f= ))); #else - return ENDIAN_CONVERT((IN_T)((v * ((mixeng_real)IN_MAX / 2.f)) + HALF)= ); + return ENDIAN_CONVERT(MIN((int64_t)((v * ((mixeng_real)IN_MAX / 2.f)) + + HALF), + IN_MAX)); #endif } =20 --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388976; cv=none; d=zohomail.com; s=zohoarc; b=HzkTuV9NNMZwuLevx3++B6+VgiQNiIuDi9PIPdPKJD3AzEwO0LYofnK+JQ5LTpwsNlmbutdkaPEBXaFj2INX4pDCgAaOIBmEAhxNbnwGotb8Nj43HNHBihMyPh8rUYwKfJzVhmFjkhdmoGokXSWdDtOTOfU08PiE1+Ti0xvpeTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388976; 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=VZ3v9VQLmjbd/tE/PA2CjBPWuruAgIP5WbE6prGPfFI=; b=OOv3xEzrFLe6+FBNEUHXUZfIdILBeuijhKAg5gyz71AGczTA5PDXKqztR5cKH98YO8PJ3RvT5/b72+sCUbPmu6kTP4KAxnBzouYCp4+KER00icI+8KqTVeYlsn4IPwn/KjAcS9swn7VabjQ9XshOXnJPjM3ay9xPK6zROou5t68= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388976480739.6324201620043; Tue, 28 Apr 2026 08:09:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk3a-0004Au-2E; Tue, 28 Apr 2026 11:09:02 -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 1wHk3Y-00045j-C9 for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:09:00 -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 1wHk3W-0000sU-Kx for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:09:00 -0400 Received: from mx-prod-mc-03.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-50-0GmMC3L-O2-A3VceQWzHXA-1; Tue, 28 Apr 2026 11:08:54 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9CABC195605E; Tue, 28 Apr 2026 15:08:53 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4CB55180047F; Tue, 28 Apr 2026 15:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388938; 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=VZ3v9VQLmjbd/tE/PA2CjBPWuruAgIP5WbE6prGPfFI=; b=DrfwSXiJEa9M1WEZFHDP3xyL8UF741KBu8t/eyfZ0eZablmUS8i26bkTzxNxXQZZpioOBl WZ6IrdYab/jZncMqV5HAMs8+G7X4Dak7ozAEoftkn2DEbRGWJJVhpRYPfX00S9Mka1zvh0 pKURr/SSfBugzNwJwvMNluf2AzWe3T4= X-MC-Unique: 0GmMC3L-O2-A3VceQWzHXA-1 X-Mimecast-MFC-AGG-ID: 0GmMC3L-O2-A3VceQWzHXA_1777388933 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, Akihiko Odaki , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL v2 13/15] audio: Use unsigned PCM bias Date: Tue, 28 Apr 2026 19:07:23 +0400 Message-ID: <20260428150726.1659814-14-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.4.1 on 10.30.177.111 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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388976968158500 From: Akihiko Odaki Clang warns for the uint32_t clip_ instantiations because HALF cannot be represented with mixeng_real: [1115/2559] Compiling C object libqemuaudio.a.p/audio_mixeng.c.o In file included from ../../qemu/audio/mixeng.c:147: ../../qemu/audio/mixeng_template.h:68:70: warning: implicit conversion from= 'unsigned int' to 'float' changes value from 2147483647 to 2147483648 [-Wi= mplicit-const-int-float-conversion] 68 | return ENDIAN_CONVERT((IN_T)((v * ((mixeng_real)IN_MAX / 2.f)) = + HALF)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~^~~~~~ ../../qemu/audio/mixeng_template.h:31:22: note: expanded from macro 'HALF' 31 | #define HALF (IN_MAX >> 1) | ^ ../../qemu/audio/mixeng.c:146:28: note: expanded from macro 'ENDIAN_CONVERT' 146 | #define ENDIAN_CONVERT(v) (v) | ^ In file included from ../../qemu/audio/mixeng.c:152: ../../qemu/audio/mixeng_template.h:68:70: warning: implicit conversion from= 'unsigned int' to 'float' changes value from 2147483647 to 2147483648 [-Wi= mplicit-const-int-float-conversion] 68 | return ENDIAN_CONVERT((IN_T)((v * ((mixeng_real)IN_MAX / 2.f)) = + HALF)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~^~~~~~ ../../qemu/audio/mixeng_template.h:31:22: note: expanded from macro 'HALF' 31 | #define HALF (IN_MAX >> 1) | ^ ../../qemu/audio/mixeng.c:151:36: note: expanded from macro 'ENDIAN_CONVERT' 151 | #define ENDIAN_CONVERT(v) bswap32 (v) | ~~~~~~~~~^~ /Users/person/v/qemu/include/qemu/bswap.h:10:39: note: expanded from macro = 'bswap32' 10 | #define bswap32(_x) __builtin_bswap32(_x) | ^~ 2 warnings generated. HALF is not the right value here anyway. IN_MAX is odd, so the integer sample range has two middle codes. Unsigned PCM normally uses the upper middle code as the "bias": 0x80, 0x8000, or 0x80000000. HALF is instead defined as the lower middle code: 0x7f, 0x7fff, or 0x7fffffff. Replace HALF with BIAS, defined as the upper middle code. This fixes the warnings, since the value can be exactly represented with mixeng_real. Signed-off-by: Akihiko Odaki Acked-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260423-audio-v1-3-e1d6b65c76f9@rsg.ci.i.u-tokyo.ac.jp> --- audio/mixeng_template.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/audio/mixeng_template.h b/audio/mixeng_template.h index 5b0014bdd9a..6db742188ed 100644 --- a/audio/mixeng_template.h +++ b/audio/mixeng_template.h @@ -28,7 +28,7 @@ */ =20 #ifndef SIGNED -#define HALF (IN_MAX >> 1) +#define BIAS ((IN_T)1 << (SHIFT - 1)) #endif =20 #define ET glue (ENDIAN_CONVERSION, glue (glue (glue (_, ITYPE), BSIZE), _= t)) @@ -43,13 +43,13 @@ static inline mixeng_real glue (conv_, ET) (IN_T v) #ifdef SIGNED return nv * (2.f / ((mixeng_real)IN_MAX - IN_MIN)); #else - return ((mixeng_real)nv - HALF) * (2.f / (mixeng_real)IN_MAX); + return ((mixeng_real)nv - BIAS) * (1.f / BIAS); #endif #else /* !RECIPROCAL */ #ifdef SIGNED return nv / (((mixeng_real)IN_MAX - IN_MIN) / 2.f); #else - return ((mixeng_real)nv - HALF) / ((mixeng_real)IN_MAX / 2.f); + return ((mixeng_real)nv - BIAS) / BIAS; #endif #endif } @@ -65,9 +65,7 @@ static inline IN_T glue (clip_, ET) (mixeng_real v) #ifdef SIGNED return ENDIAN_CONVERT((IN_T)(v * (((mixeng_real)IN_MAX - IN_MIN) / 2.f= ))); #else - return ENDIAN_CONVERT(MIN((int64_t)((v * ((mixeng_real)IN_MAX / 2.f)) + - HALF), - IN_MAX)); + return ENDIAN_CONVERT(MIN((int64_t)(v * BIAS) + BIAS, IN_MAX)); #endif } =20 @@ -79,7 +77,7 @@ static inline int64_t glue (conv_, ET) (IN_T v) #ifdef SIGNED return ((int64_t) nv) << (32 - SHIFT); #else - return ((int64_t) nv - HALF) << (32 - SHIFT); + return ((int64_t) nv - BIAS) << (32 - SHIFT); #endif } =20 @@ -94,7 +92,7 @@ static inline IN_T glue (clip_, ET) (int64_t v) #ifdef SIGNED return ENDIAN_CONVERT ((IN_T) (v >> (32 - SHIFT))); #else - return ENDIAN_CONVERT ((IN_T) ((v >> (32 - SHIFT)) + HALF)); + return ENDIAN_CONVERT((IN_T)((v >> (32 - SHIFT)) + BIAS)); #endif } #endif @@ -150,5 +148,5 @@ static void glue (glue (clip_, ET), _from_mono) } =20 #undef ET -#undef HALF +#undef BIAS #undef IN_T --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388955; cv=none; d=zohomail.com; s=zohoarc; b=LwaDQDGAVG+6tPVhQuAYsE2ri58die7hMYotm8foZT4J5y55aUXgUnTqNJBVI2OcLEkFpDfNfo1EyZ9R+HKv73PzML9Br69FdO27k/4ehH6/A6rDExdgmyi53RLXIc12ZA0DZ3ntX6f8xwyTXtWPSbcIYWloPUKay5JszRi56wM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388955; 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=Gy3gvmjpI8EblaKmP37cy8WZAr58VmLwq/dbUZN2fU8=; b=KqO9HJufvlkQAqNLxUxybnY7O//XdX7FQq8/X/o6d8/iPJgaENhWOOblTpWZ3oCB+xDgySBEnqvuyr1mFj7D1XLX+t5G9sNAtxpWE0DiBrScunzs5l1R97U3u/jFM+sVJaRbeyoQMwVsWQ0ziRPa/p2oH1YPQBBqHHFLe4A9PVU= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388955521752.3364790920944; Tue, 28 Apr 2026 08:09:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk3k-0004Kg-4U; Tue, 28 Apr 2026 11:09:14 -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 1wHk3d-0004HI-VZ for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:09:06 -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 1wHk3c-0000tB-E0 for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:09:05 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-538-fKf36PWmMsSuwaH5eQ7NsA-1; Tue, 28 Apr 2026 11:08:59 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CA84D18001CD; Tue, 28 Apr 2026 15:08:58 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 129A2180045E; Tue, 28 Apr 2026 15:08:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388943; 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=Gy3gvmjpI8EblaKmP37cy8WZAr58VmLwq/dbUZN2fU8=; b=CG4DnHtycXpae9kdXOgQaD+ZvJoodypjg0q8DRuFB6oBP60lD0bYGedReXid9GQKyKUem9 xpqNGGfizAat3czOgbP7c/dn/JRMVEwqCYasBpXIzBBGgj96PMuEuvuem3oH4HKqIy/6x5 yRlhkd+h4yPiluL7+bOgAmDWenaaTck= X-MC-Unique: fKf36PWmMsSuwaH5eQ7NsA-1 X-Mimecast-MFC-AGG-ID: fKf36PWmMsSuwaH5eQ7NsA_1777388938 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, =?UTF-8?q?Jind=C5=99ich=20Makovi=C4=8Dka?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL v2 14/15] ui/gtk: Use non-blocking clipboard retrieval Date: Tue, 28 Apr 2026 19:07:24 +0400 Message-ID: <20260428150726.1659814-15-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.4.1 on 10.30.177.111 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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388956821158500 From: Jind=C5=99ich Makovi=C4=8Dka Signed-off-by: Jindrich Makovicka Reviewed-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260427-gtk-clipboard-v5-1-6968feb31a5d@gmail.com> --- ui/gtk-clipboard.c | 53 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/ui/gtk-clipboard.c b/ui/gtk-clipboard.c index 65d89ec601d..463ed4e905b 100644 --- a/ui/gtk-clipboard.c +++ b/ui/gtk-clipboard.c @@ -136,26 +136,55 @@ static void gd_clipboard_notify(Notifier *notifier, v= oid *data) } } =20 +static void +gd_clipboard_request_text_received_callback(GtkClipboard *clipboard, + const gchar *text, + gpointer data) +{ + QemuClipboardInfo *info =3D (QemuClipboardInfo *)data; + + if (text) { + qemu_clipboard_set_data(info->owner, info, QEMU_CLIPBOARD_TYPE_TEX= T, + strlen(text), text, true); + } + qemu_clipboard_info_unref(info); +} + static void gd_clipboard_request(QemuClipboardInfo *info, QemuClipboardType type) { GtkDisplayState *gd =3D container_of(info->owner, GtkDisplayState, cbp= eer); - char *text; =20 switch (type) { case QEMU_CLIPBOARD_TYPE_TEXT: - text =3D gtk_clipboard_wait_for_text(gd->gtkcb[info->selection]); - if (text) { - qemu_clipboard_set_data(&gd->cbpeer, info, type, - strlen(text), text, true); - g_free(text); - } + qemu_clipboard_info_ref(info); + gtk_clipboard_request_text(gd->gtkcb[info->selection], + gd_clipboard_request_text_received_call= back, + info); break; default: break; } } =20 +static void gd_clipboard_owner_change_targets_received_callback( + GtkClipboard *clipboard, + GdkAtom *targets, + gint n_targets, + gpointer data) +{ + QemuClipboardInfo *info =3D (QemuClipboardInfo *)data; + + if (n_targets) { + if (gtk_targets_include_text(targets, n_targets)) { + info->types[QEMU_CLIPBOARD_TYPE_TEXT].available =3D true; + } + } + + qemu_clipboard_update(info); + qemu_clipboard_info_unref(info); +} + static void gd_owner_change(GtkClipboard *clipboard, GdkEvent *event, gpointer data) @@ -173,12 +202,10 @@ static void gd_owner_change(GtkClipboard *clipboard, switch (event->owner_change.reason) { case GDK_OWNER_CHANGE_NEW_OWNER: info =3D qemu_clipboard_info_new(&gd->cbpeer, s); - if (gtk_clipboard_wait_is_text_available(clipboard)) { - info->types[QEMU_CLIPBOARD_TYPE_TEXT].available =3D true; - } - - qemu_clipboard_update(info); - qemu_clipboard_info_unref(info); + gtk_clipboard_request_targets( + clipboard, + gd_clipboard_owner_change_targets_received_callback, + info); break; default: qemu_clipboard_peer_release(&gd->cbpeer, s); --=20 2.54.0 From nobody Tue Apr 28 22:56:22 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=1777388970; cv=none; d=zohomail.com; s=zohoarc; b=IARGKpYl2bottMtICBiB4bKjoj5J2LxzqB7obbJNWjG2D8PmsMQb2no1WyU/364nx2M/N7MwF0rAa4JU0jTXK134OX7AMHHYbPURIqfFhvwNfvuXcVm2gdGv/5VruGr1zQgC84Y6H6h6bjrJf7EAh6BT41Scy3V09+HF5jX2MVY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777388970; 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=ZX+m/6bPPeLovcy5LSomlbMNC6WXFdgx77ohqNBz5/M=; b=BkSUxsgf4FfMciSBRTQ8eX+Ytsnj9uSziYCUmajRUJlOt4eobiOuKsAPxmPVQlOIFwH2Z7oxfL4gRoIgoMPPbm3jv2d3JWZPB796WHif5uTdq2wvTWyJm+ZDmhKBIY/WyRpvQxlmbZR1ATF9JiMeO/SQLqrzlRQqc2p5XsynHbE= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777388970868805.8990897258152; Tue, 28 Apr 2026 08:09:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHk3x-0004as-Eg; Tue, 28 Apr 2026 11:09:26 -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 1wHk3i-0004Jk-RO for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:09: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 1wHk3g-0000uB-Kg for qemu-devel@nongnu.org; Tue, 28 Apr 2026 11:09:10 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-263-rLy0ZmtiNmahxuBY95-sLw-1; Tue, 28 Apr 2026 11:09:06 -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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B998F1800245; Tue, 28 Apr 2026 15:09:04 +0000 (UTC) Received: from localhost (unknown [10.44.24.6]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 80ECE180047F; Tue, 28 Apr 2026 15:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777388947; 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=ZX+m/6bPPeLovcy5LSomlbMNC6WXFdgx77ohqNBz5/M=; b=UbopDAgjsrL8HtTSGfKVZHsNp3I5JmhJHr5NYVxV+l6D+WMPfmv2op2rt/7Ln4QPU44YSE Z0jOx2KFZ4DFt7wOPNy9+2bUa9Uc48i1GPS1AUd5hwqWnjjR67J4HikEHdia+xJcFNMTpC zhY2QPr5KU44p1E2wd1tEILMkNVd0EI= X-MC-Unique: rLy0ZmtiNmahxuBY95-sLw-1 X-Mimecast-MFC-AGG-ID: rLy0ZmtiNmahxuBY95-sLw_1777388944 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, =?UTF-8?q?Jind=C5=99ich=20Makovi=C4=8Dka?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Eric Blake , Markus Armbruster , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL v2 15/15] ui/gtk: Turn clipboard flag into runtime option Date: Tue, 28 Apr 2026 19:07:25 +0400 Message-ID: <20260428150726.1659814-16-marcandre.lureau@redhat.com> In-Reply-To: <20260428150726.1659814-1-marcandre.lureau@redhat.com> References: <20260428150726.1659814-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.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=lists1p.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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.109, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: 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: 1777388972993158500 From: Jind=C5=99ich Makovi=C4=8Dka - Compile the GTK clipboard support unconditionally - Introduce GTK clipboard option, defaulting to off Signed-off-by: Jindrich Makovicka Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-ID: <20260427-gtk-clipboard-v5-2-6968feb31a5d@gmail.com> --- meson.build | 4 ---- qapi/ui.json | 6 +++++- ui/gtk.c | 8 +++++--- meson_options.txt | 7 ------- qemu-options.hx | 9 ++++++--- scripts/meson-buildoptions.sh | 3 --- ui/meson.build | 4 +--- 7 files changed, 17 insertions(+), 24 deletions(-) diff --git a/meson.build b/meson.build index 7d25b1ec7ef..4176d020c21 100644 --- a/meson.build +++ b/meson.build @@ -1932,7 +1932,6 @@ endif gtk =3D not_found gtkx11 =3D not_found vte =3D not_found -have_gtk_clipboard =3D get_option('gtk_clipboard').enabled() =20 if get_option('gtk') \ .disable_auto_if(not have_system) \ @@ -1954,8 +1953,6 @@ if get_option('gtk') \ method: 'pkg-config', required: get_option('vte')) endif - elif have_gtk_clipboard - error('GTK clipboard requested, but GTK not found') endif endif =20 @@ -2475,7 +2472,6 @@ if glusterfs.found() endif config_host_data.set('CONFIG_GTK', gtk.found()) config_host_data.set('CONFIG_VTE', vte.found()) -config_host_data.set('CONFIG_GTK_CLIPBOARD', have_gtk_clipboard) config_host_data.set('CONFIG_HEXAGON_IDEF_PARSER', get_option('hexagon_ide= f_parser')) config_host_data.set('CONFIG_LIBATTR', have_old_libattr) config_host_data.set('CONFIG_LIBCAP_NG', libcap_ng.found()) diff --git a/qapi/ui.json b/qapi/ui.json index e3da77632a8..b2c42a7f578 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1319,6 +1319,9 @@ # # GTK display options. # +# @clipboard: Enable host-guest clipboard sharing. Defaults to "off". +# (Since 11.1) +# # @grab-on-hover: Grab keyboard input on mouse hover. # # @zoom-to-fit: Zoom guest display to fit into the host window. When @@ -1344,7 +1347,8 @@ # Since: 2.12 ## { 'struct' : 'DisplayGTK', - 'data' : { '*grab-on-hover' : 'bool', + 'data' : { '*clipboard' : 'bool', + '*grab-on-hover' : 'bool', '*zoom-to-fit' : 'bool', '*show-tabs' : 'bool', '*show-menubar' : 'bool', diff --git a/ui/gtk.c b/ui/gtk.c index 8fd39c90c29..ec95f0f294a 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2601,9 +2601,11 @@ static void gtk_display_init(DisplayState *ds, Displ= ayOptions *opts) opts->u.gtk.show_tabs) { gtk_menu_item_activate(GTK_MENU_ITEM(s->show_tabs_item)); } -#ifdef CONFIG_GTK_CLIPBOARD - gd_clipboard_init(s); -#endif /* CONFIG_GTK_CLIPBOARD */ + + if (opts->u.gtk.has_clipboard && + opts->u.gtk.clipboard) { + gd_clipboard_init(s); + } =20 /* GTK's event polling must happen on the main thread. */ qemu_main =3D NULL; diff --git a/meson_options.txt b/meson_options.txt index 31d5916cfce..286461129bd 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -262,13 +262,6 @@ option('vnc_sasl', type : 'feature', value : 'auto', description: 'SASL authentication for VNC server') option('vte', type : 'feature', value : 'auto', description: 'vte support for the gtk UI') - -# GTK Clipboard implementation is disabled by default, since it may cause = hangs -# of the guest VCPUs. See gitlab issue 1150: -# https://gitlab.com/qemu-project/qemu/-/issues/1150 - -option('gtk_clipboard', type: 'feature', value : 'disabled', - description: 'clipboard support for the gtk UI (EXPERIMENTAL, MAY H= ANG)') option('xkbcommon', type : 'feature', value : 'auto', description: 'xkbcommon support') option('zstd', type : 'feature', value : 'auto', diff --git a/qemu-options.hx b/qemu-options.hx index 21972f83268..e780bc2ac06 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2209,9 +2209,9 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, " [,window-close=3Don|off]\n" #endif #if defined(CONFIG_GTK) - "-display gtk[,full-screen=3Don|off][,gl=3Don|off][,grab-on-hover=3Don= |off]\n" - " [,show-tabs=3Don|off][,show-cursor=3Don|off][,window-clos= e=3Don|off]\n" - " [,show-menubar=3Don|off][,zoom-to-fit=3Don|off]\n" + "-display gtk[,clipboard=3Don|off][,full-screen=3Don|off][,gl=3Don|off= ]\n" + " [,grab-on-hover=3Don|off][,show-tabs=3Don|off][,show-curs= or=3Don|off]\n" + " [,window-close=3Don|off][,show-menubar=3Don|off][,zoom-to= -fit=3Don|off]\n" #endif #if defined(CONFIG_VNC) "-display vnc=3D[,]\n" @@ -2295,6 +2295,9 @@ SRST drop-down menus and other UI elements to configure and control the VM during runtime. Valid parameters are: =20 + ``clipboard=3Don|off`` : Enable host-guest clipboard sharing, + defaults to "off" + ``full-screen=3Don|off`` : Start in fullscreen mode =20 ``gl=3Don|off`` : Use OpenGL for displaying diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index ca5b113119a..80de8c4af42 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -124,7 +124,6 @@ meson_options_help() { printf "%s\n" ' glusterfs Glusterfs block device driver' printf "%s\n" ' gnutls GNUTLS cryptography support' printf "%s\n" ' gtk GTK+ user interface' - printf "%s\n" ' gtk-clipboard clipboard support for the gtk UI (EXPER= IMENTAL, MAY HANG)' printf "%s\n" ' guest-agent Build QEMU Guest Agent' printf "%s\n" ' guest-agent-msi Build MSI package for the QEMU Guest Ag= ent' printf "%s\n" ' hv-balloon hv-balloon driver (requires Glib 2.68+ = GTree API)' @@ -336,8 +335,6 @@ _meson_option_parse() { --disable-gnutls) printf "%s" -Dgnutls=3Ddisabled ;; --enable-gtk) printf "%s" -Dgtk=3Denabled ;; --disable-gtk) printf "%s" -Dgtk=3Ddisabled ;; - --enable-gtk-clipboard) printf "%s" -Dgtk_clipboard=3Denabled ;; - --disable-gtk-clipboard) printf "%s" -Dgtk_clipboard=3Ddisabled ;; --enable-guest-agent) printf "%s" -Dguest_agent=3Denabled ;; --disable-guest-agent) printf "%s" -Dguest_agent=3Ddisabled ;; --enable-guest-agent-msi) printf "%s" -Dguest_agent_msi=3Denabled ;; diff --git a/ui/meson.build b/ui/meson.build index 3d15ff96287..ceaf110683d 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -112,9 +112,7 @@ if gtk.found() =20 gtk_ss =3D ss.source_set() gtk_ss.add(gtk, vte, pixman, files('gtk.c')) - if have_gtk_clipboard - gtk_ss.add(files('gtk-clipboard.c')) - endif + gtk_ss.add(files('gtk-clipboard.c')) gtk_ss.add(when: x11, if_true: files('x_keymap.c')) gtk_ss.add(when: opengl, if_true: files('gtk-gl-area.c')) gtk_ss.add(when: [x11, opengl], if_true: files('gtk-egl.c')) --=20 2.54.0