nouveau/buffer: simplify uses of nouveau_fence_work

nouveau_fence_work already checks the state, so we can just call it
directly.

Strictly speaking, this isn't functional equivalent, but practically it
doesn't matter when we get the callback called.

Main reason for doing this is, that this makes locking way easier as we
can simply lock within nouveau_fence_* functions and callers don't have to
take locks themselves.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>
This commit is contained in:
Karol Herbst 2021-05-07 14:48:42 +02:00 committed by Marge Bot
parent 35d28251d1
commit 060d055ac5
2 changed files with 3 additions and 11 deletions

View file

@ -91,12 +91,8 @@ nouveau_buffer_release_gpu_storage(struct nv04_resource *buf)
{
assert(!(buf->status & NOUVEAU_BUFFER_STATUS_USER_PTR));
if (buf->fence && buf->fence->state < NOUVEAU_FENCE_STATE_FLUSHED) {
nouveau_fence_work(buf->fence, nouveau_fence_unref_bo, buf->bo);
buf->bo = NULL;
} else {
nouveau_bo_ref(NULL, &buf->bo);
}
nouveau_fence_work(buf->fence, nouveau_fence_unref_bo, buf->bo);
buf->bo = NULL;
if (buf->mm)
release_allocation(&buf->mm, buf->fence);

View file

@ -163,11 +163,7 @@ nv50_miptree_destroy(struct pipe_screen *pscreen, struct pipe_resource *pt)
{
struct nv50_miptree *mt = nv50_miptree(pt);
if (mt->base.fence && mt->base.fence->state < NOUVEAU_FENCE_STATE_FLUSHED)
nouveau_fence_work(mt->base.fence, nouveau_fence_unref_bo, mt->base.bo);
else
nouveau_bo_ref(NULL, &mt->base.bo);
nouveau_fence_work(mt->base.fence, nouveau_fence_unref_bo, mt->base.bo);
nouveau_fence_ref(NULL, &mt->base.fence);
nouveau_fence_ref(NULL, &mt->base.fence_wr);