When using -display dbus,gl=on together with a virgl-capable video
device (e.g. virtio-vga-gl), a guest-initiated reboot aborts QEMU
with "dbus_scanout_texture: Assertion `tex_id' failed"

virtio-gpu's device reset path blanks each console via
qemu_console_set_surface(con, NULL), qemu_console_set_surface()
in turn substitues a placeholder DisplaySurface.  The placeholder
DisplaySurface does not have a GL texture.

Other GL-capable UI backends already guard against this: both
sdl2_gl_switch() (ui/sdl2-gl.c) and the 2D SDL path (ui/sdl2-2d.c)
check surface_is_placeholder() before touching GL-texture state.

This patch adds an equivalent check in
ui/dbus-listener.c dbus_gl_gfx_switch().

Signed-off-by: Rick Vernam <[email protected]>
---
 ui/dbus-listener.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c
index 2e2f6ba418..5f627f6acf 100644
--- a/ui/dbus-listener.c
+++ b/ui/dbus-listener.c
@@ -861,6 +861,9 @@ static void dbus_gl_gfx_switch(DisplayChangeListener *dcl,
     trace_dbus_gl_gfx_switch(new_surface);
 
     ddl->ds = new_surface;
+    if (surface_is_placeholder(new_surface)) {
+        return;   /* nothing real to scan out; avoid dereferencing a non-GL 
surface */
+    }
     ddl->ds_share = SHARE_KIND_NONE;
     if (ddl->ds) {
         int width = surface_width(ddl->ds);
-- 
2.55.0


Reply via email to