diff mbox

drm/virtio: use old_state when disabling a plane

Message ID 1464652649-18990-1-git-send-email-gustavo@padovan.org (mailing list archive)
State New, archived
Headers show

Commit Message

Gustavo Padovan May 30, 2016, 11:57 p.m. UTC
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

When disabling a plane it current plane->state->crtc is NULL and thus
can't be used to to retrieve the crtc index. In this case we should get
the old_state->crtc and disable the plane on it.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index 70b44a2..ba1b679 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -63,7 +63,7 @@  static void virtio_gpu_plane_atomic_update(struct drm_plane *plane,
 {
 	struct drm_device *dev = plane->dev;
 	struct virtio_gpu_device *vgdev = dev->dev_private;
-	struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(plane->crtc);
+	struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc;
 	struct virtio_gpu_framebuffer *vgfb;
 	struct virtio_gpu_object *bo;
 	uint32_t handle;
@@ -86,7 +86,7 @@  static void virtio_gpu_plane_atomic_update(struct drm_plane *plane,
 	DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d\n", handle,
 		  plane->state->crtc_w, plane->state->crtc_h,
 		  plane->state->crtc_x, plane->state->crtc_y);
-	virtio_gpu_cmd_set_scanout(vgdev, output->index, handle,
+	virtio_gpu_cmd_set_scanout(vgdev, drm_crtc_index(crtc), handle,
 				   plane->state->crtc_w,
 				   plane->state->crtc_h,
 				   plane->state->crtc_x,