mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 14:12:07 +02:00
drm/nouveau: wait for the exclusive fence after the shared ones v2
Always waiting for the exclusive fence resulted on some performance
regressions. So try to wait for the shared fences first, then the
exclusive fence should always be signaled already.
v2: fix incorrectly placed "(", add some comment why we do this.
Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Stefan Fritsch <sf@sfritsch.de>
Tested-by: Dan Moulding <dmoulding@me.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Cc: <stable@vger.kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20211209102335.18321-1-christian.koenig@amd.com
This commit is contained in:
parent
fc74881c28
commit
67f74302f4
|
|
@ -353,34 +353,16 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct nouveau_channel *chan, bool e
|
|||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
fobj = NULL;
|
||||
} else {
|
||||
fobj = dma_resv_shared_list(resv);
|
||||
}
|
||||
|
||||
fobj = dma_resv_shared_list(resv);
|
||||
fence = dma_resv_excl_fence(resv);
|
||||
|
||||
if (fence) {
|
||||
struct nouveau_channel *prev = NULL;
|
||||
bool must_wait = true;
|
||||
|
||||
f = nouveau_local_fence(fence, chan->drm);
|
||||
if (f) {
|
||||
rcu_read_lock();
|
||||
prev = rcu_dereference(f->channel);
|
||||
if (prev && (prev == chan || fctx->sync(f, prev, chan) == 0))
|
||||
must_wait = false;
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
if (must_wait)
|
||||
ret = dma_fence_wait(fence, intr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!exclusive || !fobj)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < fobj->shared_count && !ret; ++i) {
|
||||
/* Waiting for the exclusive fence first causes performance regressions
|
||||
* under some circumstances. So manually wait for the shared ones first.
|
||||
*/
|
||||
for (i = 0; i < (fobj ? fobj->shared_count : 0) && !ret; ++i) {
|
||||
struct nouveau_channel *prev = NULL;
|
||||
bool must_wait = true;
|
||||
|
||||
|
|
@ -400,6 +382,26 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct nouveau_channel *chan, bool e
|
|||
ret = dma_fence_wait(fence, intr);
|
||||
}
|
||||
|
||||
fence = dma_resv_excl_fence(resv);
|
||||
if (fence) {
|
||||
struct nouveau_channel *prev = NULL;
|
||||
bool must_wait = true;
|
||||
|
||||
f = nouveau_local_fence(fence, chan->drm);
|
||||
if (f) {
|
||||
rcu_read_lock();
|
||||
prev = rcu_dereference(f->channel);
|
||||
if (prev && (prev == chan || fctx->sync(f, prev, chan) == 0))
|
||||
must_wait = false;
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
if (must_wait)
|
||||
ret = dma_fence_wait(fence, intr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user