drm/virtio: batch resource creation
authorGerd Hoffmann <kraxel@redhat.com>
Fri, 14 Feb 2020 12:55:33 +0000 (13:55 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 17 Feb 2020 13:50:49 +0000 (14:50 +0100)
Move virtio_gpu_notify() to higher-level functions for
virtio_gpu_cmd_create_resource(), virtio_gpu_cmd_resource_create_3d()
and virtio_gpu_cmd_resource_attach_backing().

virtio_gpu_object_create() will batch commands and notify only once when
creating a resource.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20200214125535.26349-5-kraxel@redhat.com
drivers/gpu/drm/virtio/virtgpu_object.c
drivers/gpu/drm/virtio/virtgpu_vq.c

index 8870ee23ff2b119bffe6153f65b8615a1d0a9f7c..65d6834d3c7424f6c14db6a04bb4c511cf57a6a2 100644 (file)
@@ -224,6 +224,7 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev,
                return ret;
        }
 
+       virtio_gpu_notify(vgdev);
        *bo_ptr = bo;
        return 0;
 
index 0bd1c51bbabddcee19cbc371bae1f011dfdaac9a..4e9b2f2e71bd824cb0488435edf0b0feb046eadb 100644 (file)
@@ -515,7 +515,6 @@ void virtio_gpu_cmd_create_resource(struct virtio_gpu_device *vgdev,
        cmd_p->height = cpu_to_le32(params->height);
 
        virtio_gpu_queue_fenced_ctrl_buffer(vgdev, vbuf, fence);
-       virtio_gpu_notify(vgdev);
        bo->created = true;
 }
 
@@ -644,7 +643,6 @@ virtio_gpu_cmd_resource_attach_backing(struct virtio_gpu_device *vgdev,
        vbuf->data_size = sizeof(*ents) * nents;
 
        virtio_gpu_queue_fenced_ctrl_buffer(vgdev, vbuf, fence);
-       virtio_gpu_notify(vgdev);
 }
 
 static void virtio_gpu_cmd_get_display_info_cb(struct virtio_gpu_device *vgdev,
@@ -1011,7 +1009,6 @@ virtio_gpu_cmd_resource_create_3d(struct virtio_gpu_device *vgdev,
        cmd_p->flags = cpu_to_le32(params->flags);
 
        virtio_gpu_queue_fenced_ctrl_buffer(vgdev, vbuf, fence);
-       virtio_gpu_notify(vgdev);
 
        bo->created = true;
 }