From: Christian König <ckoenig.leichtzumer...@gmail.com>

Don't block others while waiting for the fences to finish, concurrent
submission is perfectly valid in this case and holding the lock can
prevent killed applications from terminating.

Signed-off-by: Christian König <christian.koe...@amd.com>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlaus...@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 380a7f9..ad4f0e5 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4814,23 +4814,26 @@ static void amdgpu_dm_commit_planes(struct 
drm_atomic_state *state,
                        continue;
                }
 
+               abo = gem_to_amdgpu_bo(fb->obj[0]);
+
+               /* Wait for all fences on this FB */
+               r = reservation_object_wait_timeout_rcu(abo->tbo.resv, true,
+                                                       false,
+                                                       MAX_SCHEDULE_TIMEOUT);
+               WARN_ON(r < 0);
+
                /*
                 * TODO This might fail and hence better not used, wait
                 * explicitly on fences instead
                 * and in general should be called for
                 * blocking commit to as per framework helpers
                 */
-               abo = gem_to_amdgpu_bo(fb->obj[0]);
                r = amdgpu_bo_reserve(abo, true);
                if (unlikely(r != 0)) {
                        DRM_ERROR("failed to reserve buffer before flip\n");
                        WARN_ON(1);
                }
 
-               /* Wait for all fences on this FB */
-               WARN_ON(reservation_object_wait_timeout_rcu(abo->tbo.resv, 
true, false,
-                                                                           
MAX_SCHEDULE_TIMEOUT) < 0);
-
                amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
 
                amdgpu_bo_unreserve(abo);
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to