drm/virtio: add real fence context and seqno
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>
Wed, 31 Aug 2016 16:26:53 +0000 (12:26 -0400)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 20 Sep 2016 12:25:43 +0000 (14:25 +0200)
virtio fences were created with no fence context, which would make then
clash with an allocated fence context.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Message-id: 1472660813-28219-2-git-send-email-gustavo@padovan.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/gpu/drm/virtio/virtgpu_drv.h
drivers/gpu/drm/virtio/virtgpu_fence.c
drivers/gpu/drm/virtio/virtgpu_kms.c

index b18ef3111f0c40c054c33e66877927a6fbbd4d5b..06ad9238044e03b4d196e290e01bb62094868a72 100644 (file)
@@ -75,6 +75,7 @@ typedef void (*virtio_gpu_resp_cb)(struct virtio_gpu_device *vgdev,
 struct virtio_gpu_fence_driver {
        atomic64_t       last_seq;
        uint64_t         sync_seq;
+       uint64_t         context;
        struct list_head fences;
        spinlock_t       lock;
 };
index cf4418709e7644a557c0392176308c4fdb1d8a24..f3f70fa8a4c7f5eefb6fba0a8798d282c860c60e 100644 (file)
@@ -89,7 +89,7 @@ int virtio_gpu_fence_emit(struct virtio_gpu_device *vgdev,
        (*fence)->drv = drv;
        (*fence)->seq = ++drv->sync_seq;
        fence_init(&(*fence)->f, &virtio_fence_ops, &drv->lock,
-                  0, (*fence)->seq);
+                  drv->context, (*fence)->seq);
        fence_get(&(*fence)->f);
        list_add_tail(&(*fence)->node, &drv->fences);
        spin_unlock_irqrestore(&drv->lock, irq_flags);
index 4150873d432efb1fb05cb2129e93267436620d0f..036b0fbae0fb7d2ce57245eb870390df81aa13e5 100644 (file)
@@ -159,6 +159,7 @@ int virtio_gpu_driver_load(struct drm_device *dev, unsigned long flags)
        virtio_gpu_init_vq(&vgdev->ctrlq, virtio_gpu_dequeue_ctrl_func);
        virtio_gpu_init_vq(&vgdev->cursorq, virtio_gpu_dequeue_cursor_func);
 
+       vgdev->fence_drv.context = fence_context_alloc(1);
        spin_lock_init(&vgdev->fence_drv.lock);
        INIT_LIST_HEAD(&vgdev->fence_drv.fences);
        INIT_LIST_HEAD(&vgdev->cap_cache);