[PATCH v3 00/18] ui: Move and clean up monitor command code

Markus Armbruster posted 18 patches 1 year, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20221220090645.2844881-1-armbru@redhat.com
Maintainers: "Marc-André Lureau" <marcandre.lureau@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Markus Armbruster <armbru@redhat.com>
There is a newer version of this series
meson.build                   |   4 +-
hw/display/qxl.h              |   2 -
include/monitor/hmp.h         |   8 +
include/monitor/qmp-helpers.h |  26 ++
include/ui/console.h          |   2 +-
include/ui/qemu-spice.h       |   8 +-
include/ui/spice-display.h    |   2 -
chardev/spice.c               |   2 -
hw/display/qxl.c              |  26 +-
monitor/hmp-cmds.c            | 368 +--------------------------
monitor/misc.c                |  67 -----
monitor/qmp-cmds.c            | 176 +++----------
ui/input.c                    |  28 +--
ui/spice-display.c            |  10 -
ui/ui-hmp-cmds.c              | 461 ++++++++++++++++++++++++++++++++++
ui/ui-qmp-cmds.c              | 177 +++++++++++++
ui/vdagent.c                  |   4 -
hw/display/trace-events       |   1 -
ui/meson.build                |   2 +
19 files changed, 725 insertions(+), 649 deletions(-)
create mode 100644 include/monitor/qmp-helpers.h
create mode 100644 ui/ui-hmp-cmds.c
create mode 100644 ui/ui-qmp-cmds.c
[PATCH v3 00/18] ui: Move and clean up monitor command code
Posted by Markus Armbruster 1 year, 4 months ago
This is mainly about splitting off monitor-related code.  There's also
a minimum Spice version bump, and a few UI improvements to HMP
commands sendkey, change vnc, and info spice.

The only reason for keeping new PATCH 12 separate from old PATCH 11 is
preserving PATCH 11's R-bys.  I might squash them together.

v3:
* Rebased, straighforward conflicts with "qapi: Elide redundant
  has_FOO in generated C" (merge commit ae2b87341b5)
* PATCH 09: Commit message pasto fixed
* PATCH 11: Comment tweaked
* PATCH 12: New
* PATCH 13: protocol_table[] made const [Philippe], #include tweaked
* PATCH 16-18: New

Markus Armbruster (18):
  ui: Check numeric part of expire_password argument @time properly
  ui: Fix silent truncation of numeric keys in HMP sendkey
  ui/spice: Require spice-protocol >= 0.14.0
  Revert "hmp: info spice: take out webdav"
  ui/spice: Require spice-server >= 0.14.0
  ui/spice: QXLInterface method set_mm_time() is now dead, drop
  ui/spice: Give hmp_info_spice()'s channel_names[] static linkage
  ui: Clean up a few things checkpatch.pl would flag later on
  ui: Move QMP commands from monitor to new ui/ui-qmp-cmds.c
  ui: Factor out qmp_add_client() parts and move to ui/ui-qmp-cmds.c
  ui: Move HMP commands from monitor to new ui/ui-hmp-cmds.c
  ui: Move more HMP commands from monitor to ui/
  ui: Improve "change vnc" error reporting
  ui: Factor out hmp_change_vnc(), and move to ui/ui-hmp-cmds.c
  ui: Reduce nesting in hmp_change_vnc() slightly
  ui: Split hmp_mouse_set() and move the HMP part to ui/
  ui: Don't check for mode change after mouse_set error
  ui: Simplify control flow in qemu_mouse_set()

 meson.build                   |   4 +-
 hw/display/qxl.h              |   2 -
 include/monitor/hmp.h         |   8 +
 include/monitor/qmp-helpers.h |  26 ++
 include/ui/console.h          |   2 +-
 include/ui/qemu-spice.h       |   8 +-
 include/ui/spice-display.h    |   2 -
 chardev/spice.c               |   2 -
 hw/display/qxl.c              |  26 +-
 monitor/hmp-cmds.c            | 368 +--------------------------
 monitor/misc.c                |  67 -----
 monitor/qmp-cmds.c            | 176 +++----------
 ui/input.c                    |  28 +--
 ui/spice-display.c            |  10 -
 ui/ui-hmp-cmds.c              | 461 ++++++++++++++++++++++++++++++++++
 ui/ui-qmp-cmds.c              | 177 +++++++++++++
 ui/vdagent.c                  |   4 -
 hw/display/trace-events       |   1 -
 ui/meson.build                |   2 +
 19 files changed, 725 insertions(+), 649 deletions(-)
 create mode 100644 include/monitor/qmp-helpers.h
 create mode 100644 ui/ui-hmp-cmds.c
 create mode 100644 ui/ui-qmp-cmds.c

-- 
2.38.1
Re: [PATCH v3 00/18] ui: Move and clean up monitor command code
Posted by Philippe Mathieu-Daudé 1 year, 4 months ago
On 20/12/22 10:06, Markus Armbruster wrote:
> This is mainly about splitting off monitor-related code.  There's also
> a minimum Spice version bump, and a few UI improvements to HMP
> commands sendkey, change vnc, and info spice.

