[PATCH 07/16] ui/dbus: discard pending CursorDefine on new one

marcandre.lureau@redhat.com posted 16 patches 1 month, 3 weeks ago
There is a newer version of this series
[PATCH 07/16] ui/dbus: discard pending CursorDefine on new one
Posted by marcandre.lureau@redhat.com 1 month, 3 weeks ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Similar to scanout updates, let's discard pending cursor changes.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/dbus-listener.c | 23 +++++++++++++++++++++++
 roms/openbios      |  2 +-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c
index 23a4633fa4..020c05198b 100644
--- a/ui/dbus-listener.c
+++ b/ui/dbus-listener.c
@@ -87,6 +87,7 @@ struct _DBusDisplayListener {
 
     guint dbus_filter;
     guint32 display_serial_to_discard;
+    guint32 cursor_serial_to_discard;
 };
 
 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);
 }
 
+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
 static void dbus_scanout_disable(DisplayChangeListener *dcl)
 {
@@ -502,6 +511,8 @@ static void dbus_cursor_dmabuf(DisplayChangeListener *dcl,
         return;
     }
 
+    ddl_discard_cursor_messages(ddl);
+
     egl_dmabuf_import_texture(dmabuf);
     texture = qemu_dmabuf_get_texture(dmabuf);
     if (!texture) {
@@ -745,6 +756,8 @@ static void dbus_cursor_define(DisplayChangeListener *dcl,
     DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
     GVariant *v_data = NULL;
 
+    ddl_discard_cursor_messages(ddl);
+
     v_data = g_variant_new_from_data(
         G_VARIANT_TYPE("ay"),
         c->data,
@@ -1027,6 +1040,16 @@ dbus_filter(GDBusConnection *connection,
         }
     }
 
+    discard_serial = g_atomic_int_get(&ddl->cursor_serial_to_discard);
+    if (serial <= discard_serial) {
+        member = g_dbus_message_get_member(message);
+        if (g_strv_contains((const gchar *[]) { "CursorDefine", NULL }, member)) {
+            trace_dbus_filter(serial, discard_serial);
+            g_object_unref(message);
+            return NULL;
+        }
+    }
+
     return message;
 }
 
diff --git a/roms/openbios b/roms/openbios
index c3a19c1e54..af97fd7af5 160000
--- a/roms/openbios
+++ b/roms/openbios
@@ -1 +1 @@
-Subproject commit c3a19c1e54977a53027d6232050e1e3e39a98a1b
+Subproject commit af97fd7af5e7c18f591a7b987291d3db4ffb28b5
-- 
2.45.2.827.g557ae147e6


Re: [PATCH 07/16] ui/dbus: discard pending CursorDefine on new one
Posted by Akihiko Odaki 1 month, 2 weeks ago
On 2024/10/03 20:22, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Similar to scanout updates, let's discard pending cursor changes.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   ui/dbus-listener.c | 23 +++++++++++++++++++++++
>   roms/openbios      |  2 +-
>   2 files changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c
> index 23a4633fa4..020c05198b 100644
> --- a/ui/dbus-listener.c
> +++ b/ui/dbus-listener.c
> @@ -87,6 +87,7 @@ struct _DBusDisplayListener {
>   
>       guint dbus_filter;
>       guint32 display_serial_to_discard;
> +    guint32 cursor_serial_to_discard;
>   };
>   
>   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);
>   }
>   
> +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
>   static void dbus_scanout_disable(DisplayChangeListener *dcl)
>   {
> @@ -502,6 +511,8 @@ static void dbus_cursor_dmabuf(DisplayChangeListener *dcl,
>           return;
>       }
>   
> +    ddl_discard_cursor_messages(ddl);
> +
>       egl_dmabuf_import_texture(dmabuf);
>       texture = qemu_dmabuf_get_texture(dmabuf);
>       if (!texture) {
> @@ -745,6 +756,8 @@ static void dbus_cursor_define(DisplayChangeListener *dcl,
>       DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
>       GVariant *v_data = NULL;
>   
> +    ddl_discard_cursor_messages(ddl);
> +
>       v_data = g_variant_new_from_data(
>           G_VARIANT_TYPE("ay"),
>           c->data,
> @@ -1027,6 +1040,16 @@ dbus_filter(GDBusConnection *connection,
>           }
>       }
>   
> +    discard_serial = g_atomic_int_get(&ddl->cursor_serial_to_discard);
> +    if (serial <= discard_serial) {
> +        member = g_dbus_message_get_member(message);
> +        if (g_strv_contains((const gchar *[]) { "CursorDefine", NULL }, member)) {
> +            trace_dbus_filter(serial, discard_serial);
> +            g_object_unref(message);
> +            return NULL;
> +        }
> +    }
> +
>       return message;
>   }
>   
> diff --git a/roms/openbios b/roms/openbios
> index c3a19c1e54..af97fd7af5 160000
> --- a/roms/openbios
> +++ b/roms/openbios
> @@ -1 +1 @@
> -Subproject commit c3a19c1e54977a53027d6232050e1e3e39a98a1b
> +Subproject commit af97fd7af5e7c18f591a7b987291d3db4ffb28b5

An accidental change of roms/openbios.

Re: [PATCH 07/16] ui/dbus: discard pending CursorDefine on new one
Posted by Marc-André Lureau 1 month, 2 weeks ago
Hi

On Sat, Oct 5, 2024 at 12:45 PM Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> On 2024/10/03 20:22, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > Similar to scanout updates, let's discard pending cursor changes.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >   ui/dbus-listener.c | 23 +++++++++++++++++++++++
> >   roms/openbios      |  2 +-
> >   2 files changed, 24 insertions(+), 1 deletion(-)
> >
> > diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c
> > index 23a4633fa4..020c05198b 100644
> > --- a/ui/dbus-listener.c
> > +++ b/ui/dbus-listener.c
> > @@ -87,6 +87,7 @@ struct _DBusDisplayListener {
> >
> >       guint dbus_filter;
> >       guint32 display_serial_to_discard;
> > +    guint32 cursor_serial_to_discard;
> >   };
> >
> >   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);
> >   }
> >
> > +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
> >   static void dbus_scanout_disable(DisplayChangeListener *dcl)
> >   {
> > @@ -502,6 +511,8 @@ static void dbus_cursor_dmabuf(DisplayChangeListener *dcl,
> >           return;
> >       }
> >
> > +    ddl_discard_cursor_messages(ddl);
> > +
> >       egl_dmabuf_import_texture(dmabuf);
> >       texture = qemu_dmabuf_get_texture(dmabuf);
> >       if (!texture) {
> > @@ -745,6 +756,8 @@ static void dbus_cursor_define(DisplayChangeListener *dcl,
> >       DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
> >       GVariant *v_data = NULL;
> >
> > +    ddl_discard_cursor_messages(ddl);
> > +
> >       v_data = g_variant_new_from_data(
> >           G_VARIANT_TYPE("ay"),
> >           c->data,
> > @@ -1027,6 +1040,16 @@ dbus_filter(GDBusConnection *connection,
> >           }
> >       }
> >
> > +    discard_serial = g_atomic_int_get(&ddl->cursor_serial_to_discard);
> > +    if (serial <= discard_serial) {
> > +        member = g_dbus_message_get_member(message);
> > +        if (g_strv_contains((const gchar *[]) { "CursorDefine", NULL }, member)) {
> > +            trace_dbus_filter(serial, discard_serial);
> > +            g_object_unref(message);
> > +            return NULL;
> > +        }
> > +    }
> > +
> >       return message;
> >   }
> >
> > diff --git a/roms/openbios b/roms/openbios
> > index c3a19c1e54..af97fd7af5 160000
> > --- a/roms/openbios
> > +++ b/roms/openbios
> > @@ -1 +1 @@
> > -Subproject commit c3a19c1e54977a53027d6232050e1e3e39a98a1b
> > +Subproject commit af97fd7af5e7c18f591a7b987291d3db4ffb28b5
>
> An accidental change of roms/openbios.

good catch.. thanks