On Tue, Apr 6, 2021 at 1:47 PM Vivek Kasireddy wrote: > 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) > > Cc: Gerd Hoffmann > Signed-off-by: Vivek Kasireddy > --- > drivers/gpu/drm/virtio/virtgpu_gem.c | 8 ++++++++ > drivers/gpu/drm/virtio/virtgpu_object.c | 3 +++ > 2 files changed, 11 insertions(+) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c > b/drivers/gpu/drm/virtio/virtgpu_gem.c > index 8502400b2f9c..5f49fb1cce65 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) { > + params.blob_mem = VIRTGPU_BLOB_MEM_GUEST; > + params.blob_flags = VIRTGPU_BLOB_FLAG_USE_SHAREABLE; > This creates some log spam with crosvm + virgl_3d + vanilla linux, since transfers don't work for guest blobs. Two options: a) Add vgdev->has_virgl_3d check and don't create a guest blob in that case. b) The interactions between TRANSFER_TO_HOST_2D and VIRTGPU_BLOB_MEM_GUEST are a bit under-defined in the spec. Though since you don't have a host side resource, you can safely skip the transfer and crosvm can be modified to do the right thing in case of RESOURCE_FLUSH. It makes a ton of sense to have a explicit udmabuf-like flag ("BLOB_FLAG_CREATE_GUEST_HANDLE" or "BLOB_FLAG_HANDLE_FROM_GUEST" -- want to host OS agnostic -- any other ideas?), especially with 3d mode. For now, implicit udmabuf + dumb should be fine since the QEMU patches have been floating around for a while and should land soon for future use cases. > + 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) { > -- > 2.26.2 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel >