summaryrefslogtreecommitdiffstats
path: root/ui/gtk-gl-area.c
diff options
context:
space:
mode:
authorPeter Maydell2021-02-05 11:09:16 +0100
committerPeter Maydell2021-02-05 11:09:16 +0100
commit923abdb4bdfb6d93bfe6c941ead70f3ea6707e40 (patch)
treeb030755ba9dd824b377b82a983798e8f8b6f9b91 /ui/gtk-gl-area.c
parentMerge remote-tracking branch 'remotes/dgilbert-gitlab/tags/pull-virtiofs-2021... (diff)
parenttests: add some virtio-gpu & vhost-user-gpu acceptance test (diff)
downloadqemu-923abdb4bdfb6d93bfe6c941ead70f3ea6707e40.tar.gz
qemu-923abdb4bdfb6d93bfe6c941ead70f3ea6707e40.tar.xz
qemu-923abdb4bdfb6d93bfe6c941ead70f3ea6707e40.zip
Merge remote-tracking branch 'remotes/kraxel/tags/vga-ui-20210205-pull-request' into staging
ui+virtio-gpu: opengl cleanups and fixes. qxl+spice: bugfixes # gpg: Signature made Fri 05 Feb 2021 06:56:04 GMT # gpg: using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/vga-ui-20210205-pull-request: (24 commits) tests: add some virtio-gpu & vhost-user-gpu acceptance test chardev: check if the chardev is registered for yanking display/ui: add a callback to indicate GL state is flushed virtio-gpu: avoid re-entering cmdq processing ui: add egl dmabuf import to gtkglarea ui: check gtk-egl dmabuf support ui: add qemu_egl_has_dmabuf helper ui: check hw requirements during DCL registration ui: add a DCLOps callback to check dmabuf support ui: add an optional get_flags callback to GraphicHwOps vhost-user-gpu: add a configuration flag for dmabuf usage ui: remove console_has_gl_dmabuf() ui: annotate DCLOps callback requirements ui: add gd_gl_area_scanout_disable ui: remove gl_ctx_get_current ui: remove extra #ifdef CONFIG_OPENGL vhost-user-gpu: handle display-info in a callback vhost-user-gpu: use an extandable state enum for commands vhost-user-gpu: handle vhost-user-gpu features in a callback vhost-user-gpu: check backend for EDID support ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/gtk-gl-area.c')
-rw-r--r--ui/gtk-gl-area.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
index 98c22d23f5..e7ca73c7b1 100644
--- a/ui/gtk-gl-area.c
+++ b/ui/gtk-gl-area.c
@@ -70,6 +70,9 @@ void gd_gl_area_draw(VirtualConsole *vc)
surface_gl_setup_viewport(vc->gfx.gls, vc->gfx.ds, ww, wh);
surface_gl_render_texture(vc->gfx.gls, vc->gfx.ds);
}
+
+ glFlush();
+ graphic_hw_gl_flushed(vc->gfx.dcl.con);
}
void gd_gl_area_update(DisplayChangeListener *dcl,
@@ -198,6 +201,13 @@ void gd_gl_area_scanout_texture(DisplayChangeListener *dcl,
backing_id, false);
}
+void gd_gl_area_scanout_disable(DisplayChangeListener *dcl)
+{
+ VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
+
+ gtk_gl_area_set_scanout_mode(vc, false);
+}
+
void gd_gl_area_scanout_flush(DisplayChangeListener *dcl,
uint32_t x, uint32_t y, uint32_t w, uint32_t h)
{
@@ -206,6 +216,24 @@ void gd_gl_area_scanout_flush(DisplayChangeListener *dcl,
gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area));
}
+void gd_gl_area_scanout_dmabuf(DisplayChangeListener *dcl,
+ QemuDmaBuf *dmabuf)
+{
+#ifdef CONFIG_OPENGL_DMABUF
+ VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
+
+ gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area));
+ egl_dmabuf_import_texture(dmabuf);
+ if (!dmabuf->texture) {
+ return;
+ }
+
+ gd_gl_area_scanout_texture(dcl, dmabuf->texture,
+ false, dmabuf->width, dmabuf->height,
+ 0, 0, dmabuf->width, dmabuf->height);
+#endif
+}
+
void gtk_gl_area_init(void)
{
display_opengl = 1;