2
0
Эх сурвалжийг харах

ui/console: eliminate QOM properties from qemu_console_is_multihead()

According to Marc-André's and Gerd's descriptions, the "device" and
"head" members of QemuGraphicConsole are exposed as QOM properties for two
purposes:

(1) Introspection (e.g., "qom-get" monitor command).

(2) A VNC server can display a specific device + head. This lets us run a
    multihead configuration by using multiple VNC servers (one for each
    head).

    Further, we can link input devices to device + head, so input events
    are routed to different devices dependent on where they are coming
    from. Which is most useful for tablet devices in a VNC multihead
    setup, each head has its own tablet device then. This does requires
    manual guest-side configuration, for establishing the same tablet <->
    head relationship.

However, neither goal seems to justify the complicated QOM property lookup
that's internal to qemu_console_is_multihead().

Rework qemu_console_is_multihead() with plain old C language field
accesses.

Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> (odd fixer:Graphics)
Cc: Gerd Hoffmann <kraxel@redhat.com> (odd fixer:Graphics)
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20230913144959.41891-4-lersek@redhat.com>
Laszlo Ersek 1 жил өмнө
parent
commit
2c0c4c1f65
1 өөрчлөгдсөн 8 нэмэгдсэн , 8 устгасан
  1. 8 8
      ui/console.c

+ 8 - 8
ui/console.c

@@ -1434,25 +1434,25 @@ bool qemu_console_is_gl_blocked(QemuConsole *con)
     return con->gl_block;
     return con->gl_block;
 }
 }
 
 
-static bool qemu_console_is_multihead(DeviceState *dev)
+static bool qemu_graphic_console_is_multihead(QemuGraphicConsole *c)
 {
 {
     QemuConsole *con;
     QemuConsole *con;
-    Object *obj;
     uint32_t f = 0xffffffff;
     uint32_t f = 0xffffffff;
     uint32_t h;
     uint32_t h;
 
 
     QTAILQ_FOREACH(con, &consoles, next) {
     QTAILQ_FOREACH(con, &consoles, next) {
+        QemuGraphicConsole *candidate;
+
         if (!QEMU_IS_GRAPHIC_CONSOLE(con)) {
         if (!QEMU_IS_GRAPHIC_CONSOLE(con)) {
             continue;
             continue;
         }
         }
-        obj = object_property_get_link(OBJECT(con),
-                                       "device", &error_abort);
-        if (DEVICE(obj) != dev) {
+
+        candidate = QEMU_GRAPHIC_CONSOLE(con);
+        if (candidate->device != c->device) {
             continue;
             continue;
         }
         }
 
 
-        h = object_property_get_uint(OBJECT(con),
-                                     "head", &error_abort);
+        h = candidate->head;
         if (f == 0xffffffff) {
         if (f == 0xffffffff) {
             f = h;
             f = h;
         } else if (h != f) {
         } else if (h != f) {
@@ -1471,7 +1471,7 @@ char *qemu_console_get_label(QemuConsole *con)
             bool multihead;
             bool multihead;
 
 
             dev = DEVICE(c->device);
             dev = DEVICE(c->device);
-            multihead = qemu_console_is_multihead(dev);
+            multihead = qemu_graphic_console_is_multihead(c);
             if (multihead) {
             if (multihead) {
                 return g_strdup_printf("%s.%d", dev->id ?
                 return g_strdup_printf("%s.%d", dev->id ?
                                        dev->id :
                                        dev->id :