aboutsummaryrefslogtreecommitdiff
path: root/ui/dbus.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2022-02-17 15:07:21 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2022-03-15 12:54:55 +0400
commit589089feee5bf5110f21fd582f9c2c479ae718a2 (patch)
tree2e658edeb5b5abdc5b3dfb9f798d9abb9875afe0 /ui/dbus.c
parentc84ab0a500a84851debd1d4485e72325da98c778 (diff)
downloadqemu-589089feee5bf5110f21fd582f9c2c479ae718a2.zip
qemu-589089feee5bf5110f21fd582f9c2c479ae718a2.tar.gz
qemu-589089feee5bf5110f21fd582f9c2c479ae718a2.tar.bz2
ui/dbus: fix texture sharing
The DBus listener naively create, update and destroy textures without taking into account other listeners. The texture were shared, but texture update was unnecessarily duplicated. Teach DisplayGLCtx to do optionally shared texture handling. This is only implemented for DBus display at this point, however the same infrastructure could potentially be used for other future combinations. Reported-by: Akihiko Odaki <akihiko.odaki@gmail.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/dbus.c')
-rw-r--r--ui/dbus.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/ui/dbus.c b/ui/dbus.c
index 22c82d2..7a87612 100644
--- a/ui/dbus.c
+++ b/ui/dbus.c
@@ -55,11 +55,33 @@ dbus_is_compatible_dcl(DisplayGLCtx *dgc,
return dcl->ops == &dbus_gl_dcl_ops || dcl->ops == &dbus_console_dcl_ops;
}
+static void
+dbus_create_texture(DisplayGLCtx *ctx, DisplaySurface *surface)
+{
+ surface_gl_create_texture(ctx->gls, surface);
+}
+
+static void
+dbus_destroy_texture(DisplayGLCtx *ctx, DisplaySurface *surface)
+{
+ surface_gl_destroy_texture(ctx->gls, surface);
+}
+
+static void
+dbus_update_texture(DisplayGLCtx *ctx, DisplaySurface *surface,
+ int x, int y, int w, int h)
+{
+ surface_gl_update_texture(ctx->gls, surface, x, y, w, h);
+}
+
static const DisplayGLCtxOps dbus_gl_ops = {
.dpy_gl_ctx_is_compatible_dcl = dbus_is_compatible_dcl,
.dpy_gl_ctx_create = dbus_create_context,
.dpy_gl_ctx_destroy = qemu_egl_destroy_context,
.dpy_gl_ctx_make_current = qemu_egl_make_context_current,
+ .dpy_gl_ctx_create_texture = dbus_create_texture,
+ .dpy_gl_ctx_destroy_texture = dbus_destroy_texture,
+ .dpy_gl_ctx_update_texture = dbus_update_texture,
};
static NotifierList dbus_display_notifiers =
@@ -90,6 +112,9 @@ dbus_display_init(Object *o)
g_autoptr(GDBusObjectSkeleton) vm = NULL;
dd->glctx.ops = &dbus_gl_ops;
+ if (display_opengl) {
+ dd->glctx.gls = qemu_gl_init_shader();
+ }
dd->iface = qemu_dbus_display1_vm_skeleton_new();
dd->consoles = g_ptr_array_new_with_free_func(g_object_unref);
@@ -126,6 +151,7 @@ dbus_display_finalize(Object *o)
g_clear_object(&dd->iface);
g_free(dd->dbus_addr);
g_free(dd->audiodev);
+ g_clear_pointer(&dd->glctx.gls, qemu_gl_fini_shader);
dbus_display = NULL;
}