static void virtio_gpu_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)

{

    VirtIOGPU *g = VIRTIO_GPU(vdev);

    struct virtio_gpu_ctrl_command *cmd;



    if (!virtio_queue_ready(vq)) {

        return;

    }



#ifdef CONFIG_VIRGL

    if (!g->renderer_inited && g->use_virgl_renderer) {

        virtio_gpu_virgl_init(g);

        g->renderer_inited = true;

    }

#endif



    cmd = g_new(struct virtio_gpu_ctrl_command, 1);

    while (virtqueue_pop(vq, &cmd->elem)) {

        cmd->vq = vq;

        cmd->error = 0;

        cmd->finished = false;

        cmd->waiting = false;

        QTAILQ_INSERT_TAIL(&g->cmdq, cmd, next);

        cmd = g_new(struct virtio_gpu_ctrl_command, 1);

    }

    g_free(cmd);



    virtio_gpu_process_cmdq(g);



#ifdef CONFIG_VIRGL

    if (g->use_virgl_renderer) {

        virtio_gpu_virgl_fence_poll(g);

    }

#endif

}

static void virtio_gpu_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)

{

    VirtIOGPU *g = VIRTIO_GPU(vdev);

    struct virtio_gpu_ctrl_command *cmd;



    if (!virtio_queue_ready(vq)) {

        return;

    }



#ifdef CONFIG_VIRGL

    if (!g->renderer_inited && g->use_virgl_renderer) {

        virtio_gpu_virgl_init(g);

        g->renderer_inited = true;

    }

#endif



    cmd = g_new(struct virtio_gpu_ctrl_command, 1);

    while (virtqueue_pop(vq, &cmd->elem)) {

        cmd->vq = vq;

        cmd->error = 0;

        cmd->finished = false;

        cmd->waiting = false;

        QTAILQ_INSERT_TAIL(&g->cmdq, cmd, next);

        cmd = g_new(struct virtio_gpu_ctrl_command, 1);

    }

    g_free(cmd);



    virtio_gpu_process_cmdq(g);



#ifdef CONFIG_VIRGL

    if (g->use_virgl_renderer) {

        virtio_gpu_virgl_fence_poll(g);

    }

#endif

}

static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1)

{

    VirtIOGPU *g = VIRTIO_GPU(VAR_0);

    struct virtio_gpu_ctrl_command *VAR_2;



    if (!virtio_queue_ready(VAR_1)) {

        return;

    }



#ifdef CONFIG_VIRGL

    if (!g->renderer_inited && g->use_virgl_renderer) {

        virtio_gpu_virgl_init(g);

        g->renderer_inited = true;

    }

#endif



    VAR_2 = g_new(struct virtio_gpu_ctrl_command, 1);

    while (virtqueue_pop(VAR_1, &VAR_2->elem)) {

        VAR_2->VAR_1 = VAR_1;

        VAR_2->error = 0;

        VAR_2->finished = false;

        VAR_2->waiting = false;

        QTAILQ_INSERT_TAIL(&g->cmdq, VAR_2, next);

        VAR_2 = g_new(struct virtio_gpu_ctrl_command, 1);

    }

    g_free(VAR_2);



    virtio_gpu_process_cmdq(g);



#ifdef CONFIG_VIRGL

    if (g->use_virgl_renderer) {

        virtio_gpu_virgl_fence_poll(g);

    }

#endif

}

static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1)
{ VirtIOGPU *g = VIRTIO_GPU(VAR_0); struct virtio_gpu_ctrl_command *VAR_2; if (!virtio_queue_ready(VAR_1)) { return; } #ifdef CONFIG_VIRGL
if (!g->renderer_inited && g->use_virgl_renderer) { virtio_gpu_virgl_init(g); g->renderer_inited = true; } #endif
VAR_2 = g_new(struct virtio_gpu_ctrl_command, 1); while (virtqueue_pop(VAR_1, &VAR_2->elem)) { VAR_2->VAR_1 = VAR_1; VAR_2->error = 0; VAR_2->finished = false; VAR_2->waiting = false; QTAILQ_INSERT_TAIL(&g->cmdq, VAR_2, next); VAR_2 = g_new(struct virtio_gpu_ctrl_command, 1); } g_free(VAR_2); virtio_gpu_process_cmdq(g); #ifdef CONFIG_VIRGL
if (g->use_virgl_renderer) { virtio_gpu_virgl_fence_poll(g); } #endif
}