[PATCH] drm/virtio: use old_state when disabling a plane

Gustavo Padovan gustavo at padovan.org
Mon May 30 23:57:29 UTC 2016


From: Gustavo Padovan <gustavo.padovan at 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 at collabora.co.uk>
---
 drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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,
-- 
2.5.5



More information about the dri-devel mailing list