Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/virtio: fix unblank

When going through a disable/enable cycle without changing the
framebuffer the optimization added by commit 3954ff10e06e ("drm/virtio:
skip set_scanout if framebuffer didn't change") causes the screen stay
blank. Add a bool to force an update to fix that.

v2: use drm_atomic_crtc_needs_modeset() (Daniel).

Cc: 1882851@bugs.launchpad.net
Fixes: 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Jiri Slaby <jirislaby@kernel.org>
Tested-by: Diego Viola <diego.viola@gmail.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20200818072511.6745-2-kraxel@redhat.com
(cherry picked from commit 1bc371cd0ec907bab870cacb6e898105f9c41dc8)

+15 -1
+11
drivers/gpu/drm/virtio/virtgpu_display.c
··· 123 123 static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc, 124 124 struct drm_crtc_state *old_state) 125 125 { 126 + struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc); 127 + 128 + /* 129 + * virtio-gpu can't do modeset and plane update operations 130 + * independent from each other. So the actual modeset happens 131 + * in the plane update callback, and here we just check 132 + * whenever we must force the modeset. 133 + */ 134 + if (drm_atomic_crtc_needs_modeset(crtc->state)) { 135 + output->needs_modeset = true; 136 + } 126 137 } 127 138 128 139 static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = {
+1
drivers/gpu/drm/virtio/virtgpu_drv.h
··· 138 138 int cur_x; 139 139 int cur_y; 140 140 bool enabled; 141 + bool needs_modeset; 141 142 }; 142 143 #define drm_crtc_to_virtio_gpu_output(x) \ 143 144 container_of(x, struct virtio_gpu_output, crtc)
+3 -1
drivers/gpu/drm/virtio/virtgpu_plane.c
··· 163 163 plane->state->src_w != old_state->src_w || 164 164 plane->state->src_h != old_state->src_h || 165 165 plane->state->src_x != old_state->src_x || 166 - plane->state->src_y != old_state->src_y) { 166 + plane->state->src_y != old_state->src_y || 167 + output->needs_modeset) { 168 + output->needs_modeset = false; 167 169 DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", 168 170 bo->hw_res_handle, 169 171 plane->state->crtc_w, plane->state->crtc_h,