summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorGurchetan Singh <gurchetansingh@chromium.org>2020-09-23 17:31:56 -0700
committerGerd Hoffmann <kraxel@redhat.com>2020-09-29 11:22:42 +0200
commit30172efbfb842cd898e34fea8694ed250200eaab (patch)
tree4381c74d9538d21fb3d49c9e0ef14c0bce784dec /drivers/gpu/drm
parent8f7db83e6abf863c6a2cfddbe7086f1e3251fdbf (diff)
drm/virtio: blob prep: refactor getting pages and attaching backing
Useful for upcoming blob resources. Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org> Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-1-gurchetansingh@chromium.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_object.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c
index 4f7d7ea8194c..74cfe47ad46b 100644
--- a/drivers/gpu/drm/virtio/virtgpu_object.c
+++ b/drivers/gpu/drm/virtio/virtgpu_object.c
@@ -229,22 +229,22 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev,
goto err_put_objs;
}
+ ret = virtio_gpu_object_shmem_init(vgdev, bo, &ents, &nents);
+ if (ret != 0) {
+ virtio_gpu_free_object(&shmem_obj->base);
+ return ret;
+ }
+
if (params->virgl) {
virtio_gpu_cmd_resource_create_3d(vgdev, bo, params,
objs, fence);
+ virtio_gpu_object_attach(vgdev, bo, ents, nents);
} else {
virtio_gpu_cmd_create_resource(vgdev, bo, params,
objs, fence);
+ virtio_gpu_object_attach(vgdev, bo, ents, nents);
}
- ret = virtio_gpu_object_shmem_init(vgdev, bo, &ents, &nents);
- if (ret != 0) {
- virtio_gpu_free_object(&shmem_obj->base);
- return ret;
- }
-
- virtio_gpu_object_attach(vgdev, bo, ents, nents);
-
*bo_ptr = bo;
return 0;