All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/1] an extensible SetUIInfo2 design
@ 2026-08-07  8:40 Chengyang Zhu
  2026-08-07  8:40 ` [PATCH RFC 1/1] ui/dbus: add extensible SetUIInfo2 method Chengyang Zhu
  2026-08-10  7:20 ` [PATCH RFC 0/1] an extensible SetUIInfo2 design Marc-André Lureau
  0 siblings, 2 replies; 3+ messages in thread
From: Chengyang Zhu @ 2026-08-07  8:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, Chengyang Zhu

Currently, the `SetUIInfo` method cannot set a refresh rate.
Simply adding a refresh_rate argument would break the method signature.

This RFC adds the `SetUIInfo2` method and `QemuUIInfoTypes` property.
  * `SetUIInfo2` takes a dictionary,
    allowing partial updates and adding more keys in the future.
  * `QemuUIInfoTypes` exposes the schema of `SetUIInfo2`'s argument.

This patch is a proof-of-concept and it needs further discussion on:
  * public API design (the name and the signature)
  * partial update behavior (only updating the recognized fields)
  * error handling (ignore the wrong keys or return an error?)

Test results:
  * qemu:qtest-x86_64/dbus-display-test passed
  * qemu:qtest-x86_64/dbus-vmstate-test passed
  * qemu:qtest-x86_64/dbus-vnc-test SKIP
  * manually created a virtual machine
    and successfully set its refresh rate and resolution via `SetUIInfo2`

Chengyang Zhu (1):
  ui/dbus: add extensible SetUIInfo2 method

 ui/dbus-console.c    | 56 ++++++++++++++++++++++++++++++++++++++++++++
 ui/dbus-display1.xml | 17 ++++++++++++++
 2 files changed, 73 insertions(+)

-- 
2.55.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH RFC 1/1] ui/dbus: add extensible SetUIInfo2 method
  2026-08-07  8:40 [PATCH RFC 0/1] an extensible SetUIInfo2 design Chengyang Zhu
@ 2026-08-07  8:40 ` Chengyang Zhu
  2026-08-10  7:20 ` [PATCH RFC 0/1] an extensible SetUIInfo2 design Marc-André Lureau
  1 sibling, 0 replies; 3+ messages in thread
From: Chengyang Zhu @ 2026-08-07  8:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, Chengyang Zhu

Currently, the `SetUIInfo` method cannot set a refresh rate.
Simply adding a `refresh_rate` argument would break the method signature.

This patch adds:
  * An extensible `SetUIInfo2` method which takes a dictionary as input.
  * A property `QemuUIInfoTypes`
    which exposes the schema of the `SetUIInfo2` method's argument.

Signed-off-by: Chengyang Zhu <colazcyg@gmail.com>
---
 ui/dbus-console.c    | 56 ++++++++++++++++++++++++++++++++++++++++++++
 ui/dbus-display1.xml | 17 ++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/ui/dbus-console.c b/ui/dbus-console.c
index e1ac06814b..853a8a4087 100644
--- a/ui/dbus-console.c
+++ b/ui/dbus-console.c
@@ -217,6 +217,40 @@ dbus_console_set_ui_info(DBusDisplayConsole *ddc,
     return DBUS_METHOD_INVOCATION_HANDLED;
 }
 
+static gboolean
+dbus_console_set_ui_info2(DBusDisplayConsole *ddc,
+                         GDBusMethodInvocation *invocation,
+                         GVariant *arg_ui_info)
+{
+    if (!qemu_console_ui_info_supported(ddc->dcl.con)) {
+        g_dbus_method_invocation_return_error(invocation,
+                                              DBUS_DISPLAY_ERROR,
+                                              DBUS_DISPLAY_ERROR_UNSUPPORTED,
+                                              "SetUIInfo2 is not supported");
+        return DBUS_METHOD_INVOCATION_HANDLED;
+    }
+
+    GVariantDict ui_info_dict;
+    g_variant_dict_init(&ui_info_dict, arg_ui_info);
+
+    QemuUIInfo info = *qemu_console_get_ui_info(ddc->dcl.con);
+
+    g_variant_dict_lookup(&ui_info_dict, "width_mm", "q", &info.width_mm);
+    g_variant_dict_lookup(&ui_info_dict, "height_mm", "q", &info.height_mm);
+    g_variant_dict_lookup(&ui_info_dict, "xoff", "i", &info.xoff);
+    g_variant_dict_lookup(&ui_info_dict, "yoff", "i", &info.yoff);
+    g_variant_dict_lookup(&ui_info_dict, "width", "u", &info.width);
+    g_variant_dict_lookup(&ui_info_dict, "height", "u", &info.height);
+    g_variant_dict_lookup(&ui_info_dict, "refresh_rate",
+                                         "u", &info.refresh_rate);
+
+    g_variant_dict_clear(&ui_info_dict);
+
+    qemu_console_set_ui_info(ddc->dcl.con, &info, false);
+    qemu_dbus_display1_console_complete_set_uiinfo2(ddc->iface, invocation);
+    return DBUS_METHOD_INVOCATION_HANDLED;
+}
+
 #ifdef G_OS_WIN32
 bool
 dbus_win32_import_socket(GDBusMethodInvocation *invocation,
@@ -538,6 +572,23 @@ QemuConsole *dbus_display_console_get_qemu_console(DBusDisplayConsole *ddc)
     return ddc->dcl.con;
 }
 
