summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/virtio/virtgpu_drv.h
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-08-30 08:01:16 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-09-04 06:54:12 +0200
commitf0c6cef7e7174bdb11bbf972cded48bbb33bfba4 (patch)
tree67ce19d823f0b8423176425fd2a0f0342e388909 /drivers/gpu/drm/virtio/virtgpu_drv.h
parent12afce08ed51a67aafcc678f4b6e428d71b1f6fb (diff)
drm/virtio: add worker for object release
Move object release into a separate worker. Releasing objects requires sending commands to the host. Doing that in the dequeue worker will cause deadlocks in case the command queue gets filled up, because the dequeue worker is also the one which will free up slots in the command queue. Reported-by: Chia-I Wu <olvaffe@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Chia-I Wu <olvaffe@gmail.com> Tested-by: Chia-I Wu <olvaffe@gmail.com> Link: http://patchwork.freedesktop.org/patch/msgid/20190830060116.10476-1-kraxel@redhat.com
Diffstat (limited to 'drivers/gpu/drm/virtio/virtgpu_drv.h')
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_drv.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index fb35831ed351..314e02f94d9c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -78,6 +78,7 @@ struct virtio_gpu_object {
struct virtio_gpu_object_array {
struct ww_acquire_ctx ticket;
+ struct list_head next;
u32 nents, total;
struct drm_gem_object *objs[];
};
@@ -197,6 +198,10 @@ struct virtio_gpu_device {
struct work_struct config_changed_work;
+ struct work_struct obj_free_work;
+ spinlock_t obj_free_lock;
+ struct list_head obj_free_list;
+
struct virtio_gpu_drv_capset *capsets;
uint32_t num_capsets;
struct list_head cap_cache;
@@ -246,6 +251,9 @@ void virtio_gpu_array_unlock_resv(struct virtio_gpu_object_array *objs);
void virtio_gpu_array_add_fence(struct virtio_gpu_object_array *objs,
struct dma_fence *fence);
void virtio_gpu_array_put_free(struct virtio_gpu_object_array *objs);
+void virtio_gpu_array_put_free_delayed(struct virtio_gpu_device *vgdev,
+ struct virtio_gpu_object_array *objs);
+void virtio_gpu_array_put_free_work(struct work_struct *work);
/* virtio vg */
int virtio_gpu_alloc_vbufs(struct virtio_gpu_device *vgdev);