Skip to content

Commit c6016c6

Browse files
committed
drm/virtio: fix unblank
When going through a disable/enable cycle without changing the framebuffer the optimization added by commit 3954ff1 ("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: [email protected] Fixes: 3954ff1 ("drm/virtio: skip set_scanout if framebuffer didn't change") Signed-off-by: Gerd Hoffmann <[email protected]> Tested-by: Jiri Slaby <[email protected]> Tested-by: Diego Viola <[email protected]> Acked-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 1bc371c)
1 parent 6546d28 commit c6016c6

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

drivers/gpu/drm/virtio/virtgpu_display.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc,
123123
static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc,
124124
struct drm_crtc_state *old_state)
125125
{
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+
}
126137
}
127138

128139
static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = {

drivers/gpu/drm/virtio/virtgpu_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ struct virtio_gpu_output {
138138
int cur_x;
139139
int cur_y;
140140
bool enabled;
141+
bool needs_modeset;
141142
};
142143
#define drm_crtc_to_virtio_gpu_output(x) \
143144
container_of(x, struct virtio_gpu_output, crtc)

drivers/gpu/drm/virtio/virtgpu_plane.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
163163
plane->state->src_w != old_state->src_w ||
164164
plane->state->src_h != old_state->src_h ||
165165
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;
167169
DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n",
168170
bo->hw_res_handle,
169171
plane->state->crtc_w, plane->state->crtc_h,

0 commit comments

Comments
 (0)