Commit 64440ef6 authored by Gerd Hoffmann's avatar Gerd Hoffmann

drm/virtio: Simplify virtio_gpu_primary_plane_update workflow.

Return early for the no framebuffer (or disabled output) case.
Results in a simpler code flow for the remaining cases.
No functional change.
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Reviewed-by: default avatarGurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191023062539.11728-3-kraxel@redhat.com
parent 1dc34852
...@@ -110,7 +110,6 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, ...@@ -110,7 +110,6 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
struct virtio_gpu_output *output = NULL; struct virtio_gpu_output *output = NULL;
struct virtio_gpu_framebuffer *vgfb; struct virtio_gpu_framebuffer *vgfb;
struct virtio_gpu_object *bo; struct virtio_gpu_object *bo;
uint32_t handle;
if (plane->state->crtc) if (plane->state->crtc)
output = drm_crtc_to_virtio_gpu_output(plane->state->crtc); output = drm_crtc_to_virtio_gpu_output(plane->state->crtc);
...@@ -119,47 +118,52 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, ...@@ -119,47 +118,52 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
if (WARN_ON(!output)) if (WARN_ON(!output))
return; return;
if (plane->state->fb && output->enabled) { if (!plane->state->fb || !output->enabled) {
vgfb = to_virtio_gpu_framebuffer(plane->state->fb); DRM_DEBUG("nofb\n");
bo = gem_to_virtio_gpu_obj(vgfb->base.obj[0]); virtio_gpu_cmd_set_scanout(vgdev, output->index, 0,
handle = bo->hw_res_handle; plane->state->src_w >> 16,
if (bo->dumb) { plane->state->src_h >> 16,
struct virtio_gpu_object_array *objs; 0, 0);
return;
objs = virtio_gpu_array_alloc(1); }
if (!objs)
return; vgfb = to_virtio_gpu_framebuffer(plane->state->fb);
virtio_gpu_array_add_obj(objs, vgfb->base.obj[0]); bo = gem_to_virtio_gpu_obj(vgfb->base.obj[0]);
virtio_gpu_cmd_transfer_to_host_2d if (bo->dumb) {
(vgdev, 0, struct virtio_gpu_object_array *objs;
plane->state->src_w >> 16,
plane->state->src_h >> 16, objs = virtio_gpu_array_alloc(1);
plane->state->src_x >> 16, if (!objs)
plane->state->src_y >> 16, return;
objs, NULL); virtio_gpu_array_add_obj(objs, vgfb->base.obj[0]);
} virtio_gpu_cmd_transfer_to_host_2d
} else { (vgdev, 0,
handle = 0; plane->state->src_w >> 16,
plane->state->src_h >> 16,
plane->state->src_x >> 16,
plane->state->src_y >> 16,
objs, NULL);
} }
DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", handle, DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n",
bo->hw_res_handle,
plane->state->crtc_w, plane->state->crtc_h, plane->state->crtc_w, plane->state->crtc_h,
plane->state->crtc_x, plane->state->crtc_y, plane->state->crtc_x, plane->state->crtc_y,
plane->state->src_w >> 16, plane->state->src_w >> 16,
plane->state->src_h >> 16, plane->state->src_h >> 16,
plane->state->src_x >> 16, plane->state->src_x >> 16,
plane->state->src_y >> 16); plane->state->src_y >> 16);
virtio_gpu_cmd_set_scanout(vgdev, output->index, handle, virtio_gpu_cmd_set_scanout(vgdev, output->index,
bo->hw_res_handle,
plane->state->src_w >> 16, plane->state->src_w >> 16,
plane->state->src_h >> 16, plane->state->src_h >> 16,
plane->state->src_x >> 16, plane->state->src_x >> 16,
plane->state->src_y >> 16); plane->state->src_y >> 16);
if (handle) virtio_gpu_cmd_resource_flush(vgdev, bo->hw_res_handle,
virtio_gpu_cmd_resource_flush(vgdev, handle, plane->state->src_x >> 16,
plane->state->src_x >> 16, plane->state->src_y >> 16,
plane->state->src_y >> 16, plane->state->src_w >> 16,
plane->state->src_w >> 16, plane->state->src_h >> 16);
plane->state->src_h >> 16);
} }
static int virtio_gpu_cursor_prepare_fb(struct drm_plane *plane, static int virtio_gpu_cursor_prepare_fb(struct drm_plane *plane,
......
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