+static GVariant *get_qemu_ui_info_types(void)
+{
+    GVariantBuilder builder;
+
+    g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sg}"));
+
+    g_variant_builder_add(&builder, "{sg}", "width_mm", "q");
+    g_variant_builder_add(&builder, "{sg}", "height_mm", "q");
+    g_variant_builder_add(&builder, "{sg}", "xoff", "i");
+    g_variant_builder_add(&builder, "{sg}", "yoff", "i");
+    g_variant_builder_add(&builder, "{sg}", "width", "u");
+    g_variant_builder_add(&builder, "{sg}", "height", "u");
+    g_variant_builder_add(&builder, "{sg}", "refresh_rate", "u");
+
+    return g_variant_builder_end(&builder);
+}
+
 DBusDisplayConsole *
 dbus_display_console_new(DBusDisplay *display, QemuConsole *con)
 {
@@ -575,6 +626,7 @@ dbus_display_console_new(DBusDisplay *display, QemuConsole *con)
         "width", qemu_console_get_width(con, 0),
         "height", qemu_console_get_height(con, 0),
         "device-address", device_addr,
+        "qemu-uiinfo-types", get_qemu_ui_info_types(),
         "interfaces", interfaces,
         NULL);
     g_object_connect(ddc->iface,
@@ -583,6 +635,10 @@ dbus_display_console_new(DBusDisplay *display, QemuConsole *con)
         "swapped-signal::handle-set-uiinfo",
         dbus_console_set_ui_info, ddc,
         NULL);
+    g_object_connect(ddc->iface,
+        "swapped-signal::handle-set-uiinfo2",
+        dbus_console_set_ui_info2, ddc,
+        NULL);
     g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(ddc),
         G_DBUS_INTERFACE_SKELETON(ddc->iface));
 
diff --git a/ui/dbus-display1.xml b/ui/dbus-display1.xml
index d96bae2ed6..aa1816d02c 100644
--- a/ui/dbus-display1.xml
+++ b/ui/dbus-display1.xml
@@ -100,6 +100,23 @@
       <arg name="height" type="u" direction="in"/>
     </method>
 
+    <!--
+        QemuUIInfoTypes:
+
+        A D-Bus dictionary which maps the names of QemuUIInfo members to D-Bus type signatures.
+    -->
+    <property name="QemuUIInfoTypes" type="a{sg}" access="read"/>
+
+    <!--
+        SetUIInfo2:
+        @ui_info: the new QemuUIInfo.
+
+        Modify the display settings.
+    -->
+    <method name="SetUIInfo2">
+      <arg name="ui_info" type="a{sv}" direction="in"/>
+    </method>
+
     <!--
         Label:
 
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH RFC 0/1] an extensible SetUIInfo2 design
  2026-08-07  8:40 [PATCH RFC 0/1] an extensible SetUIInfo2 design Chengyang Zhu
  2026-08-07  8:40 ` [PATCH RFC 1/1] ui/dbus: add extensible SetUIInfo2 method Chengyang Zhu
@ 2026-08-10  7:20 ` Marc-André Lureau
  1 sibling, 0 replies; 3+ messages in thread
From: Marc-André Lureau @ 2026-08-10  7:20 UTC (permalink / raw)
  To: Chengyang Zhu; +Cc: qemu-devel

Hi Chengyang

On Fri, Aug 7, 2026 at 4:12 PM Chengyang Zhu <colazcyg@gmail.com> wrote:
>
> Currently, the `SetUIInfo` method cannot set a refresh rate.
> Simply adding a refresh_rate argument would break the method signature.
>
> This RFC adds the `SetUIInfo2` method and `QemuUIInfoTypes` property.
>   * `SetUIInfo2` takes a dictionary,
>     allowing partial updates and adding more keys in the future.
>   * `QemuUIInfoTypes` exposes the schema of `SetUIInfo2`'s argument.
>
> This patch is a proof-of-concept and it needs further discussion on:
>   * public API design (the name and the signature)
>   * partial update behavior (only updating the recognized fields)
>   * error handling (ignore the wrong keys or return an error?)
>

It's an interesting design to use an extensible dict for arguments,
but it's not very idiomatic or discoverable by existing tools.

Instead, can we introduce an extra interface org.qemu.Display1.UIInfo
with the properties and an Apply() method that applies the staged
values?

> Test results:
>   * qemu:qtest-x86_64/dbus-display-test passed
>   * qemu:qtest-x86_64/dbus-vmstate-test passed
>   * qemu:qtest-x86_64/dbus-vnc-test SKIP
>   * manually created a virtual machine
>     and successfully set its refresh rate and resolution via `SetUIInfo2`
>
> Chengyang Zhu (1):
>   ui/dbus: add extensible SetUIInfo2 method
>
>  ui/dbus-console.c    | 56 ++++++++++++++++++++++++++++++++++++++++++++
>  ui/dbus-display1.xml | 17 ++++++++++++++
>  2 files changed, 73 insertions(+)
>
> --
> 2.55.0
>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-10  7:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-07  8:40 [PATCH RFC 0/1] an extensible SetUIInfo2 design Chengyang Zhu
2026-08-07  8:40 ` [PATCH RFC 1/1] ui/dbus: add extensible SetUIInfo2 method Chengyang Zhu
2026-08-10  7:20 ` [PATCH RFC 0/1] an extensible SetUIInfo2 design Marc-André Lureau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.