Skip to contentSkip to conversation

ui/dbus: skip GL scanout dispatch for placeholder surfaces

PATCH In review Rick Vernam 2 participants 2 messages Sep 7 – Sep 8

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/dbus: skip GL scanout dispatch for placeholder surfaces

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().

---
 ui/dbus-listener.c | 3 +++
 1 file changed, 3 insertions(+)
ui/dbus-listener.c +3 -0
index 2e2f6ba418..5f627f6acf 100644
@@ -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);
Signature · 1 line
2.55.0
#1 lore raw

Hi

Quoted 4 lines · Rick Vernam

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"

I do not observe such crash. How did you configure QEMU? Can you provide a backtrace?

Quoted 5 lines

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.

Before calling gfx_switch(), it calls gfx_create_texture()

Quoted 4 lines

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.

Not for this reason though, afaict. (for secondary/disabled screens)

Quoted 26 lines

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

---
 ui/dbus-listener.c | 3 +++
 1 file changed, 3 insertions(+)
ui/dbus-listener.c +3 -1
index 2e2f6ba418..5f627f6acf 100644
@@ -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