1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
|
/*
* QEMU DBus display console
*
* Copyright (c) 2021 Marc-André Lureau <marcandre.lureau@redhat.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "sysemu/sysemu.h"
#include "dbus.h"
#ifdef G_OS_UNIX
#include <gio/gunixfdlist.h>
#endif
#ifdef CONFIG_OPENGL
#include "ui/shader.h"
#include "ui/egl-helpers.h"
#include "ui/egl-context.h"
#endif
#include "trace.h"
static void dbus_gfx_switch(DisplayChangeListener *dcl,
struct DisplaySurface *new_surface);
struct _DBusDisplayListener {
GObject parent;
char *bus_name;
DBusDisplayConsole *console;
GDBusConnection *conn;
QemuDBusDisplay1Listener *proxy;
DisplayChangeListener dcl;
DisplaySurface *ds;
int gl_updates;
bool ds_mapped;
bool can_share_map;
#ifdef WIN32
QemuDBusDisplay1ListenerWin32Map *map_proxy;
HANDLE peer_process;
#ifdef CONFIG_OPENGL
egl_fb fb;
#endif
#endif
};
G_DEFINE_TYPE(DBusDisplayListener, dbus_display_listener, G_TYPE_OBJECT)
static void dbus_gfx_update(DisplayChangeListener *dcl,
int x, int y, int w, int h);
#ifdef CONFIG_OPENGL
static void dbus_scanout_disable(DisplayChangeListener *dcl)
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
ddl->ds = NULL;
qemu_dbus_display1_listener_call_disable(
ddl->proxy, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
}
#ifdef CONFIG_GBM
static void dbus_update_gl_cb(GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
g_autoptr(GError) err = NULL;
DBusDisplayListener *ddl = user_data;
if (!qemu_dbus_display1_listener_call_update_dmabuf_finish(ddl->proxy,
res, &err)) {
error_report("Failed to call update: %s", err->message);
}
graphic_hw_gl_block(ddl->dcl.con, false);
g_object_unref(ddl);
}
#endif
static void dbus_call_update_gl(DisplayChangeListener *dcl,
int x, int y, int w, int h)
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
glFlush();
#ifdef CONFIG_GBM
graphic_hw_gl_block(ddl->dcl.con, true);
qemu_dbus_display1_listener_call_update_dmabuf(ddl->proxy,
x, y, w, h,
G_DBUS_CALL_FLAGS_NONE,
DBUS_DEFAULT_TIMEOUT, NULL,
dbus_update_gl_cb,
g_object_ref(ddl));
#endif
#ifdef WIN32
egl_fb_read_rect(ddl->ds, &ddl->fb, x, y, w, h);
dbus_gfx_update(dcl, x, y, w, h);
#endif
}
#ifdef CONFIG_GBM
static void dbus_scanout_dmabuf(DisplayChangeListener *dcl,
QemuDmaBuf *dmabuf)
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
g_autoptr(GError) err = NULL;
g_autoptr(GUnixFDList) fd_list = NULL;
fd_list = g_unix_fd_list_new();
if (g_unix_fd_list_append(fd_list, dmabuf->fd, &err) != 0) {
error_report("Failed to setup dmabuf fdlist: %s", err->message);
return;
}
/* FIXME: add missing x/y/w/h support */
qemu_dbus_display1_listener_call_scanout_dmabuf(
ddl->proxy,
g_variant_new_handle(0),
dmabuf->width,
dmabuf->height,
dmabuf->stride,
dmabuf->fourcc,
dmabuf->modifier,
dmabuf->y0_top,
G_DBUS_CALL_FLAGS_NONE,
-1,
fd_list,
NULL, NULL, NULL);
}
#endif /* GBM */
#endif /* OPENGL */
#ifdef WIN32
static bool dbus_scanout_map(DBusDisplayListener *ddl)
{
g_autoptr(GError) err = NULL;
BOOL success;
HANDLE target_handle;
if (ddl->ds_mapped) {
return true;
}
if (!ddl->can_share_map || !ddl->ds->handle) {
return false;
}
success = DuplicateHandle(
GetCurrentProcess(),
ddl->ds->handle,
ddl->peer_process,
&target_handle,
FILE_MAP_READ | SECTION_QUERY,
FALSE, 0);
if (!success) {
g_autofree char *msg = g_win32_error_message(GetLastError());
g_debug("Failed to DuplicateHandle: %s", msg);
ddl->can_share_map = false;
return false;
}
if (!qemu_dbus_display1_listener_win32_map_call_scanout_map_sync(
ddl->map_proxy,
GPOINTER_TO_UINT(target_handle),
ddl->ds->handle_offset,
surface_width(ddl->ds),
surface_height(ddl->ds),
surface_stride(ddl->ds),
surface_format(ddl->ds),
G_DBUS_CALL_FLAGS_NONE,
DBUS_DEFAULT_TIMEOUT,
NULL,
&err)) {
g_debug("Failed to call ScanoutMap: %s", err->message);
ddl->can_share_map = false;
return false;
}
ddl->ds_mapped = true;
return true;
}
#endif
#ifdef CONFIG_OPENGL
static void dbus_scanout_texture(DisplayChangeListener *dcl,
uint32_t tex_id,
bool backing_y_0_top,
uint32_t backing_width,
uint32_t backing_height,
uint32_t x, uint32_t y,
uint32_t w, uint32_t h)
{
#ifdef CONFIG_GBM
QemuDmaBuf dmabuf = {
.width = backing_width,
.height = backing_height,
.y0_top = backing_y_0_top,
.x = x,
.y = y,
.scanout_width = w,
.scanout_height = h,
};
assert(tex_id);
dmabuf.fd = egl_get_fd_for_texture(
tex_id, (EGLint *)&dmabuf.stride,
(EGLint *)&dmabuf.fourcc,
&dmabuf.modifier);
if (dmabuf.fd < 0) {
error_report("%s: failed to get fd for texture", __func__);
return;
}
dbus_scanout_dmabuf(dcl, &dmabuf);
close(dmabuf.fd);
#endif
#ifdef WIN32
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
/* there must be a matching gfx_switch before */
assert(surface_width(ddl->ds) == w);
assert(surface_height(ddl->ds) == h);
egl_fb_setup_for_tex(&ddl->fb, backing_width, backing_height, tex_id, false);
#endif
}
#ifdef CONFIG_GBM
static void dbus_cursor_dmabuf(DisplayChangeListener *dcl,
QemuDmaBuf *dmabuf, bool have_hot,
uint32_t hot_x, uint32_t hot_y)
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
DisplaySurface *ds;
GVariant *v_data = NULL;
egl_fb cursor_fb = EGL_FB_INIT;
if (!dmabuf) {
qemu_dbus_display1_listener_call_mouse_set(
ddl->proxy, 0, 0, false,
G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
return;
}
egl_dmabuf_import_texture(dmabuf);
if (!dmabuf->texture) {
return;
}
egl_fb_setup_for_tex(&cursor_fb, dmabuf->width, dmabuf->height,
dmabuf->texture, false);
ds = qemu_create_displaysurface(dmabuf->width, dmabuf->height);
egl_fb_read(ds, &cursor_fb);
v_data = g_variant_new_from_data(
G_VARIANT_TYPE("ay"),
surface_data(ds),
surface_width(ds) * surface_height(ds) * 4,
TRUE,
(GDestroyNotify)qemu_free_displaysurface,
ds);
qemu_dbus_display1_listener_call_cursor_define(
ddl->proxy,
surface_width(ds),
surface_height(ds),
hot_x,
hot_y,
v_data,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
NULL,
NULL);
}
static void dbus_release_dmabuf(DisplayChangeListener *dcl,
QemuDmaBuf *dmabuf)
{
dbus_scanout_disable(dcl);
}
#endif /* GBM */
static void dbus_gl_cursor_position(DisplayChangeListener *dcl,
uint32_t pos_x, uint32_t pos_y)
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
qemu_dbus_display1_listener_call_mouse_set(
ddl->proxy, pos_x, pos_y, true,
G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
}
static void dbus_scanout_update(DisplayChangeListener *dcl,
uint32_t x, uint32_t y,
uint32_t w, uint32_t h)
{
dbus_call_update_gl(dcl, x, y, w, h);
}
static void dbus_gl_refresh(DisplayChangeListener *dcl)
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
graphic_hw_update(dcl->con);
if (!ddl->ds || qemu_console_is_gl_blocked(ddl->dcl.con)) {
return;
}
if (ddl->gl_updates) {
dbus_call_update_gl(dcl, 0, 0,
surface_width(ddl->ds), surface_height(ddl->ds));
ddl->gl_updates = 0;
}
}
#endif /* OPENGL */
static void dbus_refresh(DisplayChangeListener *dcl)
{
graphic_hw_update(dcl->con);
}
#ifdef CONFIG_OPENGL
static void dbus_gl_gfx_update(DisplayChangeListener *dcl,
int x, int y, int w, int h)
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
ddl->gl_updates++;
}
#endif
static void dbus_gfx_update(DisplayChangeListener *dcl,
int x, int y, int w, int h)
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
pixman_image_t *img;
GVariant *v_data;
size_t stride;
assert(ddl->ds);
trace_dbus_update(x, y, w, h);
#ifdef WIN32
if (dbus_scanout_map(ddl)) {
qemu_dbus_display1_listener_win32_map_call_update_map(
ddl->map_proxy,
x, y, w, h,
G_DBUS_CALL_FLAGS_NONE,
DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL);
return;
}
#endif
if (x == 0 && y == 0 && w == surface_width(ddl->ds) && h == surface_height(ddl->ds)) {
v_data = g_variant_new_from_data(
G_VARIANT_TYPE("ay"),
surface_data(ddl->ds),
surface_stride(ddl->ds) * surface_height(ddl->ds),
TRUE,
(GDestroyNotify)pixman_image_unref,
pixman_image_ref(ddl->ds->image));
qemu_dbus_display1_listener_call_scanout(
ddl->proxy,
surface_width(ddl->ds),
surface_height(ddl->ds),
surface_stride(ddl->ds),
surface_format(ddl->ds),
v_data,
G_DBUS_CALL_FLAGS_NONE,
DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL);
return;
}
/* make a copy, since gvariant only handles linear data */
stride = w * DIV_ROUND_UP(PIXMAN_FORMAT_BPP(surface_format(ddl->ds)), 8);
img = pixman_image_create_bits(surface_format(ddl->ds),
w, h, NULL, stride);
pixman_image_composite(PIXMAN_OP_SRC, ddl->ds->image, NULL, img,
x, y, 0, 0, 0, 0, w, h);
v_data = g_variant_new_from_data(
G_VARIANT_TYPE("ay"),
pixman_image_get_data(img),
pixman_image_get_stride(img) * h,
TRUE,
(GDestroyNotify)pixman_image_unref,
img);
qemu_dbus_display1_listener_call_update(ddl->proxy,
x, y, w, h, pixman_image_get_stride(img), pixman_image_get_format(img),
v_data,
G_DBUS_CALL_FLAGS_NONE,
DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL);
}
#ifdef CONFIG_OPENGL
static void dbus_gl_gfx_switch(DisplayChangeListener *dcl,
struct DisplaySurface *new_surface)
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
ddl->ds = new_surface;
if (ddl->ds) {
int width = surface_width(ddl->ds);
int height = surface_height(ddl->ds);
/* TODO: lazy send dmabuf (there are unnecessary sent otherwise) */
dbus_scanout_texture(&ddl->dcl, ddl->ds->texture, false,
width, height, 0, 0, width, height);
}
}
#endif
static void dbus_gfx_switch(DisplayChangeListener *dcl,
struct DisplaySurface *new_surface)
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
ddl->ds = new_surface;
#ifdef WIN32
ddl->ds_mapped = false;
#endif
if (!ddl->ds) {
/* why not call disable instead? */
return;
}
}
static void dbus_mouse_set(DisplayChangeListener *dcl,
int x, int y, int on)
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
qemu_dbus_display1_listener_call_mouse_set(
ddl->proxy, x, y, on, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
}
static void dbus_cursor_define(DisplayChangeListener *dcl,
QEMUCursor *c)
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
GVariant *v_data = NULL;
v_data = g_variant_new_from_data(
G_VARIANT_TYPE("ay"),
c->data,
c->width * c->height * 4,
TRUE,
(GDestroyNotify)cursor_unref,
cursor_ref(c));
qemu_dbus_display1_listener_call_cursor_define(
ddl->proxy,
c->width,
c->height,
c->hot_x,
c->hot_y,
v_data,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
NULL,
NULL);
}
#ifdef CONFIG_OPENGL
const DisplayChangeListenerOps dbus_gl_dcl_ops = {
.dpy_name = "dbus-gl",
.dpy_gfx_update = dbus_gl_gfx_update,
.dpy_gfx_switch = dbus_gl_gfx_switch,
.dpy_gfx_check_format = console_gl_check_format,
.dpy_refresh = dbus_gl_refresh,
.dpy_mouse_set = dbus_mouse_set,
.dpy_cursor_define = dbus_cursor_define,
.dpy_gl_scanout_disable = dbus_scanout_disable,
.dpy_gl_scanout_texture = dbus_scanout_texture,
#ifdef CONFIG_GBM
.dpy_gl_scanout_dmabuf = dbus_scanout_dmabuf,
.dpy_gl_cursor_dmabuf = dbus_cursor_dmabuf,
.dpy_gl_release_dmabuf = dbus_release_dmabuf,
#endif
.dpy_gl_cursor_position = dbus_gl_cursor_position,
.dpy_gl_update = dbus_scanout_update,
};
#endif
const DisplayChangeListenerOps dbus_dcl_ops = {
.dpy_name = "dbus",
.dpy_gfx_update = dbus_gfx_update,
.dpy_gfx_switch = dbus_gfx_switch,
.dpy_refresh = dbus_refresh,
.dpy_mouse_set = dbus_mouse_set,
.dpy_cursor_define = dbus_cursor_define,
};
static void
dbus_display_listener_dispose(GObject *object)
{
DBusDisplayListener *ddl = DBUS_DISPLAY_LISTENER(object);
unregister_displaychangelistener(&ddl->dcl);
g_clear_object(&ddl->conn);
g_clear_pointer(&ddl->bus_name, g_free);
g_clear_object(&ddl->proxy);
#ifdef WIN32
g_clear_object(&ddl->map_proxy);
g_clear_pointer(&ddl->peer_process, CloseHandle);
#ifdef CONFIG_OPENGL
egl_fb_destroy(&ddl->fb);
#endif
#endif
G_OBJECT_CLASS(dbus_display_listener_parent_class)->dispose(object);
}
static void
dbus_display_listener_constructed(GObject *object)
{
DBusDisplayListener *ddl = DBUS_DISPLAY_LISTENER(object);
ddl->dcl.ops = &dbus_dcl_ops;
#ifdef CONFIG_OPENGL
if (display_opengl) {
ddl->dcl.ops = &dbus_gl_dcl_ops;
}
#endif
G_OBJECT_CLASS(dbus_display_listener_parent_class)->constructed(object);
}
static void
dbus_display_listener_class_init(DBusDisplayListenerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
object_class->dispose = dbus_display_listener_dispose;
object_class->constructed = dbus_display_listener_constructed;
}
static void
dbus_display_listener_init(DBusDisplayListener *ddl)
{
}
const char *
dbus_display_listener_get_bus_name(DBusDisplayListener *ddl)
{
return ddl->bus_name ?: "p2p";
}
DBusDisplayConsole *
dbus_display_listener_get_console(DBusDisplayListener *ddl)
{
return ddl->console;
}
#ifdef WIN32
static bool
dbus_display_listener_implements(DBusDisplayListener *ddl, const char *iface)
{
QemuDBusDisplay1Listener *l = QEMU_DBUS_DISPLAY1_LISTENER(ddl->proxy);
bool implements;
implements = g_strv_contains(qemu_dbus_display1_listener_get_interfaces(l), iface);
if (!implements) {
g_debug("Display listener does not implement: `%s`", iface);
}
return implements;
}
#endif
static void
dbus_display_listener_setup_shared_map(DBusDisplayListener *ddl)
{
#ifdef WIN32
g_autoptr(GError) err = NULL;
GDBusConnection *conn;
GIOStream *stream;
GSocket *sock;
g_autoptr(GCredentials) creds = NULL;
DWORD *pid;
if (!dbus_display_listener_implements(ddl, "org.qemu.Display1.Listener.Win32.Map")) {
return;
}
conn = g_dbus_proxy_get_connection(G_DBUS_PROXY(ddl->proxy));
stream = g_dbus_connection_get_stream(conn);
if (!G_IS_UNIX_CONNECTION(stream)) {
return;
}
sock = g_socket_connection_get_socket(G_SOCKET_CONNECTION(stream));
creds = g_socket_get_credentials(sock, &err);
if (!creds) {
g_debug("Failed to get peer credentials: %s", err->message);
return;
}
pid = g_credentials_get_native(creds, G_CREDENTIALS_TYPE_WIN32_PID);
if (pid == NULL) {
g_debug("Failed to get peer PID");
return;
}
ddl->peer_process = OpenProcess(
PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION,
false, *pid);
if (!ddl->peer_process) {
g_autofree char *msg = g_win32_error_message(GetLastError());
g_debug("Failed to OpenProcess: %s", msg);
return;
}
ddl->map_proxy =
qemu_dbus_display1_listener_win32_map_proxy_new_sync(conn,
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
NULL,
"/org/qemu/Display1/Listener",
NULL,
&err);
if (!ddl->map_proxy) {
g_debug("Failed to setup win32 map proxy: %s", err->message);
return;
}
ddl->can_share_map = true;
#endif
}
DBusDisplayListener *
dbus_display_listener_new(const char *bus_name,
GDBusConnection *conn,
DBusDisplayConsole *console)
{
DBusDisplayListener *ddl;
QemuConsole *con;
g_autoptr(GError) err = NULL;
ddl = g_object_new(DBUS_DISPLAY_TYPE_LISTENER, NULL);
ddl->proxy =
qemu_dbus_display1_listener_proxy_new_sync(conn,
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
NULL,
"/org/qemu/Display1/Listener",
NULL,
&err);
if (!ddl->proxy) {
error_report("Failed to setup proxy: %s", err->message);
g_object_unref(conn);
g_object_unref(ddl);
return NULL;
}
ddl->bus_name = g_strdup(bus_name);
ddl->conn = conn;
ddl->console = console;
dbus_display_listener_setup_shared_map(ddl);
con = qemu_console_lookup_by_index(dbus_display_console_get_index(console));
assert(con);
ddl->dcl.con = con;
register_displaychangelistener(&ddl->dcl);
return ddl;
}
|