ui/gtk: prevent ui lock up when dpy_gl_update called again before current draw event occurs
PATCH 1/1 ui/gtk: prevent ui lock up when dpy_gl_update called again before current draw event occurs
A warning, "qemu: warning: console: no gl-unblock within" followed by guest scanout lockup can happen if dpy_gl_update is called in a row and the second call is made before gd_draw_event scheduled by the first call is taking place. This is because draw call returns without decrementing gl_block ref count if the dmabuf was already submitted as shown below.
(gd_gl_area_draw/gd_egl_draw)
if (dmabuf) {
if (!dmabuf->draw_submitted) {
return;
} else {
dmabuf->draw_submitted = false;
}
}So it should not schedule any redundant draw event in case draw_submitted is already set in gd_egl_fluch/gd_gl_area_scanout_flush.
--- ui/gtk-egl.c | 2 +- ui/gtk-gl-area.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
ui/gtk-egl.c +1 -1
@@ -341,7 +341,7 @@ void gd_egl_flush(DisplayChangeListener *dcl,VirtualConsole *vc =container_of (dcl, VirtualConsole, gfx.dcl);GtkWidget *area = vc->gfx.drawing_area; -if (vc->gfx.guest_fb.dmabuf) { +if (vc->gfx.guest_fb.dmabuf && !vc->gfx.guest_fb.dmabuf->draw_submitted) {graphic_hw_gl_block (vc->gfx.dcl.con, true); vc->gfx.guest_fb.dmabuf->draw_submitted = true;gtk_widget_queue_draw_area (area, x, y, w, h);
ui/gtk-gl-area.c +1 -1
@@ -278,7 +278,7 @@ void gd_gl_area_scanout_flush(DisplayChangeListener *dcl, {VirtualConsole *vc =container_of (dcl, VirtualConsole, gfx.dcl); -if (vc->gfx.guest_fb.dmabuf) { +if (vc->gfx.guest_fb.dmabuf && !vc->gfx.guest_fb.dmabuf->draw_submitted) {graphic_hw_gl_block (vc->gfx.dcl.con, true); vc->gfx.guest_fb.dmabuf->draw_submitted = true; }
Signature · 1 line
2.30.2
Quoted 17 lines · Dongwon Kim
A warning, "qemu: warning: console: no gl-unblock within" followed by guest scanout lockup can happen if
dpy_gl_updateis called in a row and the second call is made beforegd_draw_eventscheduled by the first call is taking place. This is because draw call returns without decrementinggl_blockref count if the dmabuf was already submitted as shown below.(gd_gl_area_draw/gd_egl_draw)
if (dmabuf) { if (!dmabuf->draw_submitted) { return; } else { dmabuf->draw_submitted = false; } }
Quoted 8 lines
So it should not schedule any redundant draw event in case
draw_submittedis
already set in gd_egl_fluch/gd_gl_area_scanout_flush.Cc Gerd Hoffmann <[email protected]>Cc Vivek Kasireddy <[email protected]>Signed-off-by Dongwon Kim <[email protected]>
Quoted 39 lines
--- ui/gtk-egl.c | 2 +- ui/gtk-gl-area.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)ui/gtk-egl.c +1
-1@@ -341,7 +341,7 @@ void gd_egl_flush(DisplayChangeListener *dcl,VirtualConsole *vc =container_of (dcl, VirtualConsole, gfx.dcl);GtkWidget *area = vc->gfx.drawing_area; -if (vc->gfx.guest_fb.dmabuf) { +if (vc->gfx.guest_fb.dmabuf && !vc->gfx.guest_fb.dmabuf->draw_submitted) {graphic_hw_gl_block (vc->gfx.dcl.con, true); vc->gfx.guest_fb.dmabuf->draw_submitted = true;gtk_widget_queue_draw_area(area, x, y, w, h);ui/gtk-gl-area.c +1
-1@@ -278,7 +278,7 @@ void gd_gl_area_scanout_flush(DisplayChangeListener *dcl, { VirtualConsole *vc =container_of (dcl, VirtualConsole, gfx.dcl); -if (vc->gfx.guest_fb.dmabuf) { +if (vc->gfx.guest_fb.dmabuf && !vc->gfx.guest_fb.dmabuf->draw_submitted) {graphic_hw_gl_block (vc->gfx.dcl.con, true);vc->gfx.guest_fb.dmabuf->draw_submitted = true; }--
2.30.2
Signature · 1 line
Marc-André Lureau