mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
UI-related fixes & shareable 2d memory with -display dbus
-----BEGIN PGP SIGNATURE----- iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmcNHtIcHG1hcmNhbmRy ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5SYTD/9fRNrgnZIvIbIGf0kv j3LguzwEsfn8eIUbJEIxtDnoS17zX1t981kP9J9ctUM6wnb0iQNYCXeTrF8Xrq0z psiPhHGwPyWMdn9SWRfj597ShPn75z340Qve5GUm7clGu2KILh7TqqACH8LzaX+5 6jqoZc3kqD+PYZHnYAi6v1YFfLIYfj0n6EaO/J4RRRZSrknpgct7jpmqL4wVzTIo KYlG5afdUUfhmSIv5ZDpuuEJppdG74K2H+hJKDPIOOQ8/i/IU2EQPJ00ppiOPbET nA0+piLGtHQwU24u5kDdbDlGL/y1KBKvGclOtzLQxWNStch5A6hqllNsuIg+0dJW MRO2WZ8C7P7LD1eGmtYVZF/NzjnlTW/hbM5i0poPqhfcwbVmlIXjDs8GUfMGfINr 1MVFGNjxfgadYZ1f6Q/JU/KWPJMR4Ik3C/SmGrRBlfra5YIts0ItDeGgfQIW9JGb 1CpOng6/3SvW01B6psrPL+wP+6PsK333KPIA77KafOEMyOyEyuSOUrTShXbyXBHc r/nLbWw2lZs4U0kgGRQ21+R3huTyw8LnikYpCnGwTWGCpb9NDFYg7z3CRrZW0hWx DIWfN7M6YymeYygPUV9Wjo6i4yq4QqWPp7/QXtkSdX3v44/D7NWytKGST+Hwjkpa h6U2vrsLdep2m47bnX/dEEP61g== =xdt/ -----END PGP SIGNATURE----- Merge tag 'ui-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging UI-related fixes & shareable 2d memory with -display dbus # -----BEGIN PGP SIGNATURE----- # # iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmcNHtIcHG1hcmNhbmRy # ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5SYTD/9fRNrgnZIvIbIGf0kv # j3LguzwEsfn8eIUbJEIxtDnoS17zX1t981kP9J9ctUM6wnb0iQNYCXeTrF8Xrq0z # psiPhHGwPyWMdn9SWRfj597ShPn75z340Qve5GUm7clGu2KILh7TqqACH8LzaX+5 # 6jqoZc3kqD+PYZHnYAi6v1YFfLIYfj0n6EaO/J4RRRZSrknpgct7jpmqL4wVzTIo # KYlG5afdUUfhmSIv5ZDpuuEJppdG74K2H+hJKDPIOOQ8/i/IU2EQPJ00ppiOPbET # nA0+piLGtHQwU24u5kDdbDlGL/y1KBKvGclOtzLQxWNStch5A6hqllNsuIg+0dJW # MRO2WZ8C7P7LD1eGmtYVZF/NzjnlTW/hbM5i0poPqhfcwbVmlIXjDs8GUfMGfINr # 1MVFGNjxfgadYZ1f6Q/JU/KWPJMR4Ik3C/SmGrRBlfra5YIts0ItDeGgfQIW9JGb # 1CpOng6/3SvW01B6psrPL+wP+6PsK333KPIA77KafOEMyOyEyuSOUrTShXbyXBHc # r/nLbWw2lZs4U0kgGRQ21+R3huTyw8LnikYpCnGwTWGCpb9NDFYg7z3CRrZW0hWx # DIWfN7M6YymeYygPUV9Wjo6i4yq4QqWPp7/QXtkSdX3v44/D7NWytKGST+Hwjkpa # h6U2vrsLdep2m47bnX/dEEP61g== # =xdt/ # -----END PGP SIGNATURE----- # gpg: Signature made Mon 14 Oct 2024 14:38:26 BST # gpg: using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5 # gpg: issuer "marcandre.lureau@redhat.com" # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full] # gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full] # Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5 * tag 'ui-pull-request' of https://gitlab.com/marcandre.lureau/qemu: audio/pw: Report more accurate error when connecting to PipeWire fails tests: add basic -display dbus Map.Unix test ui: refactor using a common qemu_pixman_shareable virtio-gpu: allocate shareable 2d resources on !win32 ui/dbus: implement Unix.Map ui/dbus: add Listener.Unix.Map interface XML ui/dbus: make Listener.Win32.Map win32-specific meson: find_program('gdbus-codegen') directly ui/surface: allocate shared memory on !win32 ui/dbus: add trace for can_share_map ui/dbus: do not limit to one listener per connection / bus name ui/pixman: generalize shared_image_destroy util/memfd: report potential errors on free ui/dbus: discard pending CursorDefine on new one ui/dbus: discard display messages on disable ui/dbus: fix filtering all update messages ui/win32: fix potential use-after-free with dbus shared memory ui/dbus: fix leak on message filtering hw/audio/hda: fix memory leak on audio setup hw/audio/hda: free timer on exit Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
35152940b7
15 changed files with 446 additions and 174 deletions
|
@ -2,9 +2,14 @@
|
|||
#include "qemu/sockets.h"
|
||||
#include "qemu/dbus.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "glib.h"
|
||||
#include "glibconfig.h"
|
||||
#include <gio/gio.h>
|
||||
#include <gio/gunixfdlist.h>
|
||||
#include "libqtest.h"
|
||||
#ifndef WIN32
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#include "ui/dbus-display1.h"
|
||||
|
||||
static GDBusConnection*
|
||||
|
@ -82,6 +87,7 @@ typedef struct TestDBusConsoleRegister {
|
|||
GThread *thread;
|
||||
GDBusConnection *listener_conn;
|
||||
GDBusObjectManagerServer *server;
|
||||
bool with_map;
|
||||
} TestDBusConsoleRegister;
|
||||
|
||||
static gboolean listener_handle_scanout(
|
||||
|
@ -94,13 +100,49 @@ static gboolean listener_handle_scanout(
|
|||
GVariant *arg_data,
|
||||
TestDBusConsoleRegister *test)
|
||||
{
|
||||
g_main_loop_quit(test->loop);
|
||||
if (!test->with_map) {
|
||||
g_main_loop_quit(test->loop);
|
||||
}
|
||||
|
||||
return DBUS_METHOD_INVOCATION_HANDLED;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
static gboolean listener_handle_scanout_map(
|
||||
QemuDBusDisplay1ListenerUnixMap *object,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GUnixFDList *fd_list,
|
||||
GVariant *arg_handle,
|
||||
guint arg_offset,
|
||||
guint arg_width,
|
||||
guint arg_height,
|
||||
guint arg_stride,
|
||||
guint arg_pixman_format,
|
||||
TestDBusConsoleRegister *test)
|
||||
{
|
||||
int fd = -1;
|
||||
gint32 handle = g_variant_get_handle(arg_handle);
|
||||
g_autoptr(GError) error = NULL;
|
||||
void *addr = NULL;
|
||||
size_t len = arg_height * arg_stride;
|
||||
|
||||
g_assert_cmpuint(g_unix_fd_list_get_length(fd_list), ==, 1);
|
||||
fd = g_unix_fd_list_get(fd_list, handle, &error);
|
||||
g_assert_no_error(error);
|
||||
|
||||
addr = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, arg_offset);
|
||||
g_assert_no_errno(addr == MAP_FAILED ? -1 : 0);
|
||||
g_assert_no_errno(munmap(addr, len));
|
||||
|
||||
g_main_loop_quit(test->loop);
|
||||
|
||||
close(fd);
|
||||
return DBUS_METHOD_INVOCATION_HANDLED;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
test_dbus_console_setup_listener(TestDBusConsoleRegister *test)
|
||||
test_dbus_console_setup_listener(TestDBusConsoleRegister *test, bool with_map)
|
||||
{
|
||||
g_autoptr(GDBusObjectSkeleton) listener = NULL;
|
||||
g_autoptr(QemuDBusDisplay1ListenerSkeleton) iface = NULL;
|
||||
|
@ -114,6 +156,25 @@ test_dbus_console_setup_listener(TestDBusConsoleRegister *test)
|
|||
NULL);
|
||||
g_dbus_object_skeleton_add_interface(listener,
|
||||
G_DBUS_INTERFACE_SKELETON(iface));
|
||||
if (with_map) {
|
||||
#ifdef WIN32
|
||||
g_test_skip("map test lacking on win32");
|
||||
return;
|
||||
#else
|
||||
g_autoptr(QemuDBusDisplay1ListenerUnixMapSkeleton) iface_map =
|
||||
QEMU_DBUS_DISPLAY1_LISTENER_UNIX_MAP_SKELETON(
|
||||
qemu_dbus_display1_listener_unix_map_skeleton_new());
|
||||
|
||||
g_object_connect(iface_map,
|
||||
"signal::handle-scanout-map", listener_handle_scanout_map, test,
|
||||
NULL);
|
||||
g_dbus_object_skeleton_add_interface(listener,
|
||||
G_DBUS_INTERFACE_SKELETON(iface_map));
|
||||
g_object_set(iface, "interfaces",
|
||||
(const gchar *[]) { "org.qemu.Display1.Listener.Unix.Map", NULL },
|
||||
NULL);
|
||||
#endif
|
||||
}
|
||||
g_dbus_object_manager_server_export(test->server, listener);
|
||||
g_dbus_object_manager_server_set_connection(test->server,
|
||||
test->listener_conn);
|
||||
|
@ -145,7 +206,7 @@ test_dbus_console_registered(GObject *source_object,
|
|||
g_assert_no_error(err);
|
||||
|
||||
test->listener_conn = g_thread_join(test->thread);
|
||||
test_dbus_console_setup_listener(test);
|
||||
test_dbus_console_setup_listener(test, test->with_map);
|
||||
}
|
||||
|
||||
static gpointer
|
||||
|
@ -155,7 +216,7 @@ test_dbus_p2p_server_setup_thread(gpointer data)
|
|||
}
|
||||
|
||||
static void
|
||||
test_dbus_display_console(void)
|
||||
test_dbus_display_console(const void* data)
|
||||
{
|
||||
g_autoptr(GError) err = NULL;
|
||||
g_autoptr(GDBusConnection) conn = NULL;
|
||||
|
@ -163,7 +224,7 @@ test_dbus_display_console(void)
|
|||
g_autoptr(GMainLoop) loop = NULL;
|
||||
QTestState *qts = NULL;
|
||||
int pair[2];
|
||||
TestDBusConsoleRegister test = { 0, };
|
||||
TestDBusConsoleRegister test = { 0, .with_map = GPOINTER_TO_INT(data) };
|
||||
#ifdef WIN32
|
||||
WSAPROTOCOL_INFOW info;
|
||||
g_autoptr(GVariant) listener = NULL;
|
||||
|
@ -299,7 +360,8 @@ main(int argc, char **argv)
|
|||
g_test_init(&argc, &argv, NULL);
|
||||
|
||||
qtest_add_func("/dbus-display/vm", test_dbus_display_vm);
|
||||
qtest_add_func("/dbus-display/console", test_dbus_display_console);
|
||||
qtest_add_data_func("/dbus-display/console", GINT_TO_POINTER(false), test_dbus_display_console);
|
||||
qtest_add_data_func("/dbus-display/console/map", GINT_TO_POINTER(true), test_dbus_display_console);
|
||||
qtest_add_func("/dbus-display/keyboard", test_dbus_display_keyboard);
|
||||
|
||||
return g_test_run();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue