mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 02:54:58 -06:00
ui/dbus: discard pending CursorDefine on new one
Similar to scanout updates, let's discard pending cursor changes. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-ID: <20241008125028.1177932-8-marcandre.lureau@redhat.com>
This commit is contained in:
parent
6b9524dfa5
commit
dcf62fb6ce
1 changed files with 28 additions and 0 deletions
|
@ -87,6 +87,7 @@ struct _DBusDisplayListener {
|
||||||
|
|
||||||
guint dbus_filter;
|
guint dbus_filter;
|
||||||
guint32 display_serial_to_discard;
|
guint32 display_serial_to_discard;
|
||||||
|
guint32 cursor_serial_to_discard;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE(DBusDisplayListener, dbus_display_listener, G_TYPE_OBJECT)
|
G_DEFINE_TYPE(DBusDisplayListener, dbus_display_listener, G_TYPE_OBJECT)
|
||||||
|
@ -102,6 +103,14 @@ static void ddl_discard_display_messages(DBusDisplayListener *ddl)
|
||||||
g_atomic_int_set(&ddl->display_serial_to_discard, serial);
|
g_atomic_int_set(&ddl->display_serial_to_discard, serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ddl_discard_cursor_messages(DBusDisplayListener *ddl)
|
||||||
|
{
|
||||||
|
guint32 serial = g_dbus_connection_get_last_serial(
|
||||||
|
g_dbus_proxy_get_connection(G_DBUS_PROXY(ddl->proxy)));
|
||||||
|
|
||||||
|
g_atomic_int_set(&ddl->cursor_serial_to_discard, serial);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_OPENGL
|
#ifdef CONFIG_OPENGL
|
||||||
static void dbus_scanout_disable(DisplayChangeListener *dcl)
|
static void dbus_scanout_disable(DisplayChangeListener *dcl)
|
||||||
{
|
{
|
||||||
|
@ -502,6 +511,8 @@ static void dbus_cursor_dmabuf(DisplayChangeListener *dcl,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ddl_discard_cursor_messages(ddl);
|
||||||
|
|
||||||
egl_dmabuf_import_texture(dmabuf);
|
egl_dmabuf_import_texture(dmabuf);
|
||||||
texture = qemu_dmabuf_get_texture(dmabuf);
|
texture = qemu_dmabuf_get_texture(dmabuf);
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
|
@ -745,6 +756,8 @@ static void dbus_cursor_define(DisplayChangeListener *dcl,
|
||||||
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
|
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
|
||||||
GVariant *v_data = NULL;
|
GVariant *v_data = NULL;
|
||||||
|
|
||||||
|
ddl_discard_cursor_messages(ddl);
|
||||||
|
|
||||||
v_data = g_variant_new_from_data(
|
v_data = g_variant_new_from_data(
|
||||||
G_VARIANT_TYPE("ay"),
|
G_VARIANT_TYPE("ay"),
|
||||||
c->data,
|
c->data,
|
||||||
|
@ -1028,6 +1041,21 @@ dbus_filter(GDBusConnection *connection,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
discard_serial = g_atomic_int_get(&ddl->cursor_serial_to_discard);
|
||||||
|
if (serial <= discard_serial) {
|
||||||
|
const gchar *member = g_dbus_message_get_member(message);
|
||||||
|
static const char *const cursor_messages[] = {
|
||||||
|
"CursorDefine",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
if (g_strv_contains(cursor_messages, member)) {
|
||||||
|
trace_dbus_filter(serial, discard_serial);
|
||||||
|
g_object_unref(message);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue