drm/virtio: fix pageflip flush
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 19 Dec 2018 12:27:00 +0000 (13:27 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 8 Jan 2019 11:00:00 +0000 (12:00 +0100)
Sending the flush command only makes sense if we actually have
a framebuffer attached to the scanout (handle != 0).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20181219122708.4586-3-kraxel@redhat.com
drivers/gpu/drm/virtio/virtgpu_plane.c

index ead5c53..548265b 100644 (file)
@@ -130,11 +130,12 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
                                   plane->state->src_h >> 16,
                                   plane->state->src_x >> 16,
                                   plane->state->src_y >> 16);
-       virtio_gpu_cmd_resource_flush(vgdev, handle,
-                                     plane->state->src_x >> 16,
-                                     plane->state->src_y >> 16,
-                                     plane->state->src_w >> 16,
-                                     plane->state->src_h >> 16);
+       if (handle)
+               virtio_gpu_cmd_resource_flush(vgdev, handle,
+                                             plane->state->src_x >> 16,
+                                             plane->state->src_y >> 16,
+                                             plane->state->src_w >> 16,
+                                             plane->state->src_h >> 16);
 }
 
 static int virtio_gpu_cursor_prepare_fb(struct drm_plane *plane,