@@ -52,6 +52,7 @@ static int virtio_gpu_features(struct seq_file *m, void *data)
vgdev->has_resource_assign_uuid);
virtio_gpu_add_bool(m, "blob resources", vgdev->has_resource_blob);
+ virtio_gpu_add_bool(m, "release fence", vgdev->ddev->mode_config.release_fence);
virtio_gpu_add_int(m, "cap sets", vgdev->num_capsets);
virtio_gpu_add_int(m, "scanouts", vgdev->num_scanouts);
if (vgdev->host_visible_region.len) {
@@ -172,6 +172,7 @@ static unsigned int features[] = {
VIRTIO_GPU_F_EDID,
VIRTIO_GPU_F_RESOURCE_UUID,
VIRTIO_GPU_F_RESOURCE_BLOB,
+ VIRTIO_GPU_F_RELEASE_FENCE,
};
static struct virtio_driver virtio_gpu_driver = {
.feature_table = features,
@@ -140,6 +140,7 @@ struct virtio_gpu_fence {
uint64_t fence_id;
struct virtio_gpu_fence_driver *drv;
struct list_head node;
+ struct dma_fence *release_fence;
};
struct virtio_gpu_vbuffer {
@@ -134,6 +134,9 @@ void virtio_gpu_fence_event_process(struct virtio_gpu_device *vgdev,
if (signaled->f.context != curr->f.context)
continue;
+ if (curr->release_fence)
+ continue;
+
if (!dma_fence_is_later(&signaled->f, &curr->f))
continue;
@@ -142,6 +145,12 @@ void virtio_gpu_fence_event_process(struct virtio_gpu_device *vgdev,
dma_fence_put(&curr->f);
}
+ if (signaled->release_fence) {
+ dma_fence_signal(signaled->release_fence);
+ dma_fence_put(signaled->release_fence);
+ signaled->release_fence = NULL;
+ }
+
dma_fence_signal_locked(&signaled->f);
list_del(&signaled->node);
dma_fence_put(&signaled->f);
@@ -156,6 +156,9 @@ int virtio_gpu_init(struct drm_device *dev)
if (virtio_has_feature(vgdev->vdev, VIRTIO_GPU_F_RESOURCE_BLOB)) {
vgdev->has_resource_blob = true;
}
+ if (virtio_has_feature(vgdev->vdev, VIRTIO_GPU_F_RELEASE_FENCE)) {
+ vgdev->ddev->mode_config.release_fence = true;
+ }
if (virtio_get_shm_region(vgdev->vdev, &vgdev->host_visible_region,
VIRTIO_GPU_SHM_ID_HOST_VISIBLE)) {
if (!devm_request_mem_region(&vgdev->vdev->dev,
@@ -176,11 +179,13 @@ int virtio_gpu_init(struct drm_device *dev)
(unsigned long)vgdev->host_visible_region.len);
}
- DRM_INFO("features: %cvirgl %cedid %cresource_blob %chost_visible\n",
+ DRM_INFO("features: %cvirgl %cedid %cresource_blob %chost_visible \
+ %crelease_fence\n",
vgdev->has_virgl_3d ? '+' : '-',
vgdev->has_edid ? '+' : '-',
vgdev->has_resource_blob ? '+' : '-',
- vgdev->has_host_visible ? '+' : '-');
+ vgdev->has_host_visible ? '+' : '-',
+ vgdev->ddev->mode_config.release_fence ? '+' : '-');
ret = virtio_find_vqs(vgdev->vdev, 2, vqs, callbacks, names, NULL);
if (ret) {
@@ -60,6 +60,8 @@
*/
#define VIRTIO_GPU_F_RESOURCE_BLOB 3
+#define VIRTIO_GPU_F_RELEASE_FENCE 4
+
enum virtio_gpu_ctrl_type {
VIRTIO_GPU_UNDEFINED = 0,
Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com> --- drivers/gpu/drm/virtio/virtgpu_debugfs.c | 1 + drivers/gpu/drm/virtio/virtgpu_drv.c | 1 + drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_fence.c | 9 +++++++++ drivers/gpu/drm/virtio/virtgpu_kms.c | 9 +++++++-- include/uapi/linux/virtio_gpu.h | 2 ++ 6 files changed, 21 insertions(+), 2 deletions(-)