[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190618142423.GE12905@phenom.ffwll.local>
Date: Tue, 18 Jun 2019 16:24:23 +0200
From: Daniel Vetter <daniel@...ll.ch>
To: Gerd Hoffmann <kraxel@...hat.com>
Cc: dri-devel@...ts.freedesktop.org, David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
"open list:VIRTIO GPU DRIVER"
<virtualization@...ts.linux-foundation.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 08/12] drm/virtio: rework virtio_gpu_object_create
fencing
On Tue, Jun 18, 2019 at 03:58:16PM +0200, Gerd Hoffmann wrote:
> Use gem reservation helpers and direct reservation_object_* calls
> instead of ttm.
>
> Signed-off-by: Gerd Hoffmann <kraxel@...hat.com>
> ---
> drivers/gpu/drm/virtio/virtgpu_object.c | 28 +++++++------------------
> 1 file changed, 8 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c
> index 82bfbf983fd2..461f15f26517 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_object.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_object.c
> @@ -141,34 +141,22 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev,
>
> if (fence) {
> struct virtio_gpu_fence_driver *drv = &vgdev->fence_drv;
> - struct list_head validate_list;
> - struct ttm_validate_buffer mainbuf;
> + struct drm_gem_object *obj = &bo->gem_base;
> struct ww_acquire_ctx ticket;
> unsigned long irq_flags;
> - bool signaled;
>
> - INIT_LIST_HEAD(&validate_list);
> - memset(&mainbuf, 0, sizeof(struct ttm_validate_buffer));
> -
> - /* use a gem reference since unref list undoes them */
> - drm_gem_object_get(&bo->gem_base);
> - mainbuf.bo = &bo->tbo;
> - list_add(&mainbuf.head, &validate_list);
> -
> - ret = virtio_gpu_object_list_validate(&ticket, &validate_list);
> + drm_gem_object_get(obj);
> + ret = drm_gem_lock_reservations(&obj, 1, &ticket);
> if (ret == 0) {
> spin_lock_irqsave(&drv->lock, irq_flags);
> - signaled = virtio_fence_signaled(&fence->f);
> - if (!signaled)
> + if (!virtio_fence_signaled(&fence->f))
> /* virtio create command still in flight */
> - ttm_eu_fence_buffer_objects(&ticket, &validate_list,
> - &fence->f);
Same issue with the refcounting gone wrong here as in the previous patch.
-Daniel
> + reservation_object_add_excl_fence(obj->resv,
> + &fence->f);
> spin_unlock_irqrestore(&drv->lock, irq_flags);
> - if (signaled)
> - /* virtio create command finished */
> - ttm_eu_backoff_reservation(&ticket, &validate_list);
> }
> - virtio_gpu_unref_list(&validate_list);
> + drm_gem_unlock_reservations(&obj, 1, &ticket);
> + drm_gem_object_put_unlocked(obj);
> }
>
> *bo_ptr = bo;
> --
> 2.18.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Powered by blists - more mailing lists