drm/virtio: fix command submission with objects but without fence.
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 4 Sep 2019 07:48:28 +0000 (09:48 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 6 Sep 2019 05:23:37 +0000 (07:23 +0200)
Only call virtio_gpu_array_add_fence if we actually have a fence.

Fixes: da758d51968a ("drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190904074828.32502-1-kraxel@redhat.com
drivers/gpu/drm/virtio/virtgpu_vq.c

index 595fa6ec2d5865497a5c83f0d52ec55bf8f83a43..7fd2851f7b97b7b2fe0d679c19f51dbce5b32f82 100644 (file)
@@ -339,11 +339,12 @@ again:
                goto again;
        }
 
-       if (fence)
+       if (fence) {
                virtio_gpu_fence_emit(vgdev, hdr, fence);
-       if (vbuf->objs) {
-               virtio_gpu_array_add_fence(vbuf->objs, &fence->f);
-               virtio_gpu_array_unlock_resv(vbuf->objs);
+               if (vbuf->objs) {
+                       virtio_gpu_array_add_fence(vbuf->objs, &fence->f);
+                       virtio_gpu_array_unlock_resv(vbuf->objs);
+               }
        }
        notify = virtio_gpu_queue_ctrl_buffer_locked(vgdev, vbuf);
        spin_unlock(&vgdev->ctrlq.qlock);