From: Christian König Date: Mon, 16 Jul 2018 11:47:34 +0000 (+0200) Subject: drm/amdgpu: allow for more flexible priority handling X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=9d46f32bdd3e9d4bf435c5ae50f72fb475bf0620;p=openwrt%2Fstaging%2Fblogic.git drm/amdgpu: allow for more flexible priority handling Allow to call amdgpu_ring_priority_get() after pushing the ring to the scheduler. Signed-off-by: Christian König Reviewed-by: Chunming Zhou Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index 19e45a3953e0..93794a85f83d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c @@ -211,7 +211,8 @@ void amdgpu_ring_priority_get(struct amdgpu_ring *ring, if (!ring->funcs->set_priority) return; - atomic_inc(&ring->num_jobs[priority]); + if (atomic_inc_return(&ring->num_jobs[priority]) <= 0) + return; mutex_lock(&ring->priority_mutex); if (priority <= ring->priority)