From: Laszlo Ersek <lersek@redhat.com>
To: lersek@redhat.com, qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [PATCH 3/4] ui/console: eliminate QOM properties from qemu_console_is_multihead()
Date: Wed, 13 Sep 2023 16:49:58 +0200 [thread overview]
Message-ID: <20230913144959.41891-4-lersek@redhat.com> (raw)
In-Reply-To: <20230913144959.41891-1-lersek@redhat.com>
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>
---
ui/console.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index 2ee65207b430..6424820c8521 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -2365,25 +2365,25 @@ bool qemu_console_is_gl_blocked(QemuConsole *con)
return con->gl_block;
}
-static bool qemu_console_is_multihead(DeviceState *dev)
+static bool qemu_graphic_console_is_multihead(QemuGraphicConsole *c)
{
QemuConsole *con;
- Object *obj;
uint32_t f = 0xffffffff;
uint32_t h;
QTAILQ_FOREACH(con, &consoles, next) {
+ QemuGraphicConsole *candidate;
+
if (!QEMU_IS_GRAPHIC_CONSOLE(con)) {
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;
}
- h = object_property_get_uint(OBJECT(con),
- "head", &error_abort);
+ h = candidate->head;
if (f == 0xffffffff) {
f = h;
} else if (h != f) {
@@ -2402,7 +2402,7 @@ char *qemu_console_get_label(QemuConsole *con)
bool multihead;
dev = DEVICE(c->device);
- multihead = qemu_console_is_multihead(dev);
+ multihead = qemu_graphic_console_is_multihead(c);
if (multihead) {
return g_strdup_printf("%s.%d", dev->id ?
dev->id :
next prev parent reply other threads:[~2023-09-13 14:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-13 14:49 [PATCH 0/4] ui/console: multihead: fix crash, simplify logic Laszlo Ersek
2023-09-13 14:49 ` [PATCH 1/4] ui/console: make qemu_console_is_multihead() static Laszlo Ersek
2023-09-13 15:12 ` Philippe Mathieu-Daudé
2023-09-13 14:49 ` [PATCH 2/4] ui/console: only walk QemuGraphicConsoles in qemu_console_is_multihead() Laszlo Ersek
2023-09-13 14:49 ` Laszlo Ersek [this message]
2023-09-13 14:49 ` [PATCH 4/4] ui/console: sanitize search in qemu_graphic_console_is_multihead() Laszlo Ersek
2023-09-15 11:50 ` [PATCH 0/4] ui/console: multihead: fix crash, simplify logic Marc-André Lureau
2023-09-25 15:36 ` Laszlo Ersek
2023-09-26 8:00 ` Marc-André Lureau
2023-09-29 7:57 ` Mark Cave-Ayland
2023-09-30 21:28 ` Laszlo Ersek
2023-10-01 6:15 ` Mark Cave-Ayland
2023-10-01 9:31 ` Laszlo Ersek
2023-10-01 9:50 ` Michael Tokarev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230913144959.41891-4-lersek@redhat.com \
--to=lersek@redhat.com \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).