This should avoid issues with the fbdev path trying to render
before we've gotten the display info.
Signed-off-by: Dave Airlie <airlied@redhat.com>
[ kraxel: wait for display-info reply ]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
        wait_queue_head_t resp_wq;
        /* current display info */
        spinlock_t display_info_lock;
+       bool display_info_pending;
 
        struct virtio_gpu_fence_driver fence_drv;
 
 
        virtio_device_ready(vgdev->vdev);
        vgdev->vqs_ready = true;
 
+       virtio_gpu_cmd_get_display_info(vgdev);
+       wait_event_timeout(vgdev->resp_wq, !vgdev->display_info_pending,
+                          5 * HZ);
        if (virtio_gpu_fbdev)
                virtio_gpu_fbdev_init(vgdev);
-       virtio_gpu_cmd_get_display_info(vgdev);
 
        return 0;
 
 
                }
        }
 
+       vgdev->display_info_pending = false;
        spin_unlock(&vgdev->display_info_lock);
        wake_up(&vgdev->resp_wq);
 
                 resp_buf);
        memset(cmd_p, 0, sizeof(*cmd_p));
 
+       vgdev->display_info_pending = true;
        cmd_p->type = cpu_to_le32(VIRTIO_GPU_CMD_GET_DISPLAY_INFO);
        virtio_gpu_queue_ctrl_buffer(vgdev, vbuf);
        return 0;