Lines Matching full:g
120 static void vhost_user_gpu_update_blocked(VhostUserGPU *g, bool blocked);
123 vhost_user_gpu_handle_cursor(VhostUserGPU *g, VhostUserGpuMsg *msg) in vhost_user_gpu_handle_cursor() argument
128 if (pos->scanout_id >= g->parent_obj.conf.max_outputs) { in vhost_user_gpu_handle_cursor()
131 s = &g->parent_obj.scanout[pos->scanout_id]; in vhost_user_gpu_handle_cursor()
153 vhost_user_gpu_send_msg(VhostUserGPU *g, const VhostUserGpuMsg *msg) in vhost_user_gpu_send_msg() argument
155 qemu_chr_fe_write(&g->vhost_chr, (uint8_t *)msg, in vhost_user_gpu_send_msg()
160 vhost_user_gpu_unblock(VhostUserGPU *g) in vhost_user_gpu_unblock() argument
167 vhost_user_gpu_send_msg(g, &msg); in vhost_user_gpu_unblock()
171 vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUserGpuMsg *msg) in vhost_user_gpu_handle_display() argument
188 vhost_user_gpu_send_msg(g, &reply); in vhost_user_gpu_handle_display()
203 virtio_gpu_base_fill_display_info(VIRTIO_GPU_BASE(g), &display_info); in vhost_user_gpu_handle_display()
206 vhost_user_gpu_send_msg(g, &reply); in vhost_user_gpu_handle_display()
218 if (m->scanout_id >= g->parent_obj.conf.max_outputs) { in vhost_user_gpu_handle_display()
224 virtio_gpu_base_generate_edid(VIRTIO_GPU_BASE(g), m->scanout_id, &resp); in vhost_user_gpu_handle_display()
226 vhost_user_gpu_send_msg(g, &reply); in vhost_user_gpu_handle_display()
232 if (m->scanout_id >= g->parent_obj.conf.max_outputs) { in vhost_user_gpu_handle_display()
236 g->parent_obj.enable = 1; in vhost_user_gpu_handle_display()
237 s = &g->parent_obj.scanout[m->scanout_id]; in vhost_user_gpu_handle_display()
252 int fd = qemu_chr_fe_get_msgfd(&g->vhost_chr); in vhost_user_gpu_handle_display()
258 if (m->scanout_id >= g->parent_obj.conf.max_outputs) { in vhost_user_gpu_handle_display()
266 g->parent_obj.enable = 1; in vhost_user_gpu_handle_display()
267 con = g->parent_obj.scanout[m->scanout_id].con; in vhost_user_gpu_handle_display()
268 dmabuf = g->dmabuf[m->scanout_id]; in vhost_user_gpu_handle_display()
278 g->dmabuf[m->scanout_id] = NULL; in vhost_user_gpu_handle_display()
295 g->dmabuf[m->scanout_id] = dmabuf; in vhost_user_gpu_handle_display()
301 if (m->scanout_id >= g->parent_obj.conf.max_outputs || in vhost_user_gpu_handle_display()
302 !g->parent_obj.scanout[m->scanout_id].con) { in vhost_user_gpu_handle_display()
304 vhost_user_gpu_unblock(g); in vhost_user_gpu_handle_display()
308 con = g->parent_obj.scanout[m->scanout_id].con; in vhost_user_gpu_handle_display()
311 vhost_user_gpu_unblock(g); in vhost_user_gpu_handle_display()
314 g->backend_blocked = true; in vhost_user_gpu_handle_display()
322 if (m->scanout_id >= g->parent_obj.conf.max_outputs) { in vhost_user_gpu_handle_display()
325 s = &g->parent_obj.scanout[m->scanout_id]; in vhost_user_gpu_handle_display()
352 vhost_user_gpu_update_blocked(g, true); in vhost_user_gpu_handle_display()
359 VhostUserGPU *g = opaque; in vhost_user_gpu_chr_read() local
365 r = qemu_chr_fe_read_all(&g->vhost_chr, in vhost_user_gpu_chr_read()
372 r = qemu_chr_fe_read_all(&g->vhost_chr, in vhost_user_gpu_chr_read()
379 r = qemu_chr_fe_read_all(&g->vhost_chr, in vhost_user_gpu_chr_read()
388 r = qemu_chr_fe_read_all(&g->vhost_chr, in vhost_user_gpu_chr_read()
402 vhost_user_gpu_handle_cursor(g, msg); in vhost_user_gpu_chr_read()
404 vhost_user_gpu_handle_display(g, msg); in vhost_user_gpu_chr_read()
412 vhost_user_gpu_update_blocked(VhostUserGPU *g, bool blocked) in vhost_user_gpu_update_blocked() argument
414 qemu_set_fd_handler(g->vhost_gpu_fd, in vhost_user_gpu_update_blocked()
415 blocked ? NULL : vhost_user_gpu_chr_read, NULL, g); in vhost_user_gpu_update_blocked()
421 VhostUserGPU *g = VHOST_USER_GPU(b); in vhost_user_gpu_gl_flushed() local
423 if (g->backend_blocked) { in vhost_user_gpu_gl_flushed()
424 vhost_user_gpu_unblock(g); in vhost_user_gpu_gl_flushed()
425 g->backend_blocked = false; in vhost_user_gpu_gl_flushed()
428 vhost_user_gpu_update_blocked(g, false); in vhost_user_gpu_gl_flushed()
432 vhost_user_gpu_do_set_socket(VhostUserGPU *g, Error **errp) in vhost_user_gpu_do_set_socket() argument
447 if (!qemu_chr_fe_init(&g->vhost_chr, chr, errp)) { in vhost_user_gpu_do_set_socket()
450 if (vhost_user_gpu_set_socket(&g->vhost->dev, sv[1]) < 0) { in vhost_user_gpu_do_set_socket()
452 qemu_chr_fe_deinit(&g->vhost_chr, false); in vhost_user_gpu_do_set_socket()
456 g->vhost_gpu_fd = sv[0]; in vhost_user_gpu_do_set_socket()
457 vhost_user_gpu_update_blocked(g, false); in vhost_user_gpu_do_set_socket()
473 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_get_config() local
482 ret = vhost_dev_get_config(&g->vhost->dev, in vhost_user_gpu_get_config()
500 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_set_config() local
510 ret = vhost_dev_set_config(&g->vhost->dev, config_data, in vhost_user_gpu_set_config()
522 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_set_status() local
526 if (!vhost_user_gpu_do_set_socket(g, &err)) { in vhost_user_gpu_set_status()
530 vhost_user_backend_start(g->vhost); in vhost_user_gpu_set_status()
535 if (g->vhost_gpu_fd != -1) { in vhost_user_gpu_set_status()
536 vhost_user_gpu_update_blocked(g, true); in vhost_user_gpu_set_status()
537 qemu_chr_fe_deinit(&g->vhost_chr, true); in vhost_user_gpu_set_status()
538 g->vhost_gpu_fd = -1; in vhost_user_gpu_set_status()
540 ret = vhost_user_backend_stop(g->vhost); in vhost_user_gpu_set_status()
551 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_guest_notifier_pending() local
562 return vhost_virtqueue_pending(&g->vhost->dev, idx); in vhost_user_gpu_guest_notifier_pending()
568 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_guest_notifier_mask() local
579 vhost_virtqueue_mask(&g->vhost->dev, vdev, idx, mask); in vhost_user_gpu_guest_notifier_mask()
585 VhostUserGPU *g = VHOST_USER_GPU(obj); in vhost_user_gpu_instance_init() local
587 g->vhost = VHOST_USER_BACKEND(object_new(TYPE_VHOST_USER_BACKEND)); in vhost_user_gpu_instance_init()
589 OBJECT(g->vhost), "chardev"); in vhost_user_gpu_instance_init()
595 VhostUserGPU *g = VHOST_USER_GPU(obj); in vhost_user_gpu_instance_finalize() local
597 object_unref(OBJECT(g->vhost)); in vhost_user_gpu_instance_finalize()
603 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_reset() local
607 vhost_user_backend_stop(g->vhost); in vhost_user_gpu_reset()
624 VhostUserGPU *g = VHOST_USER_GPU(qdev); in vhost_user_gpu_device_realize() local
625 VirtIODevice *vdev = VIRTIO_DEVICE(g); in vhost_user_gpu_device_realize()
627 vhost_dev_set_config_notifier(&g->vhost->dev, &config_ops); in vhost_user_gpu_device_realize()
628 if (vhost_user_backend_dev_init(g->vhost, vdev, 2, errp) < 0) { in vhost_user_gpu_device_realize()
633 g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_DMABUF_ENABLED; in vhost_user_gpu_device_realize()
634 if (virtio_has_feature(g->vhost->dev.features, VIRTIO_GPU_F_VIRGL)) { in vhost_user_gpu_device_realize()
635 g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_VIRGL_ENABLED; in vhost_user_gpu_device_realize()
637 if (virtio_has_feature(g->vhost->dev.features, VIRTIO_GPU_F_EDID)) { in vhost_user_gpu_device_realize()
638 g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_EDID_ENABLED; in vhost_user_gpu_device_realize()
641 g->parent_obj.conf.flags &= ~(1 << VIRTIO_GPU_FLAG_EDID_ENABLED); in vhost_user_gpu_device_realize()
643 if (virtio_has_feature(g->vhost->dev.features, in vhost_user_gpu_device_realize()
645 g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_RESOURCE_UUID_ENABLED; in vhost_user_gpu_device_realize()
647 if (virtio_has_feature(g->vhost->dev.features, in vhost_user_gpu_device_realize()
649 g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_RESOURCE_UUID_ENABLED; in vhost_user_gpu_device_realize()
656 g->vhost_gpu_fd = -1; in vhost_user_gpu_device_realize()
661 VhostUserGPU *g = VHOST_USER_GPU(vdev); in vhost_user_gpu_get_vhost() local
662 return g->vhost ? &g->vhost->dev : NULL; in vhost_user_gpu_get_vhost()