Lines Matching refs:g

33 static void virgl_cmd_create_resource_2d(VirtIOGPU *g,  in virgl_cmd_create_resource_2d()  argument
57 static void virgl_cmd_create_resource_3d(VirtIOGPU *g, in virgl_cmd_create_resource_3d() argument
81 static void virgl_cmd_resource_unref(VirtIOGPU *g, in virgl_cmd_resource_unref() argument
95 virtio_gpu_cleanup_mapping_iov(g, res_iovs, num_iovs); in virgl_cmd_resource_unref()
100 static void virgl_cmd_context_create(VirtIOGPU *g, in virgl_cmd_context_create() argument
113 static void virgl_cmd_context_destroy(VirtIOGPU *g, in virgl_cmd_context_destroy() argument
124 static void virtio_gpu_rect_update(VirtIOGPU *g, int idx, int x, int y, in virtio_gpu_rect_update() argument
127 if (!g->parent_obj.scanout[idx].con) { in virtio_gpu_rect_update()
131 dpy_gl_update(g->parent_obj.scanout[idx].con, x, y, width, height); in virtio_gpu_rect_update()
134 static void virgl_cmd_resource_flush(VirtIOGPU *g, in virgl_cmd_resource_flush() argument
144 for (i = 0; i < g->parent_obj.conf.max_outputs; i++) { in virgl_cmd_resource_flush()
145 if (g->parent_obj.scanout[i].resource_id != rf.resource_id) { in virgl_cmd_resource_flush()
148 virtio_gpu_rect_update(g, i, rf.r.x, rf.r.y, rf.r.width, rf.r.height); in virgl_cmd_resource_flush()
152 static void virgl_cmd_set_scanout(VirtIOGPU *g, in virgl_cmd_set_scanout() argument
162 if (ss.scanout_id >= g->parent_obj.conf.max_outputs) { in virgl_cmd_set_scanout()
168 g->parent_obj.enable = 1; in virgl_cmd_set_scanout()
191 qemu_console_resize(g->parent_obj.scanout[ss.scanout_id].con, in virgl_cmd_set_scanout()
195 g->parent_obj.scanout[ss.scanout_id].con, info.tex_id, in virgl_cmd_set_scanout()
202 g->parent_obj.scanout[ss.scanout_id].con, NULL); in virgl_cmd_set_scanout()
203 dpy_gl_scanout_disable(g->parent_obj.scanout[ss.scanout_id].con); in virgl_cmd_set_scanout()
205 g->parent_obj.scanout[ss.scanout_id].resource_id = ss.resource_id; in virgl_cmd_set_scanout()
208 static void virgl_cmd_submit_3d(VirtIOGPU *g, in virgl_cmd_submit_3d() argument
228 if (virtio_gpu_stats_enabled(g->parent_obj.conf)) { in virgl_cmd_submit_3d()
229 g->stats.req_3d++; in virgl_cmd_submit_3d()
230 g->stats.bytes_3d += cs.size; in virgl_cmd_submit_3d()
239 static void virgl_cmd_transfer_to_host_2d(VirtIOGPU *g, in virgl_cmd_transfer_to_host_2d() argument
264 static void virgl_cmd_transfer_to_host_3d(VirtIOGPU *g, in virgl_cmd_transfer_to_host_3d() argument
282 virgl_cmd_transfer_from_host_3d(VirtIOGPU *g, in virgl_cmd_transfer_from_host_3d() argument
300 static void virgl_resource_attach_backing(VirtIOGPU *g, in virgl_resource_attach_backing() argument
311 ret = virtio_gpu_create_mapping_iov(g, att_rb.nr_entries, sizeof(att_rb), in virgl_resource_attach_backing()
322 virtio_gpu_cleanup_mapping_iov(g, res_iovs, res_niov); in virgl_resource_attach_backing()
325 static void virgl_resource_detach_backing(VirtIOGPU *g, in virgl_resource_detach_backing() argument
341 virtio_gpu_cleanup_mapping_iov(g, res_iovs, num_iovs); in virgl_resource_detach_backing()
345 static void virgl_cmd_ctx_attach_resource(VirtIOGPU *g, in virgl_cmd_ctx_attach_resource() argument
357 static void virgl_cmd_ctx_detach_resource(VirtIOGPU *g, in virgl_cmd_ctx_detach_resource() argument
369 static void virgl_cmd_get_capset_info(VirtIOGPU *g, in virgl_cmd_get_capset_info() argument
393 virtio_gpu_ctrl_response(g, cmd, &resp.hdr, sizeof(resp)); in virgl_cmd_get_capset_info()
396 static void virgl_cmd_get_capset(VirtIOGPU *g, in virgl_cmd_get_capset() argument
416 virtio_gpu_ctrl_response(g, cmd, &resp->hdr, sizeof(*resp) + max_size); in virgl_cmd_get_capset()
420 void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, in virtio_gpu_virgl_process_cmd() argument
428 virgl_cmd_context_create(g, cmd); in virtio_gpu_virgl_process_cmd()
431 virgl_cmd_context_destroy(g, cmd); in virtio_gpu_virgl_process_cmd()
434 virgl_cmd_create_resource_2d(g, cmd); in virtio_gpu_virgl_process_cmd()
437 virgl_cmd_create_resource_3d(g, cmd); in virtio_gpu_virgl_process_cmd()
440 virgl_cmd_submit_3d(g, cmd); in virtio_gpu_virgl_process_cmd()
443 virgl_cmd_transfer_to_host_2d(g, cmd); in virtio_gpu_virgl_process_cmd()
446 virgl_cmd_transfer_to_host_3d(g, cmd); in virtio_gpu_virgl_process_cmd()
449 virgl_cmd_transfer_from_host_3d(g, cmd); in virtio_gpu_virgl_process_cmd()
452 virgl_resource_attach_backing(g, cmd); in virtio_gpu_virgl_process_cmd()
455 virgl_resource_detach_backing(g, cmd); in virtio_gpu_virgl_process_cmd()
458 virgl_cmd_set_scanout(g, cmd); in virtio_gpu_virgl_process_cmd()
461 virgl_cmd_resource_flush(g, cmd); in virtio_gpu_virgl_process_cmd()
464 virgl_cmd_resource_unref(g, cmd); in virtio_gpu_virgl_process_cmd()
468 virgl_cmd_ctx_attach_resource(g, cmd); in virtio_gpu_virgl_process_cmd()
472 virgl_cmd_ctx_detach_resource(g, cmd); in virtio_gpu_virgl_process_cmd()
475 virgl_cmd_get_capset_info(g, cmd); in virtio_gpu_virgl_process_cmd()
478 virgl_cmd_get_capset(g, cmd); in virtio_gpu_virgl_process_cmd()
481 virtio_gpu_get_display_info(g, cmd); in virtio_gpu_virgl_process_cmd()
484 virtio_gpu_get_edid(g, cmd); in virtio_gpu_virgl_process_cmd()
497 virtio_gpu_ctrl_response_nodata(g, cmd, cmd->error); in virtio_gpu_virgl_process_cmd()
501 virtio_gpu_ctrl_response_nodata(g, cmd, VIRTIO_GPU_RESP_OK_NODATA); in virtio_gpu_virgl_process_cmd()
511 VirtIOGPU *g = opaque; in virgl_write_fence() local
514 QTAILQ_FOREACH_SAFE(cmd, &g->fenceq, next, tmp) { in virgl_write_fence()
523 virtio_gpu_ctrl_response_nodata(g, cmd, VIRTIO_GPU_RESP_OK_NODATA); in virgl_write_fence()
524 QTAILQ_REMOVE(&g->fenceq, cmd, next); in virgl_write_fence()
526 g->inflight--; in virgl_write_fence()
527 if (virtio_gpu_stats_enabled(g->parent_obj.conf)) { in virgl_write_fence()
528 fprintf(stderr, "inflight: %3d (-)\r", g->inflight); in virgl_write_fence()
537 VirtIOGPU *g = opaque; in virgl_create_context() local
544 ctx = dpy_gl_ctx_create(g->parent_obj.scanout[scanout_idx].con, &qparams); in virgl_create_context()
550 VirtIOGPU *g = opaque; in virgl_destroy_context() local
553 dpy_gl_ctx_destroy(g->parent_obj.scanout[0].con, qctx); in virgl_destroy_context()
559 VirtIOGPU *g = opaque; in virgl_make_context_current() local
562 return dpy_gl_ctx_make_current(g->parent_obj.scanout[scanout_idx].con, in virgl_make_context_current()
576 VirtIOGPU *g = opaque; in virtio_gpu_print_stats() local
578 if (g->stats.requests) { in virtio_gpu_print_stats()
580 g->stats.requests, in virtio_gpu_print_stats()
581 g->stats.max_inflight, in virtio_gpu_print_stats()
582 g->stats.req_3d, in virtio_gpu_print_stats()
583 g->stats.bytes_3d); in virtio_gpu_print_stats()
584 g->stats.requests = 0; in virtio_gpu_print_stats()
585 g->stats.max_inflight = 0; in virtio_gpu_print_stats()
586 g->stats.req_3d = 0; in virtio_gpu_print_stats()
587 g->stats.bytes_3d = 0; in virtio_gpu_print_stats()
591 timer_mod(g->print_stats, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 1000); in virtio_gpu_print_stats()
596 VirtIOGPU *g = opaque; in virtio_gpu_fence_poll() local
599 virtio_gpu_process_cmdq(g); in virtio_gpu_fence_poll()
600 if (!QTAILQ_EMPTY(&g->cmdq) || !QTAILQ_EMPTY(&g->fenceq)) { in virtio_gpu_fence_poll()
601 timer_mod(g->fence_poll, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 10); in virtio_gpu_fence_poll()
605 void virtio_gpu_virgl_fence_poll(VirtIOGPU *g) in virtio_gpu_virgl_fence_poll() argument
607 virtio_gpu_fence_poll(g); in virtio_gpu_virgl_fence_poll()
610 void virtio_gpu_virgl_reset_scanout(VirtIOGPU *g) in virtio_gpu_virgl_reset_scanout() argument
614 for (i = 0; i < g->parent_obj.conf.max_outputs; i++) { in virtio_gpu_virgl_reset_scanout()
615 dpy_gfx_replace_surface(g->parent_obj.scanout[i].con, NULL); in virtio_gpu_virgl_reset_scanout()
616 dpy_gl_scanout_disable(g->parent_obj.scanout[i].con); in virtio_gpu_virgl_reset_scanout()
620 void virtio_gpu_virgl_reset(VirtIOGPU *g) in virtio_gpu_virgl_reset() argument
625 int virtio_gpu_virgl_init(VirtIOGPU *g) in virtio_gpu_virgl_init() argument
642 ret = virgl_renderer_init(g, flags, &virtio_gpu_3d_cbs); in virtio_gpu_virgl_init()
648 g->fence_poll = timer_new_ms(QEMU_CLOCK_VIRTUAL, in virtio_gpu_virgl_init()
649 virtio_gpu_fence_poll, g); in virtio_gpu_virgl_init()
651 if (virtio_gpu_stats_enabled(g->parent_obj.conf)) { in virtio_gpu_virgl_init()
652 g->print_stats = timer_new_ms(QEMU_CLOCK_VIRTUAL, in virtio_gpu_virgl_init()
653 virtio_gpu_print_stats, g); in virtio_gpu_virgl_init()
654 timer_mod(g->print_stats, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 1000); in virtio_gpu_virgl_init()
659 int virtio_gpu_virgl_get_num_capsets(VirtIOGPU *g) in virtio_gpu_virgl_get_num_capsets() argument