diff options
author | Vivek Kasireddy <vivek.kasireddy@intel.com> | 2021-04-12 22:26:14 -0700 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2021-04-15 10:55:18 +0200 |
commit | 3389082bb98296ca5f31ac809a4e5dec5b069148 (patch) | |
tree | 5881c940504e78f72325b14e8d5a48a699a890f6 /drivers/gpu/drm/virtio | |
parent | 2b173d7fc220af2b0aea209568753c6e591b0ca6 (diff) | |
download | linux-3389082bb98296ca5f31ac809a4e5dec5b069148.tar.bz2 |
drm/virtio: Create Dumb BOs as guest Blobs (v3)
If support for Blob resources is available, then dumb BOs created
by the driver can be considered as guest Blobs.
v2: Don't skip transfer and flush commands as part of plane update
as the device may have created a shared mapping. (Gerd)
v3: Don't create dumb BOs as Guest blobs if Virgl is enabled. (Gurchetan)
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Acked-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20210413052614.2486768-1-vivek.kasireddy@intel.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/virtio')
-rw-r--r-- | drivers/gpu/drm/virtio/virtgpu_gem.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/virtio/virtgpu_object.c | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c index 8502400b2f9c..2de61b63ef91 100644 --- a/drivers/gpu/drm/virtio/virtgpu_gem.c +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c @@ -64,6 +64,7 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv, { struct drm_gem_object *gobj; struct virtio_gpu_object_params params = { 0 }; + struct virtio_gpu_device *vgdev = dev->dev_private; int ret; uint32_t pitch; @@ -79,6 +80,13 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv, params.height = args->height; params.size = args->size; params.dumb = true; + + if (vgdev->has_resource_blob && !vgdev->has_virgl_3d) { + params.blob_mem = VIRTGPU_BLOB_MEM_GUEST; + params.blob_flags = VIRTGPU_BLOB_FLAG_USE_SHAREABLE; + params.blob = true; + } + ret = virtio_gpu_gem_create(file_priv, dev, ¶ms, &gobj, &args->handle); if (ret) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index 4ff1ec28e630..f648b0e24447 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -254,6 +254,9 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, } if (params->blob) { + if (params->blob_mem == VIRTGPU_BLOB_MEM_GUEST) + bo->guest_blob = true; + virtio_gpu_cmd_resource_create_blob(vgdev, bo, params, ents, nents); } else if (params->virgl) { |