Makes the handling a bit more complex, but avoids the use of
dma_resv_get_excl_unlocked().

v2: add missing rcu_read_lock()/unlock()

Signed-off-by: Christian König <christian.koe...@amd.com>
---
 drivers/gpu/drm/nouveau/dispnv50/wndw.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.c 
b/drivers/gpu/drm/nouveau/dispnv50/wndw.c
index 8d048bacd6f0..0f5cdb897f06 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/wndw.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.c
@@ -539,6 +539,8 @@ nv50_wndw_prepare_fb(struct drm_plane *plane, struct 
drm_plane_state *state)
        struct nouveau_bo *nvbo;
        struct nv50_head_atom *asyh;
        struct nv50_wndw_ctxdma *ctxdma;
+       struct dma_resv_iter cursor;
+       struct dma_fence *fence;
        int ret;
 
        NV_ATOMIC(drm, "%s prepare: %p\n", plane->name, fb);
@@ -561,7 +563,14 @@ nv50_wndw_prepare_fb(struct drm_plane *plane, struct 
drm_plane_state *state)
                        asyw->image.handle[0] = ctxdma->object.handle;
        }
 
-       asyw->state.fence = dma_resv_get_excl_unlocked(nvbo->bo.base.resv);
+       rcu_read_lock();
+       dma_resv_for_each_fence_unlocked(nvbo->bo.base.resv, &cursor, false,
+                                        fence) {
+               /* TODO: We only use the first writer here */
+               asyw->state.fence = fence;
+               break;
+       }
+       rcu_read_unlock();
        asyw->image.offset[0] = nvbo->offset;
 
        if (wndw->func->prepare) {
-- 
2.25.1

Reply via email to