OSDN Git Service

drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing
authorGerd Hoffmann <kraxel@redhat.com>
Thu, 29 Aug 2019 10:32:51 +0000 (12:32 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 4 Sep 2019 04:54:09 +0000 (06:54 +0200)
commitda758d51968a88fc879bdbd16a0da4784499b5bb
treef05e79b020ff3351ed0bf5ee10425496056a7307
parent98abe21d07c84e03fddceabb238c9d548e5d4ddf
drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

Rework fencing workflow, starting with virtio_gpu_execbuffer_ioctl.
Stop using ttm helpers, use the virtio_gpu_array_* helpers (which work
on the reservation objects directly) instead.

Also store the object array in struct virtio_gpu_vbuffer, so we
explicitly keep a reference of all buffers used instead of depending
on ttm_bo_put() checking whenever the object is actually idle before
releasing it.

New workflow:

 (1) All gem objects needed by a command are added to a
     virtio_gpu_object_array.
 (2) All reservation objects will be locked (virtio_gpu_array_lock_resv).
 (3) virtio_gpu_fence_emit() completes fence initialization.
 (4) fence gets added to the objects, reservation objects are unlocked
     (virtio_gpu_array_add_fence, virtio_gpu_array_unlock_resv).
 (5) virtio command is submitted to the host.
 (6) The completion callback (virtio_gpu_dequeue_ctrl_func)
     will drop object references and free virtio_gpu_object_array.

v6: rewrite most of the patch.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-9-kraxel@redhat.com
drivers/gpu/drm/virtio/virtgpu_drv.h
drivers/gpu/drm/virtio/virtgpu_ioctl.c
drivers/gpu/drm/virtio/virtgpu_vq.c