diff options
author | Chia-I Wu <olvaffe@gmail.com> | 2020-02-05 21:19:54 +0300 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2020-02-06 13:58:18 +0300 |
commit | 96b5d1bee29f12fe5d75a96992bd67f3c46c9048 (patch) | |
tree | 51fc3310022a420ac8bd7405cb851ba9cbc5dd2a /drivers/gpu/drm/virtio/virtgpu_vq.c | |
parent | c900b2a45cd333e45e9c2a83c7bbd50177433e87 (diff) | |
download | linux-96b5d1bee29f12fe5d75a96992bd67f3c46c9048.tar.xz |
drm/virtio: move virtqueue_notify into virtio_gpu_queue_ctrl_sgs
It becomes clear that virtio_gpu_queue_fenced_ctrl_buffer should be
responsible for setting up sgs and virtio_gpu_queue_ctrl_sgs should
be responsible for queuing sgs.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-11-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/virtio/virtgpu_vq.c')
-rw-r--r-- | drivers/gpu/drm/virtio/virtgpu_vq.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index aa25e8781404..41e475fbd67b 100644 --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -318,7 +318,7 @@ static struct sg_table *vmalloc_to_sgt(char *data, uint32_t size, int *sg_ents) return sgt; } -static bool virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev, +static void virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev, struct virtio_gpu_vbuffer *vbuf, struct virtio_gpu_fence *fence, int elemcnt, @@ -338,7 +338,7 @@ again: if (fence && vbuf->objs) virtio_gpu_array_unlock_resv(vbuf->objs); - return notify; + return; } if (vq->num_free < elemcnt) { @@ -368,7 +368,12 @@ again: spin_unlock(&vgdev->ctrlq.qlock); - return notify; + if (notify) { + if (vgdev->disable_notify) + vgdev->pending_notify = true; + else + virtqueue_notify(vq); + } } static void virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev, @@ -378,7 +383,6 @@ static void virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev, struct scatterlist *sgs[3], vcmd, vout, vresp; struct sg_table *sgt = NULL; int elemcnt = 0, outcnt = 0, incnt = 0; - bool notify; /* set up vcmd */ sg_init_one(&vcmd, vbuf->buf, vbuf->size); @@ -416,14 +420,8 @@ static void virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev, incnt++; } - notify = virtio_gpu_queue_ctrl_sgs(vgdev, vbuf, fence, elemcnt, sgs, - outcnt, incnt); - if (notify) { - if (vgdev->disable_notify) - vgdev->pending_notify = true; - else - virtqueue_notify(vgdev->ctrlq.vq); - } + virtio_gpu_queue_ctrl_sgs(vgdev, vbuf, fence, elemcnt, sgs, outcnt, + incnt); if (sgt) { sg_free_table(sgt); |