2 * Copyright (C) 2010 Red Hat, Inc.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 or
7 * (at your option) version 3 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 #include "qemu-common.h"
19 #include "ui/qemu-spice.h"
20 #include "qemu/timer.h"
21 #include "qemu/queue.h"
22 #include "monitor/monitor.h"
23 #include "ui/console.h"
24 #include "sysemu/sysemu.h"
27 #include "ui/spice-display.h"
35 static void GCC_FMT_ATTR(2, 3) dprint(int level, const char *fmt, ...)
41 vfprintf(stderr, fmt, args);
46 int qemu_spice_rect_is_empty(const QXLRect* r)
48 return r->top == r->bottom || r->left == r->right;
51 void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r)
53 if (qemu_spice_rect_is_empty(r)) {
57 if (qemu_spice_rect_is_empty(dest)) {
62 dest->top = MIN(dest->top, r->top);
63 dest->left = MIN(dest->left, r->left);
64 dest->bottom = MAX(dest->bottom, r->bottom);
65 dest->right = MAX(dest->right, r->right);
68 QXLCookie *qxl_cookie_new(int type, uint64_t io)
72 cookie = g_malloc0(sizeof(*cookie));
78 void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot,
81 trace_qemu_spice_add_memslot(ssd->qxl.id, memslot->slot_id,
82 memslot->virt_start, memslot->virt_end,
85 if (async != QXL_SYNC) {
86 spice_qxl_add_memslot_async(&ssd->qxl, memslot,
87 (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO,
88 QXL_IO_MEMSLOT_ADD_ASYNC));
90 spice_qxl_add_memslot(&ssd->qxl, memslot);
94 void qemu_spice_del_memslot(SimpleSpiceDisplay *ssd, uint32_t gid, uint32_t sid)
96 trace_qemu_spice_del_memslot(ssd->qxl.id, gid, sid);
97 spice_qxl_del_memslot(&ssd->qxl, gid, sid);
100 void qemu_spice_create_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id,
101 QXLDevSurfaceCreate *surface,
104 trace_qemu_spice_create_primary_surface(ssd->qxl.id, id, surface, async);
105 if (async != QXL_SYNC) {
106 spice_qxl_create_primary_surface_async(&ssd->qxl, id, surface,
107 (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO,
108 QXL_IO_CREATE_PRIMARY_ASYNC));
110 spice_qxl_create_primary_surface(&ssd->qxl, id, surface);
114 void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd,
115 uint32_t id, qxl_async_io async)
117 trace_qemu_spice_destroy_primary_surface(ssd->qxl.id, id, async);
118 if (async != QXL_SYNC) {
119 spice_qxl_destroy_primary_surface_async(&ssd->qxl, id,
120 (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO,
121 QXL_IO_DESTROY_PRIMARY_ASYNC));
123 spice_qxl_destroy_primary_surface(&ssd->qxl, id);
127 void qemu_spice_wakeup(SimpleSpiceDisplay *ssd)
129 trace_qemu_spice_wakeup(ssd->qxl.id);
130 spice_qxl_wakeup(&ssd->qxl);
133 static void qemu_spice_create_one_update(SimpleSpiceDisplay *ssd,
136 SimpleSpiceUpdate *update;
137 QXLDrawable *drawable;
141 struct timespec time_space;
142 pixman_image_t *dest;
144 trace_qemu_spice_create_update(
145 rect->left, rect->right,
146 rect->top, rect->bottom);
148 update = g_malloc0(sizeof(*update));
149 drawable = &update->drawable;
150 image = &update->image;
151 cmd = &update->ext.cmd;
153 bw = rect->right - rect->left;
154 bh = rect->bottom - rect->top;
155 update->bitmap = g_malloc(bw * bh * 4);
157 drawable->bbox = *rect;
158 drawable->clip.type = SPICE_CLIP_TYPE_NONE;
159 drawable->effect = QXL_EFFECT_OPAQUE;
160 drawable->release_info.id = (uintptr_t)(&update->ext);
161 drawable->type = QXL_DRAW_COPY;
162 drawable->surfaces_dest[0] = -1;
163 drawable->surfaces_dest[1] = -1;
164 drawable->surfaces_dest[2] = -1;
165 clock_gettime(CLOCK_MONOTONIC, &time_space);
166 /* time in milliseconds from epoch. */
167 drawable->mm_time = time_space.tv_sec * 1000
168 + time_space.tv_nsec / 1000 / 1000;
170 drawable->u.copy.rop_descriptor = SPICE_ROPD_OP_PUT;
171 drawable->u.copy.src_bitmap = (uintptr_t)image;
172 drawable->u.copy.src_area.right = bw;
173 drawable->u.copy.src_area.bottom = bh;
175 QXL_SET_IMAGE_ID(image, QXL_IMAGE_GROUP_DEVICE, ssd->unique++);
176 image->descriptor.type = SPICE_IMAGE_TYPE_BITMAP;
177 image->bitmap.flags = QXL_BITMAP_DIRECT | QXL_BITMAP_TOP_DOWN;
178 image->bitmap.stride = bw * 4;
179 image->descriptor.width = image->bitmap.x = bw;
180 image->descriptor.height = image->bitmap.y = bh;
181 image->bitmap.data = (uintptr_t)(update->bitmap);
182 image->bitmap.palette = 0;
183 image->bitmap.format = SPICE_BITMAP_FMT_32BIT;
185 dest = pixman_image_create_bits(PIXMAN_x8r8g8b8, bw, bh,
186 (void *)update->bitmap, bw * 4);
187 pixman_image_composite(PIXMAN_OP_SRC, ssd->surface, NULL, ssd->mirror,
188 rect->left, rect->top, 0, 0,
189 rect->left, rect->top, bw, bh);
190 pixman_image_composite(PIXMAN_OP_SRC, ssd->mirror, NULL, dest,
191 rect->left, rect->top, 0, 0,
193 pixman_image_unref(dest);
195 cmd->type = QXL_CMD_DRAW;
196 cmd->data = (uintptr_t)drawable;
198 QTAILQ_INSERT_TAIL(&ssd->updates, update, next);
201 static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
204 static const int blksize = 32;
205 int blocks = (surface_width(ssd->ds) + blksize - 1) / blksize;
206 int dirty_top[blocks];
207 int y, yoff, x, xoff, blk, bw;
208 int bpp = surface_bytes_per_pixel(ssd->ds);
209 uint8_t *guest, *mirror;
212 if (qemu_spice_rect_is_empty(&ssd->dirty)) {
216 if (ssd->surface == NULL) {
217 ssd->surface = pixman_image_ref(ssd->ds->image);
218 ssd->mirror = qemu_pixman_mirror_create(ssd->ds->format,
223 for (blk = 0; blk < blocks; blk++) {
227 guest = surface_data(ssd->ds);
228 mirror = (void *)pixman_image_get_data(ssd->mirror);
229 for (y = ssd->dirty.top; y < ssd->dirty.bottom; y++) {
230 yoff = y * surface_stride(ssd->ds);
231 for (x = ssd->dirty.left; x < ssd->dirty.right; x += blksize) {
234 bw = MIN(blksize, ssd->dirty.right - x);
235 if (memcmp(guest + yoff + xoff,
236 mirror + yoff + xoff,
238 if (dirty_top[blk] != -1) {
240 .top = dirty_top[blk],
245 qemu_spice_create_one_update(ssd, &update);
249 if (dirty_top[blk] == -1) {
256 for (x = ssd->dirty.left; x < ssd->dirty.right; x += blksize) {
258 bw = MIN(blksize, ssd->dirty.right - x);
259 if (dirty_top[blk] != -1) {
261 .top = dirty_top[blk],
262 .bottom = ssd->dirty.bottom,
266 qemu_spice_create_one_update(ssd, &update);
273 pixman_transform_t matrix;
274 struct pixman_f_transform matrix_f;
276 pixman_f_transform_init_identity(&matrix_f);
277 pixman_f_transform_scale(&matrix_f, NULL, RATIO_SCALE, RATIO_SCALE);
278 pixman_transform_from_pixman_f_transform(&matrix, &matrix_f);
279 pixman_image_set_transform(ssd->ds->image, &matrix);
280 pixman_image_set_filter(ssd->ds->image, PIXMAN_FILTER_BEST, NULL, 0);
284 .bottom = surface_height(ssd->ds),
286 .right = surface_width(ssd->ds),
289 qemu_spice_create_one_update(ssd, &update);
292 memset(&ssd->dirty, 0, sizeof(ssd->dirty));
295 static SimpleSpiceCursor*
296 qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd,
299 size_t size = c ? c->width * c->height * 4 : 0;
300 SimpleSpiceCursor *update;
305 update = g_malloc0(sizeof(*update) + size);
307 cursor = &update->cursor;
308 cmd = &update->ext.cmd;
311 ccmd->type = QXL_CURSOR_SET;
312 ccmd->u.set.position.x = ssd->ptr_x;
313 ccmd->u.set.position.y = ssd->ptr_y;
314 ccmd->u.set.visible = true;
315 ccmd->u.set.shape = (uintptr_t)cursor;
316 cursor->header.unique = ssd->unique++;
317 cursor->header.type = SPICE_CURSOR_TYPE_ALPHA;
318 cursor->header.width = c->width;
319 cursor->header.height = c->height;
320 cursor->header.hot_spot_x = c->hot_x;
321 cursor->header.hot_spot_y = c->hot_y;
322 cursor->data_size = size;
323 cursor->chunk.data_size = size;
324 memcpy(cursor->chunk.data, c->data, size);
326 ccmd->type = QXL_CURSOR_MOVE;
327 ccmd->u.position.x = ssd->ptr_x;
328 ccmd->u.position.y = ssd->ptr_y;
330 ccmd->release_info.id = (uintptr_t)(&update->ext);
332 cmd->type = QXL_CMD_CURSOR;
333 cmd->data = (uintptr_t)ccmd;
339 * Called from spice server thread context (via interface_release_resource)
340 * We do *not* hold the global qemu mutex here, so extra care is needed
341 * when calling qemu functions. QEMU interfaces used:
342 * - g_free (underlying glibc free is re-entrant).
344 void qemu_spice_destroy_update(SimpleSpiceDisplay *sdpy, SimpleSpiceUpdate *update)
346 g_free(update->bitmap);
350 void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd)
352 QXLDevMemSlot memslot;
354 dprint(1, "%s/%d:\n", __func__, ssd->qxl.id);
356 memset(&memslot, 0, sizeof(memslot));
357 memslot.slot_group_id = MEMSLOT_GROUP_HOST;
358 memslot.virt_end = ~0;
359 qemu_spice_add_memslot(ssd, &memslot, QXL_SYNC);
362 void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd)
364 QXLDevSurfaceCreate surface;
365 uint64_t surface_size;
367 memset(&surface, 0, sizeof(surface));
369 surface_size = (uint64_t) surface_width(ssd->ds) *
370 surface_height(ssd->ds) * 4;
371 assert(surface_size > 0);
372 assert(surface_size < INT_MAX);
373 if (ssd->bufsize < surface_size) {
374 ssd->bufsize = surface_size;
376 ssd->buf = g_malloc(ssd->bufsize);
379 dprint(1, "%s/%d: %ux%u (size %" PRIu64 "/%d)\n", __func__, ssd->qxl.id,
380 surface_width(ssd->ds), surface_height(ssd->ds),
381 surface_size, ssd->bufsize);
383 surface.format = SPICE_SURFACE_FMT_32_xRGB;
384 surface.width = surface_width(ssd->ds);
385 surface.height = surface_height(ssd->ds);
386 surface.stride = -surface.width * 4;
387 surface.mouse_mode = true;
390 surface.mem = (uintptr_t)ssd->buf;
391 surface.group_id = MEMSLOT_GROUP_HOST;
394 surface.width /= RATIO_SCALE;
395 surface.height /= RATIO_SCALE;
398 qemu_spice_create_primary_surface(ssd, 0, &surface, QXL_SYNC);
401 void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd)
403 dprint(1, "%s/%d:\n", __func__, ssd->qxl.id);
405 qemu_spice_destroy_primary_surface(ssd, 0, QXL_SYNC);
408 void qemu_spice_display_init_common(SimpleSpiceDisplay *ssd)
410 qemu_mutex_init(&ssd->lock);
411 QTAILQ_INIT(&ssd->updates);
414 if (ssd->num_surfaces == 0) {
415 ssd->num_surfaces = 1024;
419 /* display listener callbacks */
421 void qemu_spice_display_update(SimpleSpiceDisplay *ssd,
422 int x, int y, int w, int h)
426 dprint(2, "%s/%d: x %d y %d w %d h %d\n", __func__,
427 ssd->qxl.id, x, y, w, h);
428 update_area.left = x,
429 update_area.right = x + w;
431 update_area.bottom = y + h;
433 if (qemu_spice_rect_is_empty(&ssd->dirty)) {
436 qemu_spice_rect_union(&ssd->dirty, &update_area);
439 void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
440 DisplaySurface *surface)
442 SimpleSpiceUpdate *update;
445 dprint(1, "%s/%d:\n", __func__, ssd->qxl.id);
447 memset(&ssd->dirty, 0, sizeof(ssd->dirty));
449 pixman_image_unref(ssd->surface);
451 pixman_image_unref(ssd->mirror);
455 qemu_mutex_lock(&ssd->lock);
456 need_destroy = (ssd->ds != NULL);
458 while ((update = QTAILQ_FIRST(&ssd->updates)) != NULL) {
459 QTAILQ_REMOVE(&ssd->updates, update, next);
460 qemu_spice_destroy_update(ssd, update);
462 qemu_mutex_unlock(&ssd->lock);
464 qemu_spice_destroy_host_primary(ssd);
467 qemu_spice_create_host_primary(ssd);
470 memset(&ssd->dirty, 0, sizeof(ssd->dirty));
474 void qemu_spice_cursor_refresh_unlocked(SimpleSpiceDisplay *ssd)
477 assert(ssd->dcl.con);
478 dpy_cursor_define(ssd->dcl.con, ssd->cursor);
479 cursor_put(ssd->cursor);
482 if (ssd->mouse_x != -1 && ssd->mouse_y != -1) {
483 assert(ssd->dcl.con);
484 dpy_mouse_set(ssd->dcl.con, ssd->mouse_x, ssd->mouse_y, 1);
490 void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)
492 dprint(3, "%s/%d:\n", __func__, ssd->qxl.id);
493 graphic_hw_update(ssd->dcl.con);
495 qemu_mutex_lock(&ssd->lock);
496 if (QTAILQ_EMPTY(&ssd->updates) && ssd->ds) {
497 qemu_spice_create_update(ssd);
500 qemu_spice_cursor_refresh_unlocked(ssd);
501 qemu_mutex_unlock(&ssd->lock);
505 qemu_spice_wakeup(ssd);
506 dprint(2, "%s/%d: notify\n", __func__, ssd->qxl.id);
510 /* spice display interface callbacks */
512 static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker)
514 SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
516 dprint(1, "%s/%d:\n", __func__, ssd->qxl.id);
517 ssd->worker = qxl_worker;
520 static void interface_set_compression_level(QXLInstance *sin, int level)
522 dprint(1, "%s/%d:\n", __func__, sin->id);
526 static void interface_set_mm_time(QXLInstance *sin, uint32_t mm_time)
528 dprint(3, "%s/%d:\n", __func__, sin->id);
532 static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info)
534 SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
536 info->memslot_gen_bits = MEMSLOT_GENERATION_BITS;
537 info->memslot_id_bits = MEMSLOT_SLOT_BITS;
538 info->num_memslots = NUM_MEMSLOTS;
539 info->num_memslots_groups = NUM_MEMSLOTS_GROUPS;
540 info->internal_groupslot_id = 0;
541 info->qxl_ram_size = 16 * 1024 * 1024;
542 info->n_surfaces = ssd->num_surfaces;
545 static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)
547 SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
548 SimpleSpiceUpdate *update;
551 dprint(3, "%s/%d:\n", __func__, ssd->qxl.id);
553 qemu_mutex_lock(&ssd->lock);
554 update = QTAILQ_FIRST(&ssd->updates);
555 if (update != NULL) {
556 QTAILQ_REMOVE(&ssd->updates, update, next);
560 qemu_mutex_unlock(&ssd->lock);
565 static int interface_req_cmd_notification(QXLInstance *sin)
567 dprint(1, "%s/%d:\n", __func__, sin->id);
571 static void interface_release_resource(QXLInstance *sin,
572 struct QXLReleaseInfoExt rext)
574 SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
575 SimpleSpiceUpdate *update;
576 SimpleSpiceCursor *cursor;
579 dprint(2, "%s/%d:\n", __func__, ssd->qxl.id);
580 ext = (void *)(intptr_t)(rext.info->id);
581 switch (ext->cmd.type) {
583 update = container_of(ext, SimpleSpiceUpdate, ext);
584 qemu_spice_destroy_update(ssd, update);
587 cursor = container_of(ext, SimpleSpiceCursor, ext);
591 g_assert_not_reached();
595 static int interface_get_cursor_command(QXLInstance *sin, struct QXLCommandExt *ext)
597 SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
600 dprint(3, "%s/%d:\n", __func__, ssd->qxl.id);
602 qemu_mutex_lock(&ssd->lock);
603 if (ssd->ptr_define) {
604 *ext = ssd->ptr_define->ext;
605 ssd->ptr_define = NULL;
607 } else if (ssd->ptr_move) {
608 *ext = ssd->ptr_move->ext;
609 ssd->ptr_move = NULL;
614 qemu_mutex_unlock(&ssd->lock);
618 static int interface_req_cursor_notification(QXLInstance *sin)
620 dprint(1, "%s:\n", __FUNCTION__);
624 static void interface_notify_update(QXLInstance *sin, uint32_t update_id)
626 fprintf(stderr, "%s: abort()\n", __FUNCTION__);
630 static int interface_flush_resources(QXLInstance *sin)
632 fprintf(stderr, "%s: abort()\n", __FUNCTION__);
637 static void interface_update_area_complete(QXLInstance *sin,
639 QXLRect *dirty, uint32_t num_updated_rects)
641 /* should never be called, used in qxl native mode only */
642 fprintf(stderr, "%s: abort()\n", __func__);
646 /* called from spice server thread context only */
647 static void interface_async_complete(QXLInstance *sin, uint64_t cookie_token)
649 /* should never be called, used in qxl native mode only */
650 fprintf(stderr, "%s: abort()\n", __func__);
654 static void interface_set_client_capabilities(QXLInstance *sin,
655 uint8_t client_present,
658 dprint(3, "%s:\n", __func__);
661 static int interface_client_monitors_config(QXLInstance *sin,
662 VDAgentMonitorsConfig *mc)
664 SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
673 * FIXME: multihead is tricky due to the way
674 * spice has multihead implemented.
676 memset(&info, 0, sizeof(info));
677 if (mc->num_of_monitors > 0) {
678 info.width = mc->monitors[0].width;
679 info.height = mc->monitors[0].height;
681 rc = dpy_set_ui_info(ssd->dcl.con, &info);
682 dprint(1, "%s/%d: size %dx%d, rc %d <--- ==========================\n",
683 __func__, ssd->qxl.id, info.width, info.height, rc);
685 return 0; /* == not supported by guest */
691 static const QXLInterface dpy_interface = {
692 .base.type = SPICE_INTERFACE_QXL,
693 .base.description = "qemu simple display",
694 .base.major_version = SPICE_INTERFACE_QXL_MAJOR,
695 .base.minor_version = SPICE_INTERFACE_QXL_MINOR,
697 .attache_worker = interface_attach_worker,
698 .set_compression_level = interface_set_compression_level,
699 .set_mm_time = interface_set_mm_time,
700 .get_init_info = interface_get_init_info,
702 /* the callbacks below are called from spice server thread context */
703 .get_command = interface_get_command,
704 .req_cmd_notification = interface_req_cmd_notification,
705 .release_resource = interface_release_resource,
706 .get_cursor_command = interface_get_cursor_command,
707 .req_cursor_notification = interface_req_cursor_notification,
708 .notify_update = interface_notify_update,
709 .flush_resources = interface_flush_resources,
710 .async_complete = interface_async_complete,
711 .update_area_complete = interface_update_area_complete,
712 .set_client_capabilities = interface_set_client_capabilities,
713 .client_monitors_config = interface_client_monitors_config,
716 static void display_update(DisplayChangeListener *dcl,
717 int x, int y, int w, int h)
719 SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
720 qemu_spice_display_update(ssd, x, y, w, h);
723 static void display_switch(DisplayChangeListener *dcl,
724 struct DisplaySurface *surface)
726 SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
727 qemu_spice_display_switch(ssd, surface);
730 static void display_refresh(DisplayChangeListener *dcl)
732 SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
733 qemu_spice_display_refresh(ssd);
736 static void display_mouse_set(DisplayChangeListener *dcl,
737 int x, int y, int on)
739 SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
741 qemu_mutex_lock(&ssd->lock);
745 g_free(ssd->ptr_move);
747 ssd->ptr_move = qemu_spice_create_cursor_update(ssd, NULL);
748 qemu_mutex_unlock(&ssd->lock);
751 static void display_mouse_define(DisplayChangeListener *dcl,
754 SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
756 qemu_mutex_lock(&ssd->lock);
758 g_free(ssd->ptr_move);
759 ssd->ptr_move = NULL;
761 if (ssd->ptr_define) {
762 g_free(ssd->ptr_define);
764 ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c);
765 qemu_mutex_unlock(&ssd->lock);
768 static const DisplayChangeListenerOps display_listener_ops = {
770 .dpy_gfx_update = display_update,
771 .dpy_gfx_switch = display_switch,
772 .dpy_refresh = display_refresh,
773 .dpy_mouse_set = display_mouse_set,
774 .dpy_cursor_define = display_mouse_define,
777 static void qemu_spice_display_init_one(QemuConsole *con)
779 SimpleSpiceDisplay *ssd = g_new0(SimpleSpiceDisplay, 1);
781 qemu_spice_display_init_common(ssd);
783 ssd->qxl.base.sif = &dpy_interface.base;
784 qemu_spice_add_display_interface(&ssd->qxl, con);
787 qemu_spice_create_host_memslot(ssd);
789 ssd->dcl.ops = &display_listener_ops;
791 register_displaychangelistener(&ssd->dcl);
794 void qemu_spice_display_init(void)
800 con = qemu_console_lookup_by_index(i);
801 if (!con || !qemu_console_is_graphic(con)) {
804 if (qemu_spice_have_display_interface(con)) {
807 qemu_spice_display_init_one(con);