Merge v5.9-rc5 into drm-next
[linux-block.git] / drivers / gpu / drm / virtio / virtgpu_display.c
index 2c2742b8d6570e274cb7d8b791776370b93d8dd6..effea07abe62d98b73c3f8ed5c36acdb2f7618fd 100644 (file)
@@ -97,9 +97,6 @@ static void virtio_gpu_crtc_mode_set_nofb(struct drm_crtc *crtc)
 static void virtio_gpu_crtc_atomic_enable(struct drm_crtc *crtc,
                                          struct drm_crtc_state *old_state)
 {
-       struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
-
-       output->enabled = true;
 }
 
 static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc,
@@ -111,7 +108,6 @@ static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc,
 
        virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, 0, 0, 0, 0);
        virtio_gpu_notify(vgdev);
-       output->enabled = false;
 }
 
 static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc,
@@ -123,6 +119,17 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc,
 static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc,
                                         struct drm_crtc_state *old_state)
 {
+       struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
+
+       /*
+        * virtio-gpu can't do modeset and plane update operations
+        * independent from each other.  So the actual modeset happens
+        * in the plane update callback, and here we just check
+        * whenever we must force the modeset.
+        */
+       if (drm_atomic_crtc_needs_modeset(crtc->state)) {
+               output->needs_modeset = true;
+       }
 }
 
 static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = {