[PATCH 03/12] drm/amdgpu: add DMA-buf user fence support
Christian König
ckoenig.leichtzumerken at gmail.com
Tue May 4 13:27:20 UTC 2021
Just add the call before taking locks.
Signed-off-by: Christian König <christian.koenig at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 7 +++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 6 ++++++
2 files changed, 13 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index b5c766998045..afd58c6d88a4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -534,6 +534,13 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
return r;
}
+ /* Sync to user fences */
+ amdgpu_bo_list_for_each_entry(e, p->bo_list) {
+ r = dma_resv_sync_user_fence(e->tv.bo->base.resv);
+ if (r)
+ return r;
+ }
+
/* One for TTM and one for the CS job */
amdgpu_bo_list_for_each_entry(e, p->bo_list)
e->tv.num_shared = 2;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 9a2f811450ed..3edd6dbae71f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -181,6 +181,12 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc,
obj = fb->obj[0];
new_abo = gem_to_amdgpu_bo(obj);
+ r = dma_resv_sync_user_fence(obj->resv);
+ if (unlikely(r)) {
+ DRM_ERROR("failed to wait for user fence before flip\n");
+ goto cleanup;
+ }
+
/* pin the new buffer */
r = amdgpu_bo_reserve(new_abo, false);
if (unlikely(r != 0)) {
--
2.25.1
More information about the dri-devel
mailing list