From patchwork Thu Feb 25 10:13:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1444249 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=OJczgHQE; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DmTCX2kgCz9sRN for ; Thu, 25 Feb 2021 21:14:00 +1100 (AEDT) Received: from localhost ([::1]:35566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFDeg-0001da-37 for incoming@patchwork.ozlabs.org; Thu, 25 Feb 2021 05:13:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFDeK-0001bW-5D for qemu-devel@nongnu.org; Thu, 25 Feb 2021 05:13:36 -0500 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:44794) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lFDeI-00087A-9C for qemu-devel@nongnu.org; Thu, 25 Feb 2021 05:13:35 -0500 Received: by mail-pg1-x52a.google.com with SMTP id a4so3450934pgc.11 for ; Thu, 25 Feb 2021 02:13:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vzsU3EZ+pZWfLMIpGq3G9wRVI9sKDLLj/9kfAiMMjFA=; b=OJczgHQE9N/wEllN4sChY8bFrZt2hG/oOAEAFJwKlasmr4ZZtDOe47Ary9p80oGBHF QPEtXuEA+AWd0R7OSh9GlW3tzmkyVA7Op+lryMApY1LhsSB2kt82hs0LvilBPFkAqsWI rwo0x1sIxpcxbfrYI48sgcK3RjmBo+vohXW298CNhlDDG0Ummp/nJ4txbl5AWYalvBm8 sWtfqxC0lTj8WoaoAqb3YsyJ126gW2+eQsVJjqBnGfsVHYnnysAnmcF+Y3kRBaHVcsK1 PvD7saD0bJL4jii44zHYYC5Qn417CY9gYn1VGqQXFl7eQwEO+rAmtx7XYH5GWSnaiNpH jctw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vzsU3EZ+pZWfLMIpGq3G9wRVI9sKDLLj/9kfAiMMjFA=; b=naUBqHibm33WHScStoC5D2l6ZrUYDQbbAb+kn1ujymb3/KwrvwVpGN9/3TmGonzd4s wsQrndWm3pqhRSFaf+RASMM2D2TnP+/CNpQfD9+BwQ2uhO+2FkaedBBq3JuI6wG46uXs 8/R8oqPQ/T2VeFRFInOpOAyND3tOxHfci+LdRaVUtYnpZyu057/Z/BYy/aVYcTQ0T8N0 b8li9+tGxXieY0l5W3oI5I4TphUt4OP+Jyrsfgwg/08u9QKpYc3x3P2klKrz+FHNW5N9 JWs7FOJ6Eh754SuD/ZgCJcrq1OLVP1zXYT4q3pPNR7HvO4GggZuIrYe7zhnCRYdf2kS6 0MCw== X-Gm-Message-State: AOAM533t08sXVN6yBVs/RiWdlt4R3u5PiFbvE0bRHHX/1JJoj/j8FcIB 8X61EXc4wCPyXcDPgXIdqF7Kv6wiE/JKPg== X-Google-Smtp-Source: ABdhPJwiGgtT8FSs2EeB6bw+NNRXWDZyfyqzHK4yrpCtGa9GKWoUVvwoRD6NDoXRBoswCeOw+SckQA== X-Received: by 2002:a63:505d:: with SMTP id q29mr2319904pgl.218.1614248012559; Thu, 25 Feb 2021 02:13:32 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c360:8200:29a8:515b:7b7:9008]) by smtp.gmail.com with ESMTPSA id o18sm5630833pjq.44.2021.02.25.02.13.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Feb 2021 02:13:32 -0800 (PST) From: Akihiko Odaki To: Subject: [PATCH v4 1/3] ui/console: Add placeholder flag to message surface Date: Thu, 25 Feb 2021 19:13:14 +0900 Message-Id: <20210225101316.83940-1-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=akihiko.odaki@gmail.com; helo=mail-pg1-x52a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: "Michael S . Tsirkin" , qemu Developers , Akihiko Odaki , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- hw/display/vhost-user-gpu.c | 4 ++-- hw/display/virtio-gpu.c | 6 +++--- include/ui/console.h | 10 ++++++++-- ui/console.c | 11 ++++++----- ui/vnc.c | 2 +- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 4d8cb3525bf..3e911da795e 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, VhostUserGpuMsg *msg) con = s->con; if (m->scanout_id == 0 && m->width == 0) { - s->ds = qemu_create_message_surface(640, 480, - "Guest disabled display."); + s->ds = qemu_create_placeholder_surface(640, 480, + "Guest disabled display."); dpy_gfx_replace_surface(con, s->ds); } else { s->ds = qemu_create_displaysurface(m->width, m->height); diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 2e4a9822b6a..c1f17bec17e 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, int scanout_id) if (scanout_id == 0) { /* primary head */ - ds = qemu_create_message_surface(scanout->width ?: 640, - scanout->height ?: 480, - "Guest disabled display."); + ds = qemu_create_placeholder_surface(scanout->width ?: 640, + scanout->height ?: 480, + "Guest disabled display."); } dpy_gfx_replace_surface(scanout->con, ds); scanout->resource_id = 0; diff --git a/include/ui/console.h b/include/ui/console.h index d30e972d0b5..c960b7066cc 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -106,6 +106,7 @@ struct QemuConsoleClass { }; #define QEMU_ALLOCATED_FLAG 0x01 +#define QEMU_PLACEHOLDER_FLAG 0x02 typedef struct DisplaySurface { pixman_format_code_t format; @@ -259,8 +260,8 @@ DisplaySurface *qemu_create_displaysurface_from(int width, int height, pixman_format_code_t format, int linesize, uint8_t *data); 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); DisplaySurface *qemu_create_displaysurface(int width, int height); @@ -281,6 +282,11 @@ static inline int is_buffer_shared(DisplaySurface *surface) return !(surface->flags & QEMU_ALLOCATED_FLAG); } +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/ui/console.c b/ui/console.c index c5d11bc7017..32823faf414 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1436,8 +1436,8 @@ DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image) return surface; } -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 = qemu_create_displaysurface(w, h); pixman_color_t bg = color_table_rgb[0][QEMU_COLOR_BLACK]; @@ -1454,6 +1454,7 @@ DisplaySurface *qemu_create_message_surface(int w, int h, x+i, y, FONT_WIDTH, FONT_HEIGHT); qemu_pixman_image_unref(glyph); } + surface->flags |= QEMU_PLACEHOLDER_FLAG; return surface; } @@ -1550,7 +1551,7 @@ void register_displaychangelistener(DisplayChangeListener *dcl) dcl->ops->dpy_gfx_switch(dcl, con->surface); } else { if (!dummy) { - dummy = qemu_create_message_surface(640, 480, nodev); + dummy = qemu_create_placeholder_surface(640, 480, nodev); } dcl->ops->dpy_gfx_switch(dcl, dummy); } @@ -1998,7 +1999,7 @@ QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head, &error_abort); } - surface = qemu_create_message_surface(width, height, noinit); + surface = 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 = qemu_create_message_surface(width, height, unplugged); + surface = qemu_create_placeholder_surface(width, height, unplugged); dpy_gfx_replace_surface(con, surface); } diff --git a/ui/vnc.c b/ui/vnc.c index 16bb3be770b..4d2151272e5 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -799,7 +799,7 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl, if (surface == NULL) { if (placeholder == NULL) { - placeholder = qemu_create_message_surface(640, 480, placeholder_msg); + placeholder = qemu_create_placeholder_surface(640, 480, placeholder_msg); } surface = placeholder; } From patchwork Thu Feb 25 10:13:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1444252 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=U3+Ql3gH; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DmTGn422Xz9sRN for ; Thu, 25 Feb 2021 21:16:49 +1100 (AEDT) Received: from localhost ([::1]:43196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFDhP-0004uP-BI for incoming@patchwork.ozlabs.org; Thu, 25 Feb 2021 05:16:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFDeO-0001jx-GC for qemu-devel@nongnu.org; Thu, 25 Feb 2021 05:13:40 -0500 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:37757) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lFDeM-0008AI-Cf for qemu-devel@nongnu.org; Thu, 25 Feb 2021 05:13:40 -0500 Received: by mail-pg1-x529.google.com with SMTP id o10so3478065pgg.4 for ; Thu, 25 Feb 2021 02:13:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QiN+GjduDTDob/L43vMiFo+zjJBBP+f5w+hvQdungSM=; b=U3+Ql3gHc2rFHLKUU/6sE9CeSkxa7LX9+X3TVkZssj2D6MIrZookut0uOClV6io+Rt ssew5q9MDI62J7Ddmdkj/MI61GPfBC19GmR/Sli2uQTrh7Ov5BJKJlmjvPsOe5ljlQz4 GpLNs00BtlfAWr8VMvJ2pY021HbTwUt0bJxJY5bD96D2d9yKMvP3pFxKRFmgilu1wfty WHo9QIvZpO8uUKMwdyk62AgUIUAoZBz6aRo+W/5hWyhIMpFaSB5OrpboqF9Ya1XajoPZ o9aal8DeVSgwwVHdsC7UucgpzcPjsNCwUIjD238kb0Zg76Pkj1rpNPuWPaCASH0iTtsy BfhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QiN+GjduDTDob/L43vMiFo+zjJBBP+f5w+hvQdungSM=; b=mmxJbhNQsROOwDWlH9DK6hkpiLq1CDs90KODhDolrhDt+wAK8zfrlIAuSfm/pVKMtj B6qoCirEaojyzCG0A+MVCoLhh2ftS4LffSvh1u/uMp4RmjippuzPk269ktmsEzcnJ4AC DoKZ5WERiXnDwKQdSIZiw/3fF+Yq//HoeVPicqC0iBhkzpuL0E0tjqNfp7j8EKy/2gqw ZZ3azxzWwvWDEf5/QbqQE5APnOYsXZ7oAWK9TdKK7hKZwtMufB0Ux8rhnSyhQkIUOD2Y 0fO9vg1SqU6iYf55zA/RW/q00Z3nss26eReYZI/sC9RnZOMSpryvAGwUsXYs4eIF03AW UxaA== X-Gm-Message-State: AOAM533TpSYm9kI+roSe1babzHihXHXCY7TTv9Zz27rVDUQeH2Lmbst1 3C9SiUYmjw/Myf1xJofkQcC3r7WJfcaP0w== X-Google-Smtp-Source: ABdhPJwTHi9UEr70dpOOC25mwqjoRALuMJ6IwTJ0bpcdTWV7dtpLWBhF9u95vA/d4g09w1SI39Mnng== X-Received: by 2002:a63:5c08:: with SMTP id q8mr2367108pgb.390.1614248016504; Thu, 25 Feb 2021 02:13:36 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c360:8200:29a8:515b:7b7:9008]) by smtp.gmail.com with ESMTPSA id o18sm5630833pjq.44.2021.02.25.02.13.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Feb 2021 02:13:36 -0800 (PST) From: Akihiko Odaki To: Subject: [PATCH v4 2/3] ui/console: Pass placeholder surface to displays Date: Thu, 25 Feb 2021 19:13:15 +0900 Message-Id: <20210225101316.83940-2-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20210225101316.83940-1-akihiko.odaki@gmail.com> References: <20210225101316.83940-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=akihiko.odaki@gmail.com; helo=mail-pg1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: "Michael S . Tsirkin" , qemu Developers , Akihiko Odaki , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" ui/console used to accept NULL as graphic console surface, but its semantics was inconsistent among displays: - cocoa and gtk-egl perform NULL dereference. - egl-headless, spice and spice-egl do nothing. - gtk releases underlying resources. - sdl2-2d and sdl2-gl destroys the window. - vnc shows a message, "Display output is not active." Fortunately, only virtio-gpu and virtio-gpu-3d assign NULL so we can study them to figure out the desired behavior. They assign NULL *except* for the primary display when the device is realized, reset, or its scanout is disabled. This effectively destroys windows for the (uninitialized) secondary displays. To implement the consistent behavior of display device realization/reset, this change embeds it to the operation switching the surface. When NULL was given as a new surface when switching, ui/console will instead passes a placeholder down to each display listeners. sdl destroys the window for a secondary console if its surface is a placeholder. The other displays simply shows the placeholder. Signed-off-by: Akihiko Odaki --- ui/console.c | 17 ++++++++++++++++- ui/gtk.c | 4 ---- ui/sdl2-2d.c | 7 ++----- ui/sdl2-gl.c | 4 ++-- ui/spice-display.c | 6 +++--- ui/vnc.c | 10 ---------- 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/ui/console.c b/ui/console.c index 32823faf414..171a7bf14b9 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1675,11 +1675,26 @@ void dpy_gfx_update_full(QemuConsole *con) void dpy_gfx_replace_surface(QemuConsole *con, DisplaySurface *surface) { + static const char placeholder_msg[] = "Display output is not active."; DisplayState *s = con->ds; DisplaySurface *old_surface = con->surface; DisplayChangeListener *dcl; + int width; + int height; + + if (!surface) { + if (old_surface) { + width = surface_width(old_surface); + height = surface_height(old_surface); + } else { + width = 640; + height = 480; + } + + surface = qemu_create_placeholder_surface(width, height, placeholder_msg); + } - assert(old_surface != surface || surface == NULL); + assert(old_surface != surface); con->surface = surface; QLIST_FOREACH(dcl, &s->listeners, next) { diff --git a/ui/gtk.c b/ui/gtk.c index 79dc2401203..a4a5f981e2a 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -567,10 +567,6 @@ static void gd_switch(DisplayChangeListener *dcl, } vc->gfx.ds = surface; - if (!surface) { - return; - } - if (surface->format == PIXMAN_x8r8g8b8) { /* * PIXMAN_x8r8g8b8 == CAIRO_FORMAT_RGB24 diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c index a2ea85127d5..bfebbdeaea8 100644 --- a/ui/sdl2-2d.c +++ b/ui/sdl2-2d.c @@ -32,14 +32,11 @@ void sdl2_2d_update(DisplayChangeListener *dcl, int x, int y, int w, int h) { struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl); - DisplaySurface *surf = qemu_console_surface(dcl->con); + DisplaySurface *surf = scon->surface; SDL_Rect rect; size_t surface_data_offset; assert(!scon->opengl); - if (!surf) { - return; - } if (!scon->texture) { return; } @@ -75,7 +72,7 @@ void sdl2_2d_switch(DisplayChangeListener *dcl, scon->texture = NULL; } - if (!new_surface) { + if (is_placeholder(new_surface) && qemu_console_get_index(dcl->con)) { sdl2_window_destroy(scon); return; } diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c index fd594d74611..a21d2deed91 100644 --- a/ui/sdl2-gl.c +++ b/ui/sdl2-gl.c @@ -86,7 +86,7 @@ void sdl2_gl_switch(DisplayChangeListener *dcl, scon->surface = new_surface; - if (!new_surface) { + if (is_placeholder(new_surface) && qemu_console_get_index(dcl->con)) { qemu_gl_fini_shader(scon->gls); scon->gls = NULL; sdl2_window_destroy(scon); @@ -112,7 +112,7 @@ void sdl2_gl_refresh(DisplayChangeListener *dcl) assert(scon->opengl); graphic_hw_update(dcl->con); - if (scon->updates && scon->surface) { + if (scon->updates && scon->real_window) { scon->updates = 0; sdl2_gl_render_surface(scon); } diff --git a/ui/spice-display.c b/ui/spice-display.c index 6f32b66a6e7..222c7c20a2a 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -388,7 +388,7 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, SimpleSpiceUpdate *update; bool need_destroy; - if (surface && ssd->surface && + if (ssd->surface && surface_width(surface) == pixman_image_get_width(ssd->surface) && surface_height(surface) == pixman_image_get_height(ssd->surface) && surface_format(surface) == pixman_image_get_format(ssd->surface)) { @@ -410,8 +410,8 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, /* full mode switch */ trace_qemu_spice_display_surface(ssd->qxl.id, - surface ? surface_width(surface) : 0, - surface ? surface_height(surface) : 0, + surface_width(surface), + surface_height(surface), false); memset(&ssd->dirty, 0, sizeof(ssd->dirty)); diff --git a/ui/vnc.c b/ui/vnc.c index 4d2151272e5..310abc93781 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -790,20 +790,10 @@ static bool vnc_check_pageflip(DisplaySurface *s1, static void vnc_dpy_switch(DisplayChangeListener *dcl, DisplaySurface *surface) { - static const char placeholder_msg[] = - "Display output is not active."; - static DisplaySurface *placeholder; VncDisplay *vd = container_of(dcl, VncDisplay, dcl); bool pageflip = vnc_check_pageflip(vd->ds, surface); VncState *vs; - if (surface == NULL) { - if (placeholder == NULL) { - placeholder = qemu_create_placeholder_surface(640, 480, placeholder_msg); - } - surface = placeholder; - } - vnc_abort_display_jobs(vd); vd->ds = surface; From patchwork Thu Feb 25 10:13:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1444251 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=I+M27bZf; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DmTGk5vg6z9sRN for ; Thu, 25 Feb 2021 21:16:46 +1100 (AEDT) Received: from localhost ([::1]:42904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFDhM-0004n9-Nx for incoming@patchwork.ozlabs.org; Thu, 25 Feb 2021 05:16:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFDeR-0001rq-Ux for qemu-devel@nongnu.org; Thu, 25 Feb 2021 05:13:43 -0500 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:35199) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lFDeQ-0008Cy-8e for qemu-devel@nongnu.org; Thu, 25 Feb 2021 05:13:43 -0500 Received: by mail-pg1-x52f.google.com with SMTP id t25so3483528pga.2 for ; Thu, 25 Feb 2021 02:13:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Qe7V9NX2D2tPRuYtggPsQjNU/bEiJn0CIOtYm4LfNUs=; b=I+M27bZfc8r5jw76LfXHG2CMpmW518brFuMixdztRvqRAkMiNNFYFxYIejXiufikiJ eQpKQfj8TymMNAYPH2HhmvTp8xWQMaXDyS3q1qs/ZRCI6SSRzTXML6lrTKZDamrEHVGK 9j234pxexLTOoDfrFh4LG84KNziHBpvpOPAvAsqvrwx2f5GntdAjmnXOya6AxDZBfOZJ Kto0JNMwoZDmrlVs8sjzz3h5nrGVUtzVMuwr7++bHBRvsJfla/ATx9ujymuGuUIrCSL8 0zCE9LFzLPWo11SjfACCUGDPDDg3aFSN2R/L3mrBcq3rvW68wntPRHxpl+VqPVIVQMVM 8h3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Qe7V9NX2D2tPRuYtggPsQjNU/bEiJn0CIOtYm4LfNUs=; b=IXs9VVrxfCtPfaK5n9j8r7HX1ho7IHc7byqFex21eC9t/YE0PPp0RjuDfslgdczQDd tAJsFnrqs45jDrmQ5PgzQOdPk81dLxh4wJKZf9Pg3Ua2PVKqpZnNLlXTOEy68/H/nvKJ x6REK0Nej0WfFilhCgg6ornIR2Y3kkpGFyQLpxjMHKfIGbMstpYbqR4oBnL2bD4CWR9g 50KrJl9PycoJvgW08Nl22iU0dMQbYkB/O56LpkcJehAbgm31hz7a0pu946I88Tlyq4/7 vZPtcrPUnI1gSdTvqd+A/GgH6oYgbpo0Sr0HbjETgQ6h08CPqBYSKwb/kJrQwiA8jHsD 24eQ== X-Gm-Message-State: AOAM5339809SRmDJfS/TFgJpllnYdFtTiVWTYBm0Xt6TMBUPEkZIRcAM /ZskBwjZ7qejdASmwGLvcFV/iai+MOgH7Q== X-Google-Smtp-Source: ABdhPJyJqdJ73TBUte9Hi2zFe959VUP83oTFZe+6ubKJMoWWA9QnpEL4x0NkOytq1AsgZZZEIKezqw== X-Received: by 2002:a62:602:0:b029:1ed:d3fb:7edb with SMTP id 2-20020a6206020000b02901edd3fb7edbmr2641509pfg.22.1614248020735; Thu, 25 Feb 2021 02:13:40 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c360:8200:29a8:515b:7b7:9008]) by smtp.gmail.com with ESMTPSA id o18sm5630833pjq.44.2021.02.25.02.13.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Feb 2021 02:13:40 -0800 (PST) From: Akihiko Odaki To: Subject: [PATCH v4 3/3] virtio-gpu: Do not distinguish the primary console Date: Thu, 25 Feb 2021 19:13:16 +0900 Message-Id: <20210225101316.83940-3-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20210225101316.83940-1-akihiko.odaki@gmail.com> References: <20210225101316.83940-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=akihiko.odaki@gmail.com; helo=mail-pg1-x52f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: "Michael S . Tsirkin" , qemu Developers , Akihiko Odaki , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" In the past, virtio-gpu set NULL as the surface for the secondary consoles to hide its window. The distinction is now handled in ui/console and the display backends and virtio-gpu does no longer have to do that. Signed-off-by: Akihiko Odaki --- hw/display/vhost-user-gpu.c | 6 ++---- hw/display/virtio-gpu-3d.c | 10 +++------- hw/display/virtio-gpu-base.c | 3 --- hw/display/virtio-gpu.c | 9 +-------- 4 files changed, 6 insertions(+), 22 deletions(-) diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 3e911da795e..a01f9315e19 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -193,10 +193,8 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUserGpuMsg *msg) s = &g->parent_obj.scanout[m->scanout_id]; con = s->con; - if (m->scanout_id == 0 && m->width == 0) { - s->ds = qemu_create_placeholder_surface(640, 480, - "Guest disabled display."); - dpy_gfx_replace_surface(con, s->ds); + if (m->width == 0) { + dpy_gfx_replace_surface(con, NULL); } else { s->ds = qemu_create_displaysurface(m->width, m->height); /* replace surface on next update */ diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c index 0b0c11474dd..9eb489077b1 100644 --- a/hw/display/virtio-gpu-3d.c +++ b/hw/display/virtio-gpu-3d.c @@ -179,10 +179,8 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g, info.width, info.height, ss.r.x, ss.r.y, ss.r.width, ss.r.height); } else { - if (ss.scanout_id != 0) { - dpy_gfx_replace_surface( - g->parent_obj.scanout[ss.scanout_id].con, NULL); - } + dpy_gfx_replace_surface( + g->parent_obj.scanout[ss.scanout_id].con, NULL); dpy_gl_scanout_disable(g->parent_obj.scanout[ss.scanout_id].con); } g->parent_obj.scanout[ss.scanout_id].resource_id = ss.resource_id; @@ -595,9 +593,7 @@ void virtio_gpu_virgl_reset(VirtIOGPU *g) virgl_renderer_reset(); for (i = 0; i < g->parent_obj.conf.max_outputs; i++) { - if (i != 0) { - dpy_gfx_replace_surface(g->parent_obj.scanout[i].con, NULL); - } + dpy_gfx_replace_surface(g->parent_obj.scanout[i].con, NULL); dpy_gl_scanout_disable(g->parent_obj.scanout[i].con); } } diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 4a57350917c..25f8920fdb6 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -193,9 +193,6 @@ virtio_gpu_base_device_realize(DeviceState *qdev, for (i = 0; i < g->conf.max_outputs; i++) { g->scanout[i].con = graphic_console_init(DEVICE(g), i, &virtio_gpu_ops, g); - if (i > 0) { - dpy_gfx_replace_surface(g->scanout[i].con, NULL); - } } return true; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index c1f17bec17e..c9f5e36fd07 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -325,7 +325,6 @@ static void virtio_gpu_disable_scanout(VirtIOGPU *g, int scanout_id) { struct virtio_gpu_scanout *scanout = &g->parent_obj.scanout[scanout_id]; struct virtio_gpu_simple_resource *res; - DisplaySurface *ds = NULL; if (scanout->resource_id == 0) { return; @@ -336,13 +335,7 @@ static void virtio_gpu_disable_scanout(VirtIOGPU *g, int scanout_id) res->scanout_bitmask &= ~(1 << scanout_id); } - if (scanout_id == 0) { - /* primary head */ - ds = qemu_create_placeholder_surface(scanout->width ?: 640, - scanout->height ?: 480, - "Guest disabled display."); - } - dpy_gfx_replace_surface(scanout->con, ds); + dpy_gfx_replace_surface(scanout->con, NULL); scanout->resource_id = 0; scanout->ds = NULL; scanout->width = 0;