From: Dave Airlie Date: Tue, 16 Jun 2015 04:25:34 +0000 (+1000) Subject: drm/virtgpu: initialise fbdev after getting initial display info X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=441012aff674c8d2d9b371e1a19320de38eecc84;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/virtgpu: initialise fbdev after getting initial display info This should avoid issues with the fbdev path trying to render before we've gotten the display info. Signed-off-by: Dave Airlie [ kraxel: wait for display-info reply ] Signed-off-by: Gerd Hoffmann --- diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index e5a2c092460b..ff8de3d6f0b2 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -171,6 +171,7 @@ struct virtio_gpu_device { 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; diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c index 132405f15389..782766c00d70 100644 --- a/drivers/gpu/drm/virtio/virtgpu_kms.c +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c @@ -137,9 +137,11 @@ int virtio_gpu_driver_load(struct drm_device *dev, unsigned long flags) 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; diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index 8fa6513eb3bc..c5067926401f 100644 --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -534,6 +534,7 @@ static void virtio_gpu_cmd_get_display_info_cb(struct virtio_gpu_device *vgdev, } } + vgdev->display_info_pending = false; spin_unlock(&vgdev->display_info_lock); wake_up(&vgdev->resp_wq); @@ -558,6 +559,7 @@ int virtio_gpu_cmd_get_display_info(struct virtio_gpu_device *vgdev) 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;