Lines Matching full:g

119 static void vhost_user_gpu_update_blocked(VhostUserGPU *g, bool blocked);
122 vhost_user_gpu_handle_cursor(VhostUserGPU *g, VhostUserGpuMsg *msg) in vhost_user_gpu_handle_cursor() argument
127 if (pos->scanout_id >= g->parent_obj.conf.max_outputs) { in vhost_user_gpu_handle_cursor()
130 s = &g->parent_obj.scanout[pos->scanout_id]; in vhost_user_gpu_handle_cursor()
152 vhost_user_gpu_send_msg(VhostUserGPU *g, const VhostUserGpuMsg *msg) in vhost_user_gpu_send_msg() argument
154 qemu_chr_fe_write(&g->vhost_chr, (uint8_t *)msg, in vhost_user_gpu_send_msg()
159 vhost_user_gpu_unblock(VhostUserGPU *g) in vhost_user_gpu_unblock() argument
166 vhost_user_gpu_send_msg(g, &msg); in vhost_user_gpu_unblock()
170 vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUserGpuMsg *msg) in vhost_user_gpu_handle_display() argument
187 vhost_user_gpu_send_msg(g, &reply); in vhost_user_gpu_handle_display()
202 virtio_gpu_base_fill_display_info(VIRTIO_GPU_BASE(g), &display_info); in vhost_user_gpu_handle_display()
205 vhost_user_gpu_send_msg(g, &reply); in vhost_user_gpu_handle_display()
217 if (m->scanout_id >= g->parent_obj.conf.max_outputs) { in vhost_user_gpu_handle_display()
223 virtio_gpu_base_generate_edid(VIRTIO_GPU_BASE(g), m->scanout_id, &resp); in vhost_user_gpu_handle_display()
225 vhost_user_gpu_send_msg(g, &reply); in vhost_user_gpu_handle_display()
231 if (m->scanout_id >= g->parent_obj.conf.max_outputs) { in vhost_user_gpu_handle_display()
235 g->parent_obj.enable = 1; in vhost_user_gpu_handle_display()
236 s = &g->parent_obj.scanout[m->scanout_id]; in vhost_user_gpu_handle_display()
251 int fd = qemu_chr_fe_get_msgfd(&g->vhost_chr); in vhost_user_gpu_handle_display()
255 if (m->scanout_id >= g->parent_obj.conf.max_outputs) { in vhost_user_gpu_handle_display()
263 g->parent_obj.enable = 1; in vhost_user_gpu_handle_display()
264 con = g->parent_obj.scanout[m->scanout_id].con; in vhost_user_gpu_handle_display()
265 dmabuf = g->dmabuf[m->scanout_id]; in vhost_user_gpu_handle_display()
275 g->dmabuf[m->scanout_id] = NULL; in vhost_user_gpu_handle_display()
292 g->dmabuf[m->scanout_id] = dmabuf; in vhost_user_gpu_handle_display()
298 if (m->scanout_id >= g->parent_obj.conf.max_outputs || in vhost_user_gpu_handle_display()
299 !g->parent_obj.scanout[m->scanout_id].con) { in vhost_user_gpu_handle_display()
301 vhost_user_gpu_unblock(g); in vhost_user_gpu_handle_display()
305 con = g->parent_obj.scanout[m->scanout_id].con; in vhost_user_gpu_handle_display()
308 vhost_user_gpu_unblock(g); in vhost_user_gpu_handle_display()
311 g->backend_blocked = true; in vhost_user_gpu_handle_display()
319 if (m->scanout_id >= g->parent_obj.conf.max_outputs) { in vhost_user_gpu_handle_display()
322 s = &g->parent_obj.scanout[m->scanout_id]; in vhost_user_gpu_handle_display()
349 vhost_user_gpu_update_blocked(g, true); in vhost_user_gpu_handle_display()
356 VhostUserGPU *g = opaque; in vhost_user_gpu_chr_read() local
362 r = qemu_chr_fe_read_all(&g->vhost_chr, in vhost_user_gpu_chr_read()
369 r = qemu_chr_fe_read_all(&g->vhost_chr, in vhost_user_gpu_chr_read()
376 r = qemu_chr_fe_read_all(&g->vhost_chr, in vhost_user_gpu_chr_read()
385 r = qemu_chr_fe_read_all(&g->vhost_chr, in vhost_user_gpu_chr_read()
399 vhost_user_gpu_handle_cursor(g, msg); in vhost_user_gpu_chr_read()
401 vhost_user_gpu_handle_display(g, msg); in vhost_user_gpu_chr_read()
409 vhost_user_gpu_update_blocked(VhostUserGPU *g, bool blocked) in vhost_user_gpu_update_blocked() argument
411 qemu_set_fd_handler(g->vhost_gpu_fd, in vhost_user_gpu_update_blocked()
412 blocked ? NULL : vhost_user_gpu_chr_read, NULL, g); in vhost_user_gpu_update_blocked()
418 VhostUserGPU *g = VHOST_USER_GPU(b); in vhost_user_gpu_gl_flushed() local
420 if (g->backend_blocked) { in vhost_user_gpu_gl_flushed()
421 vhost_user_gpu_unblock(g); in vhost_user_gpu_gl_flushed()
422 g->backend_blocked = false; in vhost_user_gpu_gl_flushed()
425 vhost_user_gpu_update_blocked(g, false); in vhost_user_gpu_gl_flushed()
429 vhost_user_gpu_do_set_socket(VhostUserGPU *g, Error **errp) in vhost_user_gpu_do_set_socket() argument
444 if (!qemu_chr_fe_init(&g->vhost_chr, chr, errp)) { in vhost_user_gpu_do_set_socket()
447 if (vhost_user_gpu_set_socket(&g->vhost->dev, sv[1]) < 0) { in vhost_user_gpu_do_set_socket()
449 qemu_chr_fe_deinit(&g->vhost_chr, false); in vhost_user_gpu_do_set_socket()
453 g->vhost_gpu_fd = sv[0]; in vhost_user_gpu_do_set_socket()
454 vhost_user_gpu_update_blocked(g, false); in vhost_user_gpu_do_set_socket()
470 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_get_config() local
479 ret = vhost_dev_get_config(&g->vhost->dev, in vhost_user_gpu_get_config()
497 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_set_config() local
507 ret = vhost_dev_set_config(&g->vhost->dev, config_data, in vhost_user_gpu_set_config()
519 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_set_status() local
523 if (!vhost_user_gpu_do_set_socket(g, &err)) { in vhost_user_gpu_set_status()
527 vhost_user_backend_start(g->vhost); in vhost_user_gpu_set_status()
530 if (g->vhost_gpu_fd != -1) { in vhost_user_gpu_set_status()
531 vhost_user_gpu_update_blocked(g, true); in vhost_user_gpu_set_status()
532 qemu_chr_fe_deinit(&g->vhost_chr, true); in vhost_user_gpu_set_status()
533 g->vhost_gpu_fd = -1; in vhost_user_gpu_set_status()
535 vhost_user_backend_stop(g->vhost); in vhost_user_gpu_set_status()
542 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_guest_notifier_pending() local
553 return vhost_virtqueue_pending(&g->vhost->dev, idx); in vhost_user_gpu_guest_notifier_pending()
559 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_guest_notifier_mask() local
570 vhost_virtqueue_mask(&g->vhost->dev, vdev, idx, mask); in vhost_user_gpu_guest_notifier_mask()
576 VhostUserGPU *g = VHOST_USER_GPU(obj); in vhost_user_gpu_instance_init() local
578 g->vhost = VHOST_USER_BACKEND(object_new(TYPE_VHOST_USER_BACKEND)); in vhost_user_gpu_instance_init()
580 OBJECT(g->vhost), "chardev"); in vhost_user_gpu_instance_init()
586 VhostUserGPU *g = VHOST_USER_GPU(obj); in vhost_user_gpu_instance_finalize() local
588 object_unref(OBJECT(g->vhost)); in vhost_user_gpu_instance_finalize()
594 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_reset() local
598 vhost_user_backend_stop(g->vhost); in vhost_user_gpu_reset()
615 VhostUserGPU *g = VHOST_USER_GPU(qdev); in vhost_user_gpu_device_realize() local
616 VirtIODevice *vdev = VIRTIO_DEVICE(g); in vhost_user_gpu_device_realize()
618 vhost_dev_set_config_notifier(&g->vhost->dev, &config_ops); in vhost_user_gpu_device_realize()
619 if (vhost_user_backend_dev_init(g->vhost, vdev, 2, errp) < 0) { in vhost_user_gpu_device_realize()
624 g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_DMABUF_ENABLED; in vhost_user_gpu_device_realize()
625 if (virtio_has_feature(g->vhost->dev.features, VIRTIO_GPU_F_VIRGL)) { in vhost_user_gpu_device_realize()
626 g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_VIRGL_ENABLED; in vhost_user_gpu_device_realize()
628 if (virtio_has_feature(g->vhost->dev.features, VIRTIO_GPU_F_EDID)) { in vhost_user_gpu_device_realize()
629 g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_EDID_ENABLED; in vhost_user_gpu_device_realize()
632 g->parent_obj.conf.flags &= ~(1 << VIRTIO_GPU_FLAG_EDID_ENABLED); in vhost_user_gpu_device_realize()
639 g->vhost_gpu_fd = -1; in vhost_user_gpu_device_realize()
644 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_get_vhost() local
645 return g->vhost ? &g->vhost->dev : NULL; in vhost_user_gpu_get_vhost()