Lines Matching refs:cmd

56 vg_cmd_to_string(int cmd)  in vg_cmd_to_string()  argument
58 #define CMD(cmd) [cmd] = #cmd in vg_cmd_to_string() argument
90 if (cmd >= 0 && cmd < G_N_ELEMENTS(vg_cmd_str)) { in vg_cmd_to_string()
91 return vg_cmd_str[cmd]; in vg_cmd_to_string()
232 struct virtio_gpu_ctrl_command *cmd, in vg_ctrl_response() argument
238 if (cmd->cmd_hdr.flags & VIRTIO_GPU_FLAG_FENCE) { in vg_ctrl_response()
240 resp->fence_id = cmd->cmd_hdr.fence_id; in vg_ctrl_response()
241 resp->ctx_id = cmd->cmd_hdr.ctx_id; in vg_ctrl_response()
244 s = iov_from_buf(cmd->elem.in_sg, cmd->elem.in_num, 0, resp, resp_len); in vg_ctrl_response()
249 vu_queue_push(&g->dev.parent, cmd->vq, &cmd->elem, s); in vg_ctrl_response()
250 vu_queue_notify(&g->dev.parent, cmd->vq); in vg_ctrl_response()
251 cmd->state = VG_CMD_STATE_FINISHED; in vg_ctrl_response()
256 struct virtio_gpu_ctrl_command *cmd, in vg_ctrl_response_nodata() argument
263 vg_ctrl_response(g, cmd, &resp, sizeof(resp)); in vg_ctrl_response_nodata()
272 struct virtio_gpu_ctrl_command *cmd = QTAILQ_LAST(&vg->fenceq); in get_display_info_cb() local
275 assert(cmd->cmd_hdr.type == VIRTIO_GPU_CMD_GET_DISPLAY_INFO); in get_display_info_cb()
281 QTAILQ_REMOVE(&vg->fenceq, cmd, next); in get_display_info_cb()
282 vg_ctrl_response(vg, cmd, &dpy_info.hdr, sizeof(dpy_info)); in get_display_info_cb()
291 vg_get_display_info(VuGpu *vg, struct virtio_gpu_ctrl_command *cmd) in vg_get_display_info() argument
303 cmd->state = VG_CMD_STATE_PENDING; in vg_get_display_info()
311 struct virtio_gpu_ctrl_command *cmd = QTAILQ_LAST(&vg->fenceq); in get_edid_cb() local
314 assert(cmd->cmd_hdr.type == VIRTIO_GPU_CMD_GET_EDID); in get_edid_cb()
320 QTAILQ_REMOVE(&vg->fenceq, cmd, next); in get_edid_cb()
321 vg_ctrl_response(vg, cmd, &resp_edid.hdr, sizeof(resp_edid)); in get_edid_cb()
330 vg_get_edid(VuGpu *vg, struct virtio_gpu_ctrl_command *cmd) in vg_get_edid() argument
350 cmd->state = VG_CMD_STATE_PENDING; in vg_get_edid()
355 struct virtio_gpu_ctrl_command *cmd) in vg_resource_create_2d() argument
366 cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; in vg_resource_create_2d()
373 cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; in vg_resource_create_2d()
388 cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; in vg_resource_create_2d()
402 cmd->error = VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY; in vg_resource_create_2d()
460 struct virtio_gpu_ctrl_command *cmd) in vg_resource_unref() argument
472 cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; in vg_resource_unref()
481 struct virtio_gpu_ctrl_command *cmd, in vg_create_mapping_iov() argument
496 s = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, in vg_create_mapping_iov()
525 struct virtio_gpu_ctrl_command *cmd) in vg_resource_attach_backing() argument
538 cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; in vg_resource_attach_backing()
543 cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC; in vg_resource_attach_backing()
547 ret = vg_create_mapping_iov(g, &ab, cmd, &res->iov); in vg_resource_attach_backing()
549 cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC; in vg_resource_attach_backing()
574 struct virtio_gpu_ctrl_command *cmd) in vg_resource_detach_backing() argument
586 cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; in vg_resource_detach_backing()
595 struct virtio_gpu_ctrl_command *cmd) in vg_transfer_to_host_2d() argument
611 cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; in vg_transfer_to_host_2d()
625 cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; in vg_transfer_to_host_2d()
654 struct virtio_gpu_ctrl_command *cmd) in vg_set_scanout() argument
667 cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID; in vg_set_scanout()
681 cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; in vg_set_scanout()
695 cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; in vg_set_scanout()
752 struct virtio_gpu_ctrl_command *cmd) in vg_resource_flush() argument
766 cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; in vg_resource_flush()
780 cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; in vg_resource_flush()
860 vg_process_cmd(VuGpu *vg, struct virtio_gpu_ctrl_command *cmd) in vg_process_cmd() argument
862 switch (cmd->cmd_hdr.type) { in vg_process_cmd()
864 vg_get_display_info(vg, cmd); in vg_process_cmd()
867 vg_resource_create_2d(vg, cmd); in vg_process_cmd()
870 vg_resource_unref(vg, cmd); in vg_process_cmd()
873 vg_resource_flush(vg, cmd); in vg_process_cmd()
876 vg_transfer_to_host_2d(vg, cmd); in vg_process_cmd()
879 vg_set_scanout(vg, cmd); in vg_process_cmd()
882 vg_resource_attach_backing(vg, cmd); in vg_process_cmd()
885 vg_resource_detach_backing(vg, cmd); in vg_process_cmd()
888 vg_get_edid(vg, cmd); in vg_process_cmd()
891 g_warning("TODO handle ctrl %x\n", cmd->cmd_hdr.type); in vg_process_cmd()
892 cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC; in vg_process_cmd()
895 if (cmd->state == VG_CMD_STATE_NEW) { in vg_process_cmd()
896 vg_ctrl_response_nodata(vg, cmd, cmd->error ? cmd->error : in vg_process_cmd()
906 struct virtio_gpu_ctrl_command *cmd = NULL; in vg_handle_ctrl() local
914 cmd = vu_queue_pop(dev, vq, sizeof(struct virtio_gpu_ctrl_command)); in vg_handle_ctrl()
915 if (!cmd) { in vg_handle_ctrl()
918 cmd->vq = vq; in vg_handle_ctrl()
919 cmd->error = 0; in vg_handle_ctrl()
920 cmd->state = VG_CMD_STATE_NEW; in vg_handle_ctrl()
922 len = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, in vg_handle_ctrl()
923 0, &cmd->cmd_hdr, sizeof(cmd->cmd_hdr)); in vg_handle_ctrl()
924 if (len != sizeof(cmd->cmd_hdr)) { in vg_handle_ctrl()
926 __func__, len, sizeof(cmd->cmd_hdr)); in vg_handle_ctrl()
929 virtio_gpu_ctrl_hdr_bswap(&cmd->cmd_hdr); in vg_handle_ctrl()
930 g_debug("%d %s\n", cmd->cmd_hdr.type, in vg_handle_ctrl()
931 vg_cmd_to_string(cmd->cmd_hdr.type)); in vg_handle_ctrl()
934 vg_virgl_process_cmd(vg, cmd); in vg_handle_ctrl()
936 vg_process_cmd(vg, cmd); in vg_handle_ctrl()
939 if (cmd->state != VG_CMD_STATE_FINISHED) { in vg_handle_ctrl()
940 QTAILQ_INSERT_TAIL(&vg->fenceq, cmd, next); in vg_handle_ctrl()
943 free(cmd); in vg_handle_ctrl()