From nobody Mon Feb 9 17:36:54 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614862403; cv=none; d=zohomail.com; s=zohoarc; b=UlOzAlmsNoqd5XUslInuanVKKpBrFCK8YoBJWyPtES63LeNgpkEfGE0IxNJu52wZbqupWADFrV7L1MsHYJLroHtw3UFdnZtxcxtYvfPpCyWQABu10WmDI04OcepDgZvQ2AgW10kOjL218v3gq/QbYltJJxn0vzQyPzaH+kqwH0E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614862403; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sZZk+tO54fxLHLeJm0a6RFGZZkq8fdPwF6t0fJXPEjU=; b=c5t1bF+DFZSgVDHZcHiFKbupKiT1SBS19+nhlyu5zUq2myo11l54XYxfUFteZM2wovBDeBjl271opN4XKp8/5rclANyqoZv5PKkUvSLgJ+duN3S5yeNgf1fa7fA4eo91Stdn0h7nu4gUVbvaOYwCTlibfAXKgQpAKo21/kldIPg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161486240319825.265274668434017; Thu, 4 Mar 2021 04:53:23 -0800 (PST) Received: from localhost ([::1]:50174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHnTm-0008Sg-55 for importer@patchew.org; Thu, 04 Mar 2021 07:53:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHnSu-0007T8-4y for qemu-devel@nongnu.org; Thu, 04 Mar 2021 07:52:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43921) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHnSq-00055G-Vs for qemu-devel@nongnu.org; Thu, 04 Mar 2021 07:52:27 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-486-45dXDVPGOhanEPIayWwwxw-1; Thu, 04 Mar 2021 07:52:21 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D3F72108BD0A; Thu, 4 Mar 2021 12:52:20 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-115-129.ams2.redhat.com [10.36.115.129]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 67947608BA; Thu, 4 Mar 2021 12:52:20 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 81AB31800637; Thu, 4 Mar 2021 09:37:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614862343; 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=sZZk+tO54fxLHLeJm0a6RFGZZkq8fdPwF6t0fJXPEjU=; b=HVo/CTJ81vbNV1OHNDmBh67IjsL3t1q50UxXKvBGhsXXLztdzDalPQRhu5q0zG0XL96WmI nPk/CdVFeye9IH48/c/+qYp+EydrlPqnM84UAVrwXtGUP+Ba2yp+/4ZEhyOGzpX+xFLeCf dMLg9TW5jbeu37Nn6CTeQi8+XhefowI= X-MC-Unique: 45dXDVPGOhanEPIayWwwxw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 6/8] ui/console: Add placeholder flag to message surface Date: Thu, 4 Mar 2021 09:37:03 +0100 Message-Id: <20210304083705.1046645-7-kraxel@redhat.com> In-Reply-To: <20210304083705.1046645-1-kraxel@redhat.com> References: <20210304083705.1046645-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , Akihiko Odaki , Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki The surfaces created with former qemu_create_message_surface did not display the content from the guest and always contained simple messages describing the reason. A display backend may want to hide the window showing such a surface. This change renames the function to qemu_create_placeholder_surface, and adds "placeholder" flag; the display can check the flag to decide to do anything special like hiding the window. Signed-off-by: Akihiko Odaki Message-Id: <20210225101316.83940-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 10 ++++++++-- hw/display/vhost-user-gpu.c | 4 ++-- hw/display/virtio-gpu.c | 6 +++--- ui/console.c | 11 ++++++----- ui/vnc.c | 2 +- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index d30e972d0b57..c960b7066ccd 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -106,6 +106,7 @@ struct QemuConsoleClass { }; =20 #define QEMU_ALLOCATED_FLAG 0x01 +#define QEMU_PLACEHOLDER_FLAG 0x02 =20 typedef struct DisplaySurface { pixman_format_code_t format; @@ -259,8 +260,8 @@ DisplaySurface *qemu_create_displaysurface_from(int wid= th, int height, pixman_format_code_t forma= t, int linesize, uint8_t *dat= a); DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image); -DisplaySurface *qemu_create_message_surface(int w, int h, - const char *msg); +DisplaySurface *qemu_create_placeholder_surface(int w, int h, + const char *msg); PixelFormat qemu_default_pixelformat(int bpp); =20 DisplaySurface *qemu_create_displaysurface(int width, int height); @@ -281,6 +282,11 @@ static inline int is_buffer_shared(DisplaySurface *sur= face) return !(surface->flags & QEMU_ALLOCATED_FLAG); } =20 +static inline int is_placeholder(DisplaySurface *surface) +{ + return surface->flags & QEMU_PLACEHOLDER_FLAG; +} + void register_displaychangelistener(DisplayChangeListener *dcl); void update_displaychangelistener(DisplayChangeListener *dcl, uint64_t interval); diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 4d8cb3525bfc..3e911da795ea 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -194,8 +194,8 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUse= rGpuMsg *msg) con =3D s->con; =20 if (m->scanout_id =3D=3D 0 && m->width =3D=3D 0) { - s->ds =3D qemu_create_message_surface(640, 480, - "Guest disabled display."); + s->ds =3D qemu_create_placeholder_surface(640, 480, + "Guest disabled displa= y."); dpy_gfx_replace_surface(con, s->ds); } else { s->ds =3D qemu_create_displaysurface(m->width, m->height); diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 2e4a9822b6a4..c1f17bec17e4 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -338,9 +338,9 @@ static void virtio_gpu_disable_scanout(VirtIOGPU *g, in= t scanout_id) =20 if (scanout_id =3D=3D 0) { /* primary head */ - ds =3D qemu_create_message_surface(scanout->width ?: 640, - scanout->height ?: 480, - "Guest disabled display."); + ds =3D qemu_create_placeholder_surface(scanout->width ?: 640, + scanout->height ?: 480, + "Guest disabled display."); } dpy_gfx_replace_surface(scanout->con, ds); scanout->resource_id =3D 0; diff --git a/ui/console.c b/ui/console.c index c5d11bc7017f..32823faf4147 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1436,8 +1436,8 @@ DisplaySurface *qemu_create_displaysurface_pixman(pix= man_image_t *image) return surface; } =20 -DisplaySurface *qemu_create_message_surface(int w, int h, - const char *msg) +DisplaySurface *qemu_create_placeholder_surface(int w, int h, + const char *msg) { DisplaySurface *surface =3D qemu_create_displaysurface(w, h); pixman_color_t bg =3D color_table_rgb[0][QEMU_COLOR_BLACK]; @@ -1454,6 +1454,7 @@ DisplaySurface *qemu_create_message_surface(int w, in= t h, x+i, y, FONT_WIDTH, FONT_HEIGHT); qemu_pixman_image_unref(glyph); } + surface->flags |=3D QEMU_PLACEHOLDER_FLAG; return surface; } =20 @@ -1550,7 +1551,7 @@ void register_displaychangelistener(DisplayChangeList= ener *dcl) dcl->ops->dpy_gfx_switch(dcl, con->surface); } else { if (!dummy) { - dummy =3D qemu_create_message_surface(640, 480, nodev); + dummy =3D qemu_create_placeholder_surface(640, 480, nodev); } dcl->ops->dpy_gfx_switch(dcl, dummy); } @@ -1998,7 +1999,7 @@ QemuConsole *graphic_console_init(DeviceState *dev, u= int32_t head, &error_abort); } =20 - surface =3D qemu_create_message_surface(width, height, noinit); + surface =3D qemu_create_placeholder_surface(width, height, noinit); dpy_gfx_replace_surface(s, surface); return s; } @@ -2027,7 +2028,7 @@ void graphic_console_close(QemuConsole *con) if (con->gl) { dpy_gl_scanout_disable(con); } - surface =3D qemu_create_message_surface(width, height, unplugged); + surface =3D qemu_create_placeholder_surface(width, height, unplugged); dpy_gfx_replace_surface(con, surface); } =20 diff --git a/ui/vnc.c b/ui/vnc.c index 16bb3be770b2..4d2151272e56 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -799,7 +799,7 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl, =20 if (surface =3D=3D NULL) { if (placeholder =3D=3D NULL) { - placeholder =3D qemu_create_message_surface(640, 480, placehol= der_msg); + placeholder =3D qemu_create_placeholder_surface(640, 480, plac= eholder_msg); } surface =3D placeholder; } --=20 2.29.2