Commit 790bcd79 authored by Gerd Hoffmann's avatar Gerd Hoffmann

drm/virtio: batch plane updates (pageflip)

Move virtio_gpu_notify() to higher-level functions for
virtio_gpu_cmd_resource_flush(), virtio_gpu_cmd_set_scanout() and
virtio_gpu_cmd_transfer_to_host_{2d,3d}().

virtio_gpu_primary_plane_update() will notify only once for a series
of commands (restores plane update command batching).
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Reviewed-by: default avatarChia-I Wu <olvaffe@gmail.com>
Reviewed-by: default avatarGurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20200214125535.26349-4-kraxel@redhat.com
parent fcdd19b8
...@@ -90,6 +90,7 @@ static void virtio_gpu_crtc_mode_set_nofb(struct drm_crtc *crtc) ...@@ -90,6 +90,7 @@ static void virtio_gpu_crtc_mode_set_nofb(struct drm_crtc *crtc)
virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, virtio_gpu_cmd_set_scanout(vgdev, output->index, 0,
crtc->mode.hdisplay, crtc->mode.hdisplay,
crtc->mode.vdisplay, 0, 0); crtc->mode.vdisplay, 0, 0);
virtio_gpu_notify(vgdev);
} }
static void virtio_gpu_crtc_atomic_enable(struct drm_crtc *crtc, static void virtio_gpu_crtc_atomic_enable(struct drm_crtc *crtc,
...@@ -108,6 +109,7 @@ static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc, ...@@ -108,6 +109,7 @@ static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc,
struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc); struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, 0, 0, 0, 0); virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, 0, 0, 0, 0);
virtio_gpu_notify(vgdev);
output->enabled = false; output->enabled = false;
} }
......
...@@ -359,6 +359,7 @@ static int virtio_gpu_transfer_to_host_ioctl(struct drm_device *dev, void *data, ...@@ -359,6 +359,7 @@ static int virtio_gpu_transfer_to_host_ioctl(struct drm_device *dev, void *data,
args->level, &args->box, objs, fence); args->level, &args->box, objs, fence);
dma_fence_put(&fence->f); dma_fence_put(&fence->f);
} }
virtio_gpu_notify(vgdev);
return 0; return 0;
err_unlock: err_unlock:
......
...@@ -148,6 +148,7 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, ...@@ -148,6 +148,7 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
plane->state->src_w >> 16, plane->state->src_w >> 16,
plane->state->src_h >> 16, plane->state->src_h >> 16,
0, 0); 0, 0);
virtio_gpu_notify(vgdev);
return; return;
} }
...@@ -184,6 +185,7 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, ...@@ -184,6 +185,7 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
rect.y1, rect.y1,
rect.x2 - rect.x1, rect.x2 - rect.x1,
rect.y2 - rect.y1); rect.y2 - rect.y1);
virtio_gpu_notify(vgdev);
} }
static int virtio_gpu_cursor_prepare_fb(struct drm_plane *plane, static int virtio_gpu_cursor_prepare_fb(struct drm_plane *plane,
...@@ -262,6 +264,7 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane, ...@@ -262,6 +264,7 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane,
plane->state->crtc_w, plane->state->crtc_w,
plane->state->crtc_h, plane->state->crtc_h,
0, 0, objs, vgfb->fence); 0, 0, objs, vgfb->fence);
virtio_gpu_notify(vgdev);
dma_fence_wait(&vgfb->fence->f, true); dma_fence_wait(&vgfb->fence->f, true);
dma_fence_put(&vgfb->fence->f); dma_fence_put(&vgfb->fence->f);
vgfb->fence = NULL; vgfb->fence = NULL;
......
...@@ -568,7 +568,6 @@ void virtio_gpu_cmd_set_scanout(struct virtio_gpu_device *vgdev, ...@@ -568,7 +568,6 @@ void virtio_gpu_cmd_set_scanout(struct virtio_gpu_device *vgdev,
cmd_p->r.y = cpu_to_le32(y); cmd_p->r.y = cpu_to_le32(y);
virtio_gpu_queue_ctrl_buffer(vgdev, vbuf); virtio_gpu_queue_ctrl_buffer(vgdev, vbuf);
virtio_gpu_notify(vgdev);
} }
void virtio_gpu_cmd_resource_flush(struct virtio_gpu_device *vgdev, void virtio_gpu_cmd_resource_flush(struct virtio_gpu_device *vgdev,
...@@ -590,7 +589,6 @@ void virtio_gpu_cmd_resource_flush(struct virtio_gpu_device *vgdev, ...@@ -590,7 +589,6 @@ void virtio_gpu_cmd_resource_flush(struct virtio_gpu_device *vgdev,
cmd_p->r.y = cpu_to_le32(y); cmd_p->r.y = cpu_to_le32(y);
virtio_gpu_queue_ctrl_buffer(vgdev, vbuf); virtio_gpu_queue_ctrl_buffer(vgdev, vbuf);
virtio_gpu_notify(vgdev);
} }
void virtio_gpu_cmd_transfer_to_host_2d(struct virtio_gpu_device *vgdev, void virtio_gpu_cmd_transfer_to_host_2d(struct virtio_gpu_device *vgdev,
...@@ -623,7 +621,6 @@ void virtio_gpu_cmd_transfer_to_host_2d(struct virtio_gpu_device *vgdev, ...@@ -623,7 +621,6 @@ void virtio_gpu_cmd_transfer_to_host_2d(struct virtio_gpu_device *vgdev,
cmd_p->r.y = cpu_to_le32(y); cmd_p->r.y = cpu_to_le32(y);
virtio_gpu_queue_fenced_ctrl_buffer(vgdev, vbuf, fence); virtio_gpu_queue_fenced_ctrl_buffer(vgdev, vbuf, fence);
virtio_gpu_notify(vgdev);
} }
static void static void
...@@ -1049,7 +1046,6 @@ void virtio_gpu_cmd_transfer_to_host_3d(struct virtio_gpu_device *vgdev, ...@@ -1049,7 +1046,6 @@ void virtio_gpu_cmd_transfer_to_host_3d(struct virtio_gpu_device *vgdev,
cmd_p->level = cpu_to_le32(level); cmd_p->level = cpu_to_le32(level);
virtio_gpu_queue_fenced_ctrl_buffer(vgdev, vbuf, fence); virtio_gpu_queue_fenced_ctrl_buffer(vgdev, vbuf, fence);
virtio_gpu_notify(vgdev);
} }
void virtio_gpu_cmd_transfer_from_host_3d(struct virtio_gpu_device *vgdev, void virtio_gpu_cmd_transfer_from_host_3d(struct virtio_gpu_device *vgdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment