Skip to contentSkip to conversation

ui/gtk: graphic_hw_gl_flushed after closing dmabuf->fence_fd

PATCH In review Dongwon Kim 2 participants 2 messages Nov 21, 2021 – Nov 22, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/gtk: graphic_hw_gl_flushed after closing dmabuf->fence_fd

The dmabuf often becomes invalid right after unblocking pipeline and graphic_hw_gl_flushed in case a new scanout blob is submitted because the dmabuf associated with the current guest scanout is freed after swapping.

So both graphic_hw_gl_block and graphic_hw_gl_flushed should be executed after closing fence_fd for the current dmabuf.

Cc Gerd Hoffmann <[email protected]>
Cc Vivek Kasireddy <[email protected]>
---
 ui/gtk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ui/gtk.c +2 -2
index 7abe1a69d8..2a3a9db13f 100644
@@ -589,11 +589,11 @@ void gd_hw_gl_flushed(void *vcon)
     VirtualConsole *vc = vcon;
     QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf;
 
-    graphic_hw_gl_block(vc->gfx.dcl.con, false);
-    graphic_hw_gl_flushed(vc->gfx.dcl.con);
     qemu_set_fd_handler(dmabuf->fence_fd, NULL, NULL, NULL);
     close(dmabuf->fence_fd);
     dmabuf->fence_fd = -1;
+    graphic_hw_gl_block(vc->gfx.dcl.con, false);
+    graphic_hw_gl_flushed(vc->gfx.dcl.con);
 }
 
 /** DisplayState Callbacks (opengl version) **/
Signature · 1 line
2.30.2
#1 lore raw
Quoted 10 lines · Dongwon Kim

The dmabuf often becomes invalid right after unblocking pipeline and graphic_hw_gl_flushed in case a new scanout blob is submitted because the dmabuf associated with the current guest scanout is freed after swapping.

So both graphic_hw_gl_block and graphic_hw_gl_flushed should be executed after closing fence_fd for the current dmabuf.

Cc Gerd Hoffmann <[email protected]>
Cc Vivek Kasireddy <[email protected]>

If so:

Fixes 65b847d284c ("ui: Create sync objects and fences only for blobs")
Quoted 24 lines
---
 ui/gtk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ui/gtk.c +2 -2
index 7abe1a69d8..2a3a9db13f 100644
@@ -589,11 +589,11 @@ void gd_hw_gl_flushed(void *vcon)
     VirtualConsole *vc = vcon;
     QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf;
 
-    graphic_hw_gl_block(vc->gfx.dcl.con, false);
-    graphic_hw_gl_flushed(vc->gfx.dcl.con);
     qemu_set_fd_handler(dmabuf->fence_fd, NULL, NULL, NULL);
     close(dmabuf->fence_fd);
     dmabuf->fence_fd = -1;
+    graphic_hw_gl_block(vc->gfx.dcl.con, false);
+    graphic_hw_gl_flushed(vc->gfx.dcl.con);
 }
 
 /** DisplayState Callbacks (opengl version) **/