aboutsummaryrefslogtreecommitdiff
path: root/ui/gtk-gl-area.c
diff options
context:
space:
mode:
authorVivek Kasireddy <vivek.kasireddy@intel.com>2021-09-14 14:18:35 -0700
committerGerd Hoffmann <kraxel@redhat.com>2021-09-15 08:41:59 +0200
commit65b847d284c1ab8a1dbd44d2b046e87e83ebb6e0 (patch)
tree63b0281591813862f2802aa44cf4e5fda2aecc8e /ui/gtk-gl-area.c
parent121abaf3e68d620f7c4c1d16875de4a4b92fa8f8 (diff)
downloadqemu-65b847d284c1ab8a1dbd44d2b046e87e83ebb6e0.zip
qemu-65b847d284c1ab8a1dbd44d2b046e87e83ebb6e0.tar.gz
qemu-65b847d284c1ab8a1dbd44d2b046e87e83ebb6e0.tar.bz2
ui: Create sync objects and fences only for blobs
Create sync objects and fences only for dmabufs that are blobs. Once a fence is created (after glFlush) and is signalled, graphic_hw_gl_flushed() will be called and virtio-gpu cmd processing will be resumed. Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com> Message-Id: <20210914211837.3229977-4-vivek.kasireddy@intel.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/gtk-gl-area.c')
-rw-r--r--ui/gtk-gl-area.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
index dd5783f..b235237 100644
--- a/ui/gtk-gl-area.c
+++ b/ui/gtk-gl-area.c
@@ -8,6 +8,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/main-loop.h"
#include "trace.h"
@@ -71,7 +72,25 @@ void gd_gl_area_draw(VirtualConsole *vc)
surface_gl_render_texture(vc->gfx.gls, vc->gfx.ds);
}
+#ifdef CONFIG_GBM
+ if (vc->gfx.guest_fb.dmabuf) {
+ egl_dmabuf_create_sync(vc->gfx.guest_fb.dmabuf);
+ }
+#endif
+
glFlush();
+#ifdef CONFIG_GBM
+ if (vc->gfx.guest_fb.dmabuf) {
+ QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf;
+
+ egl_dmabuf_create_fence(dmabuf);
+ if (dmabuf->fence_fd > 0) {
+ qemu_set_fd_handler(dmabuf->fence_fd, gd_hw_gl_flushed, NULL, vc);
+ return;
+ }
+ graphic_hw_gl_block(vc->gfx.dcl.con, false);
+ }
+#endif
graphic_hw_gl_flushed(vc->gfx.dcl.con);
}
@@ -213,6 +232,9 @@ void gd_gl_area_scanout_flush(DisplayChangeListener *dcl,
{
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
+ if (vc->gfx.guest_fb.dmabuf) {
+ graphic_hw_gl_block(vc->gfx.dcl.con, true);
+ }
gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area));
}
@@ -231,6 +253,10 @@ void gd_gl_area_scanout_dmabuf(DisplayChangeListener *dcl,
gd_gl_area_scanout_texture(dcl, dmabuf->texture,
false, dmabuf->width, dmabuf->height,
0, 0, dmabuf->width, dmabuf->height);
+
+ if (dmabuf->allow_fences) {
+ vc->gfx.guest_fb.dmabuf = dmabuf;
+ }
#endif
}