Possibly related, use of InputEvent in replay:
https://lore.kernel.org/qemu-devel/20221219170806.60580-5-philmd@linaro.org/
Re: [PATCH v3 00/18] ui: Move and clean up monitor command code
Posted by Markus Armbruster 1 year, 4 months ago
Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> On 20/12/22 10:06, Markus Armbruster wrote:
>> This is mainly about splitting off monitor-related code.  There's also
>> a minimum Spice version bump, and a few UI improvements to HMP
>> commands sendkey, change vnc, and info spice.
>
> Possibly related, use of InputEvent in replay:
> https://lore.kernel.org/qemu-devel/20221219170806.60580-5-philmd@linaro.org/

Independent, as far as I can tell.  My series changes very little in
include/, see appended diff.


diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index 27f86399f7..8688769a27 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -73,6 +73,11 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict);
 void hmp_set_password(Monitor *mon, const QDict *qdict);
 void hmp_expire_password(Monitor *mon, const QDict *qdict);
 void hmp_change(Monitor *mon, const QDict *qdict);
+#ifdef CONFIG_VNC
+void hmp_change_vnc(Monitor *mon, const char *device, const char *target,
+                    const char *arg, const char *read_only, bool force,
+                    Error **errp);
+#endif
 void hmp_migrate(Monitor *mon, const QDict *qdict);
 void hmp_device_add(Monitor *mon, const QDict *qdict);
 void hmp_device_del(Monitor *mon, const QDict *qdict);
@@ -81,6 +86,9 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict);
 void hmp_netdev_del(Monitor *mon, const QDict *qdict);
 void hmp_getfd(Monitor *mon, const QDict *qdict);
 void hmp_closefd(Monitor *mon, const QDict *qdict);
+void hmp_mouse_move(Monitor *mon, const QDict *qdict);
+void hmp_mouse_button(Monitor *mon, const QDict *qdict);
+void hmp_mouse_set(Monitor *mon, const QDict *qdict);
 void hmp_sendkey(Monitor *mon, const QDict *qdict);
 void coroutine_fn hmp_screendump(Monitor *mon, const QDict *qdict);
 void hmp_chardev_add(Monitor *mon, const QDict *qdict);
diff --git a/include/monitor/qmp-helpers.h b/include/monitor/qmp-helpers.h
new file mode 100644
index 0000000000..4718c63c73
--- /dev/null
+++ b/include/monitor/qmp-helpers.h
@@ -0,0 +1,26 @@
+/*
+ * QMP command helpers
+ *
+ * Copyright (c) 2022 Red Hat Inc.
+ *
+ * Authors:
+ *  Markus Armbruster <armbru@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#ifndef MONITOR_QMP_HELPERS_H
+
+bool qmp_add_client_spice(int fd, bool has_skipauth, bool skipauth,
+                        bool has_tls, bool tls, Error **errp);
+#ifdef CONFIG_VNC
+bool qmp_add_client_vnc(int fd, bool has_skipauth, bool skipauth,
+                        bool has_tls, bool tls, Error **errp);
+#endif
+#ifdef CONFIG_DBUS_DISPLAY
+bool qmp_add_client_dbus_display(int fd, bool has_skipauth, bool skipauth,
+                        bool has_tls, bool tls, Error **errp);
+#endif
+
+#endif
diff --git a/include/ui/console.h b/include/ui/console.h
index e400ee9fa7..e7f375312c 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -65,7 +65,7 @@ void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry);
 
 void kbd_put_ledstate(int ledstate);
 
-void hmp_mouse_set(Monitor *mon, const QDict *qdict);
+void qemu_mouse_set(int index, Error **err);
 
 /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
    constants) */
diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h
index 21fe195e18..b7d493742c 100644
--- a/include/ui/qemu-spice.h
+++ b/include/ui/qemu-spice.h
@@ -34,13 +34,7 @@ int qemu_spice_add_display_interface(QXLInstance *qxlin, QemuConsole *con);
 int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
                             const char *subject);
 
-#if !defined(SPICE_SERVER_VERSION) || (SPICE_SERVER_VERSION < 0xc06)
-#define SPICE_NEEDS_SET_MM_TIME 1
-#else
-#define SPICE_NEEDS_SET_MM_TIME 0
-#endif
-
-#if defined(SPICE_SERVER_VERSION) && (SPICE_SERVER_VERSION >= 0x000f00)
+#if SPICE_SERVER_VERSION >= 0x000f00 /* release 0.15.0 */
 #define SPICE_HAS_ATTACHED_WORKER 1
 #else
 #define SPICE_HAS_ATTACHED_WORKER 0
diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h
index e271e011da..5aa13664d6 100644
--- a/include/ui/spice-display.h
+++ b/include/ui/spice-display.h
@@ -28,11 +28,9 @@
 #include "ui/console.h"
 
 #if defined(CONFIG_OPENGL) && defined(CONFIG_GBM)
-# if SPICE_SERVER_VERSION >= 0x000d01 /* release 0.13.1 */
 #  define HAVE_SPICE_GL 1
 #  include "ui/egl-helpers.h"
 #  include "ui/egl-context.h"
-# endif
 #endif
 
 #define NUM_MEMSLOTS 8