aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-09-03 23:06:29 -0400
committerDave Airlie <airlied@redhat.com>2015-09-03 23:06:29 -0400
commit99495589aa4de7166af254bc497cdbe133fc24bb (patch)
treed525e957854064f2492976e9beb8a04dddc28143 /drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
parent879a37d00f1882b1e56a66e626af4194d592d257 (diff)
parentbddf8026386927985ef6d0d11c3ba78f70b76bad (diff)
Merge branch 'drm-next-4.3' of git://people.freedesktop.org/~agd5f/linux into drm-next
More fixes for radeon and amdgpu for 4.3: - Send full DP aux address fixes for radeon and amdgpu - Fix an HDMI display regression for pre-DCE5 parts - UVD suspend fixes for amdgpu - Add an rs480 suspend quirk - Fix bo reserve handling in amdgpu GEM_OP ioctl - GPU scheduler fixes - SDMA optimizations - MEC fix for Fiji * 'drm-next-4.3' of git://people.freedesktop.org/~agd5f/linux: (21 commits) drm/amdgpu: set MEC doorbell range for Fiji drm/amdgpu: implement burst NOP for SDMA drm/amdgpu: add insert_nop ring func and default implementation drm/amdgpu: add amdgpu_get_sdma_instance helper function drm/amdgpu: add AMDGPU_MAX_SDMA_INSTANCES drm/amdgpu: add burst_nop flag for sdma drm/amdgpu: add count field for the SDMA NOP packet v2 drm/amdgpu: use PT for VM sync on unmap drm/amdgpu: make wait_event uninterruptible in push_job drm/amdgpu: fix amdgpu_bo_unreserve order in GEM_OP IOCTL v2 drm/amdgpu: partially revert "modify amdgpu_fence_wait_any() to amdgpu_fence_wait_multiple()" v2 Add radeon suspend/resume quirk for HP Compaq dc5750. drm/amdgpu: re-work sync_resv drm/amdgpu/atom: Send out the full AUX address drm/radeon/native: Send out the full AUX address drm/radeon/atom: Send out the full AUX address drm/amdgpu: use IB for fill_buffer instead of direct command drm/amdgpu: stop trying to suspend UVD sessions v2 drm/amdgpu: add scheduler dependency callback v2 drm/amdgpu: let the scheduler work more with jobs v2 ...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c44
1 files changed, 9 insertions, 35 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index f446bf2fedc9..1be2bd6d07ea 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -851,22 +851,6 @@ static bool amdgpu_test_signaled_any(struct fence **fences, uint32_t count)
851 return false; 851 return false;
852} 852}
853 853
854static bool amdgpu_test_signaled_all(struct fence **fences, uint32_t count)
855{
856 int idx;
857 struct fence *fence;
858
859 for (idx = 0; idx < count; ++idx) {
860 fence = fences[idx];
861 if (fence) {
862 if (!test_bit(FENCE_FLAG_SIGNALED_BIT, &fence->flags))
863 return false;
864 }
865 }
866
867 return true;
868}
869
870struct amdgpu_wait_cb { 854struct amdgpu_wait_cb {
871 struct fence_cb base; 855 struct fence_cb base;
872 struct task_struct *task; 856 struct task_struct *task;
@@ -885,7 +869,7 @@ static signed long amdgpu_fence_default_wait(struct fence *f, bool intr,
885 struct amdgpu_fence *fence = to_amdgpu_fence(f); 869 struct amdgpu_fence *fence = to_amdgpu_fence(f);
886 struct amdgpu_device *adev = fence->ring->adev; 870 struct amdgpu_device *adev = fence->ring->adev;
887 871
888 return amdgpu_fence_wait_multiple(adev, &f, 1, false, intr, t); 872 return amdgpu_fence_wait_any(adev, &f, 1, intr, t);
889} 873}
890 874
891/** 875/**
@@ -894,23 +878,18 @@ static signed long amdgpu_fence_default_wait(struct fence *f, bool intr,
894 * @adev: amdgpu device 878 * @adev: amdgpu device
895 * @array: the fence array with amdgpu fence pointer 879 * @array: the fence array with amdgpu fence pointer
896 * @count: the number of the fence array 880 * @count: the number of the fence array
897 * @wait_all: the flag of wait all(true) or wait any(false)
898 * @intr: when sleep, set the current task interruptable or not 881 * @intr: when sleep, set the current task interruptable or not
899 * @t: timeout to wait 882 * @t: timeout to wait
900 * 883 *
901 * If wait_all is true, it will return when all fences are signaled or timeout. 884 * It will return when any fence is signaled or timeout.
902 * If wait_all is false, it will return when any fence is signaled or timeout.
903 */ 885 */
904signed long amdgpu_fence_wait_multiple(struct amdgpu_device *adev, 886signed long amdgpu_fence_wait_any(struct amdgpu_device *adev,
905 struct fence **array, 887 struct fence **array, uint32_t count,
906 uint32_t count, 888 bool intr, signed long t)
907 bool wait_all, 889{
908 bool intr,
909 signed long t)
910{
911 long idx = 0;
912 struct amdgpu_wait_cb *cb; 890 struct amdgpu_wait_cb *cb;
913 struct fence *fence; 891 struct fence *fence;
892 unsigned idx;
914 893
915 BUG_ON(!array); 894 BUG_ON(!array);
916 895
@@ -927,10 +906,7 @@ signed long amdgpu_fence_wait_multiple(struct amdgpu_device *adev,
927 if (fence_add_callback(fence, 906 if (fence_add_callback(fence,
928 &cb[idx].base, amdgpu_fence_wait_cb)) { 907 &cb[idx].base, amdgpu_fence_wait_cb)) {
929 /* The fence is already signaled */ 908 /* The fence is already signaled */
930 if (wait_all) 909 goto fence_rm_cb;
931 continue;
932 else
933 goto fence_rm_cb;
934 } 910 }
935 } 911 }
936 } 912 }
@@ -945,9 +921,7 @@ signed long amdgpu_fence_wait_multiple(struct amdgpu_device *adev,
945 * amdgpu_test_signaled_any must be called after 921 * amdgpu_test_signaled_any must be called after
946 * set_current_state to prevent a race with wake_up_process 922 * set_current_state to prevent a race with wake_up_process
947 */ 923 */
948 if (!wait_all && amdgpu_test_signaled_any(array, count)) 924 if (amdgpu_test_signaled_any(array, count))
949 break;
950 if (wait_all && amdgpu_test_signaled_all(array, count))
951 break; 925 break;
952 926
953 if (adev->needs_reset) { 927 if (adev->needs_reset) {