Commit 64470474 authored by Christian König's avatar Christian König

drm/amdgpu: use dma_resv_for_each_fence for CS workaround v2

Get the write fence using dma_resv_for_each_fence instead of accessing
it manually.

v2: add TODO comment
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Cc: amd-gfx@lists.freedesktop.org
Link: https://patchwork.freedesktop.org/patch/msgid/20220321135856.1331-9-christian.koenig@amd.com
parent 9b53fddf
...@@ -1267,18 +1267,23 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, ...@@ -1267,18 +1267,23 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
amdgpu_bo_list_for_each_entry(e, p->bo_list) { amdgpu_bo_list_for_each_entry(e, p->bo_list) {
struct dma_resv *resv = e->tv.bo->base.resv; struct dma_resv *resv = e->tv.bo->base.resv;
struct dma_fence_chain *chain = e->chain; struct dma_fence_chain *chain = e->chain;
struct dma_resv_iter cursor;
struct dma_fence *fence;
if (!chain) if (!chain)
continue; continue;
/* /*
* Work around dma_resv shortcommings by wrapping up the * Temporary workaround dma_resv shortcommings by wrapping up
* submission in a dma_fence_chain and add it as exclusive * the submission in a dma_fence_chain and add it as exclusive
* fence. * fence.
*
* TODO: Remove together with dma_resv rework.
*/ */
dma_fence_chain_init(chain, dma_resv_excl_fence(resv), dma_resv_for_each_fence(&cursor, resv, false, fence) {
dma_fence_get(p->fence), 1); break;
}
dma_fence_chain_init(chain, fence, dma_fence_get(p->fence), 1);
rcu_assign_pointer(resv->fence_excl, &chain->base); rcu_assign_pointer(resv->fence_excl, &chain->base);
e->chain = NULL; e->chain = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment