Commit 3389082b authored by Vivek Kasireddy's avatar Vivek Kasireddy Committed by Gerd Hoffmann

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: default avatarVivek Kasireddy <vivek.kasireddy@intel.com>
Acked-by: default avatarGurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20210413052614.2486768-1-vivek.kasireddy@intel.comSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 2b173d7f
...@@ -64,6 +64,7 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv, ...@@ -64,6 +64,7 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
{ {
struct drm_gem_object *gobj; struct drm_gem_object *gobj;
struct virtio_gpu_object_params params = { 0 }; struct virtio_gpu_object_params params = { 0 };
struct virtio_gpu_device *vgdev = dev->dev_private;
int ret; int ret;
uint32_t pitch; uint32_t pitch;
...@@ -79,6 +80,13 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv, ...@@ -79,6 +80,13 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
params.height = args->height; params.height = args->height;
params.size = args->size; params.size = args->size;
params.dumb = true; 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, &params, &gobj, ret = virtio_gpu_gem_create(file_priv, dev, &params, &gobj,
&args->handle); &args->handle);
if (ret) if (ret)
......
...@@ -254,6 +254,9 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, ...@@ -254,6 +254,9 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev,
} }
if (params->blob) { if (params->blob) {
if (params->blob_mem == VIRTGPU_BLOB_MEM_GUEST)
bo->guest_blob = true;
virtio_gpu_cmd_resource_create_blob(vgdev, bo, params, virtio_gpu_cmd_resource_create_blob(vgdev, bo, params,
ents, nents); ents, nents);
} else if (params->virgl) { } else if (params->virgl) {
......
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