Lines Matching +full:io +full:- +full:width
19 #include "ui/qemu-spice.h"
20 #include "qemu/error-report.h"
23 #include "qemu/main-loop.h"
29 #include "ui/spice-display.h"
31 #include "standard-headers/drm/drm_fourcc.h"
37 return r->top == r->bottom || r->left == r->right; in qemu_spice_rect_is_empty()
51 dest->top = MIN(dest->top, r->top); in qemu_spice_rect_union()
52 dest->left = MIN(dest->left, r->left); in qemu_spice_rect_union()
53 dest->bottom = MAX(dest->bottom, r->bottom); in qemu_spice_rect_union()
54 dest->right = MAX(dest->right, r->right); in qemu_spice_rect_union()
57 QXLCookie *qxl_cookie_new(int type, uint64_t io) in qxl_cookie_new() argument
62 cookie->type = type; in qxl_cookie_new()
63 cookie->io = io; in qxl_cookie_new()
70 trace_qemu_spice_add_memslot(ssd->qxl.id, memslot->slot_id, in qemu_spice_add_memslot()
71 memslot->virt_start, memslot->virt_end, in qemu_spice_add_memslot()
75 spice_qxl_add_memslot_async(&ssd->qxl, memslot, in qemu_spice_add_memslot()
79 spice_qxl_add_memslot(&ssd->qxl, memslot); in qemu_spice_add_memslot()
85 trace_qemu_spice_del_memslot(ssd->qxl.id, gid, sid); in qemu_spice_del_memslot()
86 spice_qxl_del_memslot(&ssd->qxl, gid, sid); in qemu_spice_del_memslot()
93 trace_qemu_spice_create_primary_surface(ssd->qxl.id, id, surface, async); in qemu_spice_create_primary_surface()
95 spice_qxl_create_primary_surface_async(&ssd->qxl, id, surface, in qemu_spice_create_primary_surface()
99 spice_qxl_create_primary_surface(&ssd->qxl, id, surface); in qemu_spice_create_primary_surface()
106 trace_qemu_spice_destroy_primary_surface(ssd->qxl.id, id, async); in qemu_spice_destroy_primary_surface()
108 spice_qxl_destroy_primary_surface_async(&ssd->qxl, id, in qemu_spice_destroy_primary_surface()
112 spice_qxl_destroy_primary_surface(&ssd->qxl, id); in qemu_spice_destroy_primary_surface()
118 trace_qemu_spice_wakeup(ssd->qxl.id); in qemu_spice_wakeup()
119 spice_qxl_wakeup(&ssd->qxl); in qemu_spice_wakeup()
134 rect->left, rect->right, in qemu_spice_create_one_update()
135 rect->top, rect->bottom); in qemu_spice_create_one_update()
138 drawable = &update->drawable; in qemu_spice_create_one_update()
139 image = &update->image; in qemu_spice_create_one_update()
140 cmd = &update->ext.cmd; in qemu_spice_create_one_update()
142 bw = rect->right - rect->left; in qemu_spice_create_one_update()
143 bh = rect->bottom - rect->top; in qemu_spice_create_one_update()
144 update->bitmap = g_malloc(bw * bh * 4); in qemu_spice_create_one_update()
146 drawable->bbox = *rect; in qemu_spice_create_one_update()
147 drawable->clip.type = SPICE_CLIP_TYPE_NONE; in qemu_spice_create_one_update()
148 drawable->effect = QXL_EFFECT_OPAQUE; in qemu_spice_create_one_update()
149 drawable->release_info.id = (uintptr_t)(&update->ext); in qemu_spice_create_one_update()
150 drawable->type = QXL_DRAW_COPY; in qemu_spice_create_one_update()
151 drawable->surfaces_dest[0] = -1; in qemu_spice_create_one_update()
152 drawable->surfaces_dest[1] = -1; in qemu_spice_create_one_update()
153 drawable->surfaces_dest[2] = -1; in qemu_spice_create_one_update()
156 drawable->mm_time = time_space.tv_sec * 1000 in qemu_spice_create_one_update()
159 drawable->u.copy.rop_descriptor = SPICE_ROPD_OP_PUT; in qemu_spice_create_one_update()
160 drawable->u.copy.src_bitmap = (uintptr_t)image; in qemu_spice_create_one_update()
161 drawable->u.copy.src_area.right = bw; in qemu_spice_create_one_update()
162 drawable->u.copy.src_area.bottom = bh; in qemu_spice_create_one_update()
164 QXL_SET_IMAGE_ID(image, QXL_IMAGE_GROUP_DEVICE, ssd->unique++); in qemu_spice_create_one_update()
165 image->descriptor.type = SPICE_IMAGE_TYPE_BITMAP; in qemu_spice_create_one_update()
166 image->bitmap.flags = QXL_BITMAP_DIRECT | QXL_BITMAP_TOP_DOWN; in qemu_spice_create_one_update()
167 image->bitmap.stride = bw * 4; in qemu_spice_create_one_update()
168 image->descriptor.width = image->bitmap.x = bw; in qemu_spice_create_one_update()
169 image->descriptor.height = image->bitmap.y = bh; in qemu_spice_create_one_update()
170 image->bitmap.data = (uintptr_t)(update->bitmap); in qemu_spice_create_one_update()
171 image->bitmap.palette = 0; in qemu_spice_create_one_update()
172 image->bitmap.format = SPICE_BITMAP_FMT_32BIT; in qemu_spice_create_one_update()
175 (void *)update->bitmap, bw * 4); in qemu_spice_create_one_update()
176 pixman_image_composite(PIXMAN_OP_SRC, ssd->surface, NULL, ssd->mirror, in qemu_spice_create_one_update()
177 rect->left, rect->top, 0, 0, in qemu_spice_create_one_update()
178 rect->left, rect->top, bw, bh); in qemu_spice_create_one_update()
179 pixman_image_composite(PIXMAN_OP_SRC, ssd->mirror, NULL, dest, in qemu_spice_create_one_update()
180 rect->left, rect->top, 0, 0, in qemu_spice_create_one_update()
184 cmd->type = QXL_CMD_DRAW; in qemu_spice_create_one_update()
185 cmd->data = (uintptr_t)drawable; in qemu_spice_create_one_update()
187 QTAILQ_INSERT_TAIL(&ssd->updates, update, next); in qemu_spice_create_one_update()
193 int blocks = DIV_ROUND_UP(surface_width(ssd->ds), blksize); in qemu_spice_create_update()
196 int bpp = surface_bytes_per_pixel(ssd->ds); in qemu_spice_create_update()
199 if (qemu_spice_rect_is_empty(&ssd->dirty)) { in qemu_spice_create_update()
205 dirty_top[blk] = -1; in qemu_spice_create_update()
208 guest = surface_data(ssd->ds); in qemu_spice_create_update()
209 mirror = (void *)pixman_image_get_data(ssd->mirror); in qemu_spice_create_update()
210 for (y = ssd->dirty.top; y < ssd->dirty.bottom; y++) { in qemu_spice_create_update()
211 yoff1 = y * surface_stride(ssd->ds); in qemu_spice_create_update()
212 yoff2 = y * pixman_image_get_stride(ssd->mirror); in qemu_spice_create_update()
213 for (x = ssd->dirty.left; x < ssd->dirty.right; x += blksize) { in qemu_spice_create_update()
216 bw = MIN(blksize, ssd->dirty.right - x); in qemu_spice_create_update()
220 if (dirty_top[blk] != -1) { in qemu_spice_create_update()
228 dirty_top[blk] = -1; in qemu_spice_create_update()
231 if (dirty_top[blk] == -1) { in qemu_spice_create_update()
238 for (x = ssd->dirty.left; x < ssd->dirty.right; x += blksize) { in qemu_spice_create_update()
240 bw = MIN(blksize, ssd->dirty.right - x); in qemu_spice_create_update()
241 if (dirty_top[blk] != -1) { in qemu_spice_create_update()
244 .bottom = ssd->dirty.bottom, in qemu_spice_create_update()
249 dirty_top[blk] = -1; in qemu_spice_create_update()
253 memset(&ssd->dirty, 0, sizeof(ssd->dirty)); in qemu_spice_create_update()
261 size_t size = c ? c->width * c->height * 4 : 0; in qemu_spice_create_cursor_update()
268 ccmd = &update->cmd; in qemu_spice_create_cursor_update()
269 cursor = &update->cursor; in qemu_spice_create_cursor_update()
270 cmd = &update->ext.cmd; in qemu_spice_create_cursor_update()
273 ccmd->type = QXL_CURSOR_SET; in qemu_spice_create_cursor_update()
274 ccmd->u.set.position.x = ssd->ptr_x + ssd->hot_x; in qemu_spice_create_cursor_update()
275 ccmd->u.set.position.y = ssd->ptr_y + ssd->hot_y; in qemu_spice_create_cursor_update()
276 ccmd->u.set.visible = true; in qemu_spice_create_cursor_update()
277 ccmd->u.set.shape = (uintptr_t)cursor; in qemu_spice_create_cursor_update()
278 cursor->header.unique = ssd->unique++; in qemu_spice_create_cursor_update()
279 cursor->header.type = SPICE_CURSOR_TYPE_ALPHA; in qemu_spice_create_cursor_update()
280 cursor->header.width = c->width; in qemu_spice_create_cursor_update()
281 cursor->header.height = c->height; in qemu_spice_create_cursor_update()
282 cursor->header.hot_spot_x = c->hot_x; in qemu_spice_create_cursor_update()
283 cursor->header.hot_spot_y = c->hot_y; in qemu_spice_create_cursor_update()
284 cursor->data_size = size; in qemu_spice_create_cursor_update()
285 cursor->chunk.data_size = size; in qemu_spice_create_cursor_update()
286 memcpy(cursor->chunk.data, c->data, size); in qemu_spice_create_cursor_update()
288 ccmd->type = QXL_CURSOR_HIDE; in qemu_spice_create_cursor_update()
290 ccmd->type = QXL_CURSOR_MOVE; in qemu_spice_create_cursor_update()
291 ccmd->u.position.x = ssd->ptr_x + ssd->hot_x; in qemu_spice_create_cursor_update()
292 ccmd->u.position.y = ssd->ptr_y + ssd->hot_y; in qemu_spice_create_cursor_update()
294 ccmd->release_info.id = (uintptr_t)(&update->ext); in qemu_spice_create_cursor_update()
296 cmd->type = QXL_CMD_CURSOR; in qemu_spice_create_cursor_update()
297 cmd->data = (uintptr_t)ccmd; in qemu_spice_create_cursor_update()
306 * - g_free (underlying glibc free is re-entrant).
310 g_free(update->bitmap); in qemu_spice_destroy_update()
331 surface_size = (uint64_t) surface_width(ssd->ds) * in qemu_spice_create_host_primary()
332 surface_height(ssd->ds) * 4; in qemu_spice_create_host_primary()
335 if (ssd->bufsize < surface_size) { in qemu_spice_create_host_primary()
336 ssd->bufsize = surface_size; in qemu_spice_create_host_primary()
337 g_free(ssd->buf); in qemu_spice_create_host_primary()
338 ssd->buf = g_malloc(ssd->bufsize); in qemu_spice_create_host_primary()
342 surface.width = surface_width(ssd->ds); in qemu_spice_create_host_primary()
343 surface.height = surface_height(ssd->ds); in qemu_spice_create_host_primary()
344 surface.stride = -surface.width * 4; in qemu_spice_create_host_primary()
348 surface.mem = (uintptr_t)ssd->buf; in qemu_spice_create_host_primary()
361 qemu_mutex_init(&ssd->lock); in qemu_spice_display_init_common()
362 QTAILQ_INIT(&ssd->updates); in qemu_spice_display_init_common()
363 ssd->mouse_x = -1; in qemu_spice_display_init_common()
364 ssd->mouse_y = -1; in qemu_spice_display_init_common()
365 if (ssd->num_surfaces == 0) { in qemu_spice_display_init_common()
366 ssd->num_surfaces = 1024; in qemu_spice_display_init_common()
377 trace_qemu_spice_display_update(ssd->qxl.id, x, y, w, h); in qemu_spice_display_update()
383 if (qemu_spice_rect_is_empty(&ssd->dirty)) { in qemu_spice_display_update()
384 ssd->notify++; in qemu_spice_display_update()
386 qemu_spice_rect_union(&ssd->dirty, &update_area); in qemu_spice_display_update()
395 if (ssd->surface && in qemu_spice_display_switch()
396 surface_width(surface) == pixman_image_get_width(ssd->surface) && in qemu_spice_display_switch()
397 surface_height(surface) == pixman_image_get_height(ssd->surface) && in qemu_spice_display_switch()
398 surface_format(surface) == pixman_image_get_format(ssd->surface)) { in qemu_spice_display_switch()
399 /* no-resize fast path: just swap backing store */ in qemu_spice_display_switch()
400 trace_qemu_spice_display_surface(ssd->qxl.id, in qemu_spice_display_switch()
404 qemu_mutex_lock(&ssd->lock); in qemu_spice_display_switch()
405 ssd->ds = surface; in qemu_spice_display_switch()
406 pixman_image_unref(ssd->surface); in qemu_spice_display_switch()
407 ssd->surface = pixman_image_ref(ssd->ds->image); in qemu_spice_display_switch()
408 qemu_mutex_unlock(&ssd->lock); in qemu_spice_display_switch()
416 trace_qemu_spice_display_surface(ssd->qxl.id, in qemu_spice_display_switch()
421 memset(&ssd->dirty, 0, sizeof(ssd->dirty)); in qemu_spice_display_switch()
422 if (ssd->surface) { in qemu_spice_display_switch()
423 pixman_image_unref(ssd->surface); in qemu_spice_display_switch()
424 ssd->surface = NULL; in qemu_spice_display_switch()
425 pixman_image_unref(ssd->mirror); in qemu_spice_display_switch()
426 ssd->mirror = NULL; in qemu_spice_display_switch()
429 qemu_mutex_lock(&ssd->lock); in qemu_spice_display_switch()
430 need_destroy = (ssd->ds != NULL); in qemu_spice_display_switch()
431 ssd->ds = surface; in qemu_spice_display_switch()
432 while ((update = QTAILQ_FIRST(&ssd->updates)) != NULL) { in qemu_spice_display_switch()
433 QTAILQ_REMOVE(&ssd->updates, update, next); in qemu_spice_display_switch()
436 qemu_mutex_unlock(&ssd->lock); in qemu_spice_display_switch()
440 if (ssd->ds) { in qemu_spice_display_switch()
441 ssd->surface = pixman_image_ref(ssd->ds->image); in qemu_spice_display_switch()
442 ssd->mirror = qemu_pixman_mirror_create(surface_format(ssd->ds), in qemu_spice_display_switch()
443 ssd->ds->image); in qemu_spice_display_switch()
447 memset(&ssd->dirty, 0, sizeof(ssd->dirty)); in qemu_spice_display_switch()
448 ssd->notify++; in qemu_spice_display_switch()
450 qemu_mutex_lock(&ssd->lock); in qemu_spice_display_switch()
451 if (ssd->cursor) { in qemu_spice_display_switch()
452 g_free(ssd->ptr_define); in qemu_spice_display_switch()
453 ssd->ptr_define = in qemu_spice_display_switch()
454 qemu_spice_create_cursor_update(ssd, ssd->cursor, false); in qemu_spice_display_switch()
456 qemu_mutex_unlock(&ssd->lock); in qemu_spice_display_switch()
463 qemu_mutex_lock(&ssd->lock); in qemu_spice_cursor_refresh_bh()
464 if (ssd->cursor) { in qemu_spice_cursor_refresh_bh()
465 QEMUCursor *c = ssd->cursor; in qemu_spice_cursor_refresh_bh()
466 assert(ssd->dcl.con); in qemu_spice_cursor_refresh_bh()
468 qemu_mutex_unlock(&ssd->lock); in qemu_spice_cursor_refresh_bh()
469 dpy_cursor_define(ssd->dcl.con, c); in qemu_spice_cursor_refresh_bh()
470 qemu_mutex_lock(&ssd->lock); in qemu_spice_cursor_refresh_bh()
474 if (ssd->mouse_x != -1 && ssd->mouse_y != -1) { in qemu_spice_cursor_refresh_bh()
476 assert(ssd->dcl.con); in qemu_spice_cursor_refresh_bh()
477 x = ssd->mouse_x; in qemu_spice_cursor_refresh_bh()
478 y = ssd->mouse_y; in qemu_spice_cursor_refresh_bh()
479 ssd->mouse_x = -1; in qemu_spice_cursor_refresh_bh()
480 ssd->mouse_y = -1; in qemu_spice_cursor_refresh_bh()
481 qemu_mutex_unlock(&ssd->lock); in qemu_spice_cursor_refresh_bh()
482 dpy_mouse_set(ssd->dcl.con, x, y, true); in qemu_spice_cursor_refresh_bh()
484 qemu_mutex_unlock(&ssd->lock); in qemu_spice_cursor_refresh_bh()
490 graphic_hw_update(ssd->dcl.con); in qemu_spice_display_refresh()
492 WITH_QEMU_LOCK_GUARD(&ssd->lock) { in qemu_spice_display_refresh()
493 if (QTAILQ_EMPTY(&ssd->updates) && ssd->ds) { in qemu_spice_display_refresh()
495 ssd->notify++; in qemu_spice_display_refresh()
499 trace_qemu_spice_display_refresh(ssd->qxl.id, ssd->notify); in qemu_spice_display_refresh()
500 if (ssd->notify) { in qemu_spice_display_refresh()
501 ssd->notify = 0; in qemu_spice_display_refresh()
529 info->memslot_gen_bits = MEMSLOT_GENERATION_BITS; in interface_get_init_info()
530 info->memslot_id_bits = MEMSLOT_SLOT_BITS; in interface_get_init_info()
531 info->num_memslots = NUM_MEMSLOTS; in interface_get_init_info()
532 info->num_memslots_groups = NUM_MEMSLOTS_GROUPS; in interface_get_init_info()
533 info->internal_groupslot_id = 0; in interface_get_init_info()
534 info->qxl_ram_size = 16 * 1024 * 1024; in interface_get_init_info()
535 info->n_surfaces = ssd->num_surfaces; in interface_get_init_info()
544 qemu_mutex_lock(&ssd->lock); in interface_get_command()
545 update = QTAILQ_FIRST(&ssd->updates); in interface_get_command()
547 QTAILQ_REMOVE(&ssd->updates, update, next); in interface_get_command()
548 *ext = update->ext; in interface_get_command()
551 qemu_mutex_unlock(&ssd->lock); in interface_get_command()
573 ext = (void *)(intptr_t)(rext.info->id); in interface_release_resource()
574 switch (ext->cmd.type) { in interface_release_resource()
593 QEMU_LOCK_GUARD(&ssd->lock); in interface_get_cursor_command()
594 if (ssd->ptr_define) { in interface_get_cursor_command()
595 *ext = ssd->ptr_define->ext; in interface_get_cursor_command()
596 ssd->ptr_define = NULL; in interface_get_cursor_command()
598 } else if (ssd->ptr_move) { in interface_get_cursor_command()
599 *ext = ssd->ptr_move->ext; in interface_get_cursor_command()
600 ssd->ptr_move = NULL; in interface_get_cursor_command()
640 switch (cookie->type) { in interface_async_complete()
645 qemu_bh_schedule(ssd->gl_unblock_bh); in interface_async_complete()
649 if (cookie->io == QXL_IO_MONITORS_CONFIG_ASYNC) { in interface_async_complete()
650 g_free(cookie->u.data); in interface_async_complete()
676 if (!dpy_ui_info_supported(ssd->dcl.con)) { in interface_client_monitors_config()
684 info = *dpy_get_ui_info(ssd->dcl.con); in interface_client_monitors_config()
686 head = qemu_console_get_index(ssd->dcl.con); in interface_client_monitors_config()
687 if (mc->num_of_monitors > head) { in interface_client_monitors_config()
688 info.width = mc->monitors[head].width; in interface_client_monitors_config()
689 info.height = mc->monitors[head].height; in interface_client_monitors_config()
691 if (mc->flags & VD_AGENT_CONFIG_MONITORS_FLAG_PHYSICAL_SIZE) { in interface_client_monitors_config()
692 VDAgentMonitorMM *mm = (void *)&mc->monitors[mc->num_of_monitors]; in interface_client_monitors_config()
693 info.width_mm = mm[head].width; in interface_client_monitors_config()
699 trace_qemu_spice_ui_info(ssd->qxl.id, info.width, info.height); in interface_client_monitors_config()
700 dpy_set_ui_info(ssd->dcl.con, &info, false); in interface_client_monitors_config()
757 qemu_mutex_lock(&ssd->lock); in display_mouse_set()
758 ssd->ptr_x = x; in display_mouse_set()
759 ssd->ptr_y = y; in display_mouse_set()
760 g_free(ssd->ptr_move); in display_mouse_set()
761 ssd->ptr_move = qemu_spice_create_cursor_update(ssd, NULL, on); in display_mouse_set()
762 qemu_mutex_unlock(&ssd->lock); in display_mouse_set()
771 qemu_mutex_lock(&ssd->lock); in display_mouse_define()
773 cursor_unref(ssd->cursor); in display_mouse_define()
774 ssd->cursor = c; in display_mouse_define()
775 ssd->hot_x = c->hot_x; in display_mouse_define()
776 ssd->hot_y = c->hot_y; in display_mouse_define()
777 g_free(ssd->ptr_move); in display_mouse_define()
778 ssd->ptr_move = NULL; in display_mouse_define()
779 g_free(ssd->ptr_define); in display_mouse_define()
780 ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c, false); in display_mouse_define()
781 qemu_mutex_unlock(&ssd->lock); in display_mouse_define()
804 config->count = 1; in qemu_spice_gl_monitor_config()
805 config->max_allowed = 1; in qemu_spice_gl_monitor_config()
806 config->heads[0].x = x; in qemu_spice_gl_monitor_config()
807 config->heads[0].y = y; in qemu_spice_gl_monitor_config()
808 config->heads[0].width = w; in qemu_spice_gl_monitor_config()
809 config->heads[0].height = h; in qemu_spice_gl_monitor_config()
812 cookie->u.data = config; in qemu_spice_gl_monitor_config()
814 spice_qxl_monitors_config_async(&ssd->qxl, in qemu_spice_gl_monitor_config()
827 timer_mod(ssd->gl_unblock_timer, timeout); in qemu_spice_gl_block()
829 timer_del(ssd->gl_unblock_timer); in qemu_spice_gl_block()
831 graphic_hw_gl_block(ssd->dcl.con, block); in qemu_spice_gl_block()
843 warn_report("spice: no gl-draw-done within one second"); in qemu_spice_gl_block_timer()
851 if (!ssd->ds || qemu_console_is_gl_blocked(ssd->dcl.con)) { in spice_gl_refresh()
855 graphic_hw_update(dcl->con); in spice_gl_refresh()
856 if (ssd->gl_updates && ssd->have_surface) { in spice_gl_refresh()
860 spice_qxl_gl_draw_async(&ssd->qxl, 0, 0, in spice_gl_refresh()
861 surface_width(ssd->ds), in spice_gl_refresh()
862 surface_height(ssd->ds), in spice_gl_refresh()
864 ssd->gl_updates = 0; in spice_gl_refresh()
873 surface_gl_update_texture(ssd->gls, ssd->ds, x, y, w, h); in spice_gl_update()
874 ssd->gl_updates++; in spice_gl_update()
879 uint32_t width, uint32_t height, in spice_server_gl_scanout() argument
886 spice_qxl_gl_scanout2(qxl, fd, width, height, offset, stride, in spice_server_gl_scanout()
890 spice_qxl_gl_scanout(qxl, fd[0], width, height, stride[0], format, y_0_top); in spice_server_gl_scanout()
902 if (ssd->ds) { in spice_gl_switch()
903 surface_gl_destroy_texture(ssd->gls, ssd->ds); in spice_gl_switch()
905 ssd->ds = new_surface; in spice_gl_switch()
906 if (ssd->ds) { in spice_gl_switch()
911 surface_gl_create_texture(ssd->gls, ssd->ds); in spice_gl_switch()
912 if (!egl_dmabuf_export_texture(ssd->ds->texture, in spice_gl_switch()
919 surface_gl_destroy_texture(ssd->gls, ssd->ds); in spice_gl_switch()
923 trace_qemu_spice_gl_surface(ssd->qxl.id, in spice_gl_switch()
924 surface_width(ssd->ds), in spice_gl_switch()
925 surface_height(ssd->ds), in spice_gl_switch()
929 spice_server_gl_scanout(&ssd->qxl, fd, in spice_gl_switch()
930 surface_width(ssd->ds), in spice_gl_switch()
931 surface_height(ssd->ds), in spice_gl_switch()
934 ssd->have_surface = true; in spice_gl_switch()
935 ssd->have_scanout = false; in spice_gl_switch()
938 surface_width(ssd->ds), in spice_gl_switch()
939 surface_height(ssd->ds)); in spice_gl_switch()
955 trace_qemu_spice_gl_scanout_disable(ssd->qxl.id); in qemu_spice_gl_scanout_disable()
956 spice_server_gl_scanout(&ssd->qxl, NULL, 0, 0, NULL, NULL, 0, DRM_FORMAT_INVALID, in qemu_spice_gl_scanout_disable()
959 ssd->have_surface = false; in qemu_spice_gl_scanout_disable()
960 ssd->have_scanout = false; in qemu_spice_gl_scanout_disable()
984 trace_qemu_spice_gl_scanout_texture(ssd->qxl.id, w, h, fourcc); in qemu_spice_gl_scanout_texture()
987 spice_server_gl_scanout(&ssd->qxl, fd, backing_width, backing_height, in qemu_spice_gl_scanout_texture()
991 ssd->have_surface = false; in qemu_spice_gl_scanout_texture()
992 ssd->have_scanout = true; in qemu_spice_gl_scanout_texture()
1000 ssd->guest_dmabuf = dmabuf; in qemu_spice_gl_scanout_dmabuf()
1001 ssd->guest_dmabuf_refresh = true; in qemu_spice_gl_scanout_dmabuf()
1003 ssd->have_surface = false; in qemu_spice_gl_scanout_dmabuf()
1004 ssd->have_scanout = true; in qemu_spice_gl_scanout_dmabuf()
1012 uint32_t width, height, texture; in qemu_spice_gl_cursor_dmabuf() local
1014 ssd->have_hot = have_hot; in qemu_spice_gl_cursor_dmabuf()
1015 ssd->hot_x = hot_x; in qemu_spice_gl_cursor_dmabuf()
1016 ssd->hot_y = hot_y; in qemu_spice_gl_cursor_dmabuf()
1018 trace_qemu_spice_gl_cursor(ssd->qxl.id, dmabuf != NULL, have_hot); in qemu_spice_gl_cursor_dmabuf()
1025 width = qemu_dmabuf_get_width(dmabuf); in qemu_spice_gl_cursor_dmabuf()
1027 egl_fb_setup_for_tex(&ssd->cursor_fb, width, height, texture, false); in qemu_spice_gl_cursor_dmabuf()
1029 egl_fb_destroy(&ssd->cursor_fb); in qemu_spice_gl_cursor_dmabuf()
1038 qemu_mutex_lock(&ssd->lock); in qemu_spice_gl_cursor_position()
1039 ssd->ptr_x = pos_x; in qemu_spice_gl_cursor_position()
1040 ssd->ptr_y = pos_y; in qemu_spice_gl_cursor_position()
1041 qemu_mutex_unlock(&ssd->lock); in qemu_spice_gl_cursor_position()
1049 if (ssd->guest_dmabuf == dmabuf) { in qemu_spice_gl_release_dmabuf()
1050 ssd->guest_dmabuf = NULL; in qemu_spice_gl_release_dmabuf()
1051 ssd->guest_dmabuf_refresh = false; in qemu_spice_gl_release_dmabuf()
1064 uint32_t width, height, texture; in qemu_spice_gl_update() local
1066 if (!ssd->have_scanout) { in qemu_spice_gl_update()
1070 if (ssd->cursor_fb.texture) { in qemu_spice_gl_update()
1073 if (ssd->render_cursor != render_cursor) { in qemu_spice_gl_update()
1074 ssd->render_cursor = render_cursor; in qemu_spice_gl_update()
1075 ssd->guest_dmabuf_refresh = true; in qemu_spice_gl_update()
1076 egl_fb_destroy(&ssd->blit_fb); in qemu_spice_gl_update()
1079 if (ssd->guest_dmabuf_refresh) { in qemu_spice_gl_update()
1080 QemuDmaBuf *dmabuf = ssd->guest_dmabuf; in qemu_spice_gl_update()
1081 width = qemu_dmabuf_get_width(dmabuf); in qemu_spice_gl_update()
1092 egl_fb_setup_for_tex(&ssd->guest_fb, width, height, in qemu_spice_gl_update()
1096 if (ssd->blit_fb.width != width || in qemu_spice_gl_update()
1097 ssd->blit_fb.height != height) { in qemu_spice_gl_update()
1102 trace_qemu_spice_gl_render_dmabuf(ssd->qxl.id, width, in qemu_spice_gl_update()
1104 egl_fb_destroy(&ssd->blit_fb); in qemu_spice_gl_update()
1105 egl_fb_setup_new_tex(&ssd->blit_fb, in qemu_spice_gl_update()
1106 width, height); in qemu_spice_gl_update()
1107 if (!egl_dmabuf_export_texture(ssd->blit_fb.texture, fds, in qemu_spice_gl_update()
1115 spice_server_gl_scanout(&ssd->qxl, fds, width, height, offsets, strides, in qemu_spice_gl_update()
1132 trace_qemu_spice_gl_forward_dmabuf(ssd->qxl.id, width, height); in qemu_spice_gl_update()
1134 spice_server_gl_scanout(&ssd->qxl, fds, width, height, in qemu_spice_gl_update()
1140 qemu_spice_gl_monitor_config(ssd, 0, 0, width, height); in qemu_spice_gl_update()
1141 ssd->guest_dmabuf_refresh = false; in qemu_spice_gl_update()
1147 qemu_mutex_lock(&ssd->lock); in qemu_spice_gl_update()
1148 ptr_x = ssd->ptr_x; in qemu_spice_gl_update()
1149 ptr_y = ssd->ptr_y; in qemu_spice_gl_update()
1150 qemu_mutex_unlock(&ssd->lock); in qemu_spice_gl_update()
1151 egl_texture_blit(ssd->gls, &ssd->blit_fb, &ssd->guest_fb, in qemu_spice_gl_update()
1153 egl_texture_blend(ssd->gls, &ssd->blit_fb, &ssd->cursor_fb, in qemu_spice_gl_update()
1158 trace_qemu_spice_gl_update(ssd->qxl.id, w, h, x, y); in qemu_spice_gl_update()
1162 spice_qxl_gl_draw_async(&ssd->qxl, x, y, w, h, cookie); in qemu_spice_gl_update()
1166 .dpy_name = "spice-egl",
1187 return dcl->ops == &display_listener_gl_ops; in qemu_spice_is_compatible_dcl()
1205 ssd->dcl.ops = &display_listener_ops; in qemu_spice_display_init_one()
1208 ssd->dcl.ops = &display_listener_gl_ops; in qemu_spice_display_init_one()
1209 ssd->dgc.ops = &gl_ctx_ops; in qemu_spice_display_init_one()
1210 ssd->gl_unblock_bh = qemu_bh_new(qemu_spice_gl_unblock_bh, ssd); in qemu_spice_display_init_one()
1211 ssd->gl_unblock_timer = timer_new_ms(QEMU_CLOCK_REALTIME, in qemu_spice_display_init_one()
1213 ssd->gls = qemu_gl_init_shader(); in qemu_spice_display_init_one()
1214 ssd->have_surface = false; in qemu_spice_display_init_one()
1215 ssd->have_scanout = false; in qemu_spice_display_init_one()
1218 ssd->dcl.con = con; in qemu_spice_display_init_one()
1220 ssd->qxl.base.sif = &dpy_interface.base; in qemu_spice_display_init_one()
1221 qemu_spice_add_display_interface(&ssd->qxl, con); in qemu_spice_display_init_one()
1227 spice_qxl_set_device_info(&ssd->qxl, in qemu_spice_display_init_one()
1239 qemu_console_set_display_gl_ctx(con, &ssd->dgc); in qemu_spice_display_init_one()
1241 register_displaychangelistener(&ssd->dcl); in qemu_spice_display_init_one()
1247 QemuOpts *opts = QTAILQ_FIRST(&olist->head); in qemu_spice_display_init()