diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2024-03-07 18:04:31 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2024-03-12 17:57:58 +0400 |
commit | 7945576cf298efb90a03b3e74912e3fe5952db56 (patch) | |
tree | 672e2bdaeca79e152fbe9f650d7fe10d3dd194e6 | |
parent | 349b1881deeb28999639444df4d318787673aed9 (diff) |
ui/dbus: factor out sending a scanout
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-rw-r--r-- | ui/dbus-listener.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 18f556aa73..3f4529dbbd 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -630,11 +630,26 @@ static void dbus_gfx_update_sub(DBusDisplayListener *ddl, DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL); } +static void ddl_scanout(DBusDisplayListener *ddl) +{ + GVariant *v_data; + + v_data = g_variant_new_from_data( + G_VARIANT_TYPE("ay"), surface_data(ddl->ds), + surface_stride(ddl->ds) * surface_height(ddl->ds), TRUE, + (GDestroyNotify)pixman_image_unref, pixman_image_ref(ddl->ds->image)); + + qemu_dbus_display1_listener_call_scanout( + ddl->proxy, surface_width(ddl->ds), surface_height(ddl->ds), + surface_stride(ddl->ds), surface_format(ddl->ds), v_data, + G_DBUS_CALL_FLAGS_NONE, DBUS_DEFAULT_TIMEOUT, NULL, NULL, + g_object_ref(ddl)); +} + static void dbus_gfx_update(DisplayChangeListener *dcl, int x, int y, int w, int h) { DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl); - GVariant *v_data; assert(ddl->ds); @@ -652,23 +667,7 @@ static void dbus_gfx_update(DisplayChangeListener *dcl, #endif if (x == 0 && y == 0 && w == surface_width(ddl->ds) && h == surface_height(ddl->ds)) { - v_data = g_variant_new_from_data( - G_VARIANT_TYPE("ay"), - surface_data(ddl->ds), - surface_stride(ddl->ds) * surface_height(ddl->ds), - TRUE, - (GDestroyNotify)pixman_image_unref, - pixman_image_ref(ddl->ds->image)); - qemu_dbus_display1_listener_call_scanout( - ddl->proxy, - surface_width(ddl->ds), - surface_height(ddl->ds), - surface_stride(ddl->ds), - surface_format(ddl->ds), - v_data, - G_DBUS_CALL_FLAGS_NONE, - DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL); - return; + return ddl_scanout(ddl); } dbus_gfx_update_sub(ddl, x, y, w, h); |