summaryrefslogtreecommitdiffstats
path: root/ui/sdl2-gl.c
diff options
context:
space:
mode:
authorAkihiko Odaki2021-02-25 11:13:15 +0100
committerGerd Hoffmann2021-03-04 09:35:36 +0100
commitc821a58ee7003c2a0567dddaee33c2a5ae71c404 (patch)
tree9235443c12f984ebc66ef35e9b20e418ce4fd7de /ui/sdl2-gl.c
parentui/console: Add placeholder flag to message surface (diff)
downloadqemu-c821a58ee7003c2a0567dddaee33c2a5ae71c404.tar.gz
qemu-c821a58ee7003c2a0567dddaee33c2a5ae71c404.tar.xz
qemu-c821a58ee7003c2a0567dddaee33c2a5ae71c404.zip
ui/console: Pass placeholder surface to displays
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 <akihiko.odaki@gmail.com> Message-Id: <20210225101316.83940-2-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/sdl2-gl.c')
-rw-r--r--ui/sdl2-gl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c
index fd594d7461..a21d2deed9 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);
}