Skip to content

Commit 3954ff1

Browse files
committed
drm/virtio: skip set_scanout if framebuffer didn't change
v2: also check src rect (Chia-I Wu). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Chia-I Wu <olvaffe@gmail.com> Link: http://patchwork.freedesktop.org/patch/msgid/20191212125346.8334-2-kraxel@redhat.com
1 parent 4ad7056 commit 3954ff1

1 file changed

Lines changed: 21 additions & 14 deletions

File tree

‎drivers/gpu/drm/virtio/virtgpu_plane.c‎

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -151,20 +151,27 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
151151
if (bo->dumb)
152152
virtio_gpu_update_dumb_bo(vgdev, bo, plane->state);
153153

154-
DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n",
155-
bo->hw_res_handle,
156-
plane->state->crtc_w, plane->state->crtc_h,
157-
plane->state->crtc_x, plane->state->crtc_y,
158-
plane->state->src_w >> 16,
159-
plane->state->src_h >> 16,
160-
plane->state->src_x >> 16,
161-
plane->state->src_y >> 16);
162-
virtio_gpu_cmd_set_scanout(vgdev, output->index,
163-
bo->hw_res_handle,
164-
plane->state->src_w >> 16,
165-
plane->state->src_h >> 16,
166-
plane->state->src_x >> 16,
167-
plane->state->src_y >> 16);
154+
if (plane->state->fb != old_state->fb ||
155+
plane->state->src_w != old_state->src_w ||
156+
plane->state->src_h != old_state->src_h ||
157+
plane->state->src_x != old_state->src_x ||
158+
plane->state->src_y != old_state->src_y) {
159+
DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n",
160+
bo->hw_res_handle,
161+
plane->state->crtc_w, plane->state->crtc_h,
162+
plane->state->crtc_x, plane->state->crtc_y,
163+
plane->state->src_w >> 16,
164+
plane->state->src_h >> 16,
165+
plane->state->src_x >> 16,
166+
plane->state->src_y >> 16);
167+
virtio_gpu_cmd_set_scanout(vgdev, output->index,
168+
bo->hw_res_handle,
169+
plane->state->src_w >> 16,
170+
plane->state->src_h >> 16,
171+
plane->state->src_x >> 16,
172+
plane->state->src_y >> 16);
173+
}
174+
168175
virtio_gpu_cmd_resource_flush(vgdev, bo->hw_res_handle,
169176
plane->state->src_x >> 16,
170177
plane->state->src_y >> 16,

0 commit comments

Comments
 (0)