mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-20 04:08:11 +07:00
drm/amdgpu: use kernel fence in amdgpu_test
Signed-off-by: Chunming Zhou <david1.zhou@amd.com> Reviewed-by: Christian K?nig <christian.koenig@amd.com> Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
This commit is contained in:
parent
ed40bfb81a
commit
6863bc8bb3
@ -238,49 +238,47 @@ void amdgpu_test_moves(struct amdgpu_device *adev)
|
||||
|
||||
static int amdgpu_test_create_and_emit_fence(struct amdgpu_device *adev,
|
||||
struct amdgpu_ring *ring,
|
||||
struct amdgpu_fence **fence)
|
||||
struct fence **fence)
|
||||
{
|
||||
uint32_t handle = ring->idx ^ 0xdeafbeef;
|
||||
int r;
|
||||
|
||||
if (ring == &adev->uvd.ring) {
|
||||
struct fence *f = NULL;
|
||||
r = amdgpu_uvd_get_create_msg(ring, handle, NULL);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to get dummy create msg\n");
|
||||
return r;
|
||||
}
|
||||
|
||||
r = amdgpu_uvd_get_destroy_msg(ring, handle, &f);
|
||||
r = amdgpu_uvd_get_destroy_msg(ring, handle, fence);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to get dummy destroy msg\n");
|
||||
return r;
|
||||
}
|
||||
*fence = to_amdgpu_fence(f);
|
||||
|
||||
} else if (ring == &adev->vce.ring[0] ||
|
||||
ring == &adev->vce.ring[1]) {
|
||||
struct fence *f = NULL;
|
||||
r = amdgpu_vce_get_create_msg(ring, handle, NULL);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to get dummy create msg\n");
|
||||
return r;
|
||||
}
|
||||
|
||||
r = amdgpu_vce_get_destroy_msg(ring, handle, &f);
|
||||
r = amdgpu_vce_get_destroy_msg(ring, handle, fence);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to get dummy destroy msg\n");
|
||||
return r;
|
||||
}
|
||||
*fence = to_amdgpu_fence(f);
|
||||
} else {
|
||||
struct amdgpu_fence *a_fence = NULL;
|
||||
r = amdgpu_ring_lock(ring, 64);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to lock ring A %d\n", ring->idx);
|
||||
return r;
|
||||
}
|
||||
amdgpu_fence_emit(ring, AMDGPU_FENCE_OWNER_UNDEFINED, fence);
|
||||
amdgpu_fence_emit(ring, AMDGPU_FENCE_OWNER_UNDEFINED, &a_fence);
|
||||
amdgpu_ring_unlock_commit(ring);
|
||||
*fence = &a_fence->base;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -289,7 +287,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev,
|
||||
struct amdgpu_ring *ringA,
|
||||
struct amdgpu_ring *ringB)
|
||||
{
|
||||
struct amdgpu_fence *fence1 = NULL, *fence2 = NULL;
|
||||
struct fence *fence1 = NULL, *fence2 = NULL;
|
||||
struct amdgpu_semaphore *semaphore = NULL;
|
||||
int r;
|
||||
|
||||
@ -325,7 +323,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev,
|
||||
|
||||
mdelay(1000);
|
||||
|
||||
if (amdgpu_fence_signaled(fence1)) {
|
||||
if (fence_is_signaled(fence1)) {
|
||||
DRM_ERROR("Fence 1 signaled without waiting for semaphore.\n");
|
||||
goto out_cleanup;
|
||||
}
|
||||
@ -338,7 +336,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev,
|
||||
amdgpu_semaphore_emit_signal(ringB, semaphore);
|
||||
amdgpu_ring_unlock_commit(ringB);
|
||||
|
||||
r = amdgpu_fence_wait(fence1, false);
|
||||
r = fence_wait(fence1, false);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to wait for sync fence 1\n");
|
||||
goto out_cleanup;
|
||||
@ -346,7 +344,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev,
|
||||
|
||||
mdelay(1000);
|
||||
|
||||
if (amdgpu_fence_signaled(fence2)) {
|
||||
if (fence_is_signaled(fence2)) {
|
||||
DRM_ERROR("Fence 2 signaled without waiting for semaphore.\n");
|
||||
goto out_cleanup;
|
||||
}
|
||||
@ -359,7 +357,7 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev,
|
||||
amdgpu_semaphore_emit_signal(ringB, semaphore);
|
||||
amdgpu_ring_unlock_commit(ringB);
|
||||
|
||||
r = amdgpu_fence_wait(fence2, false);
|
||||
r = fence_wait(fence2, false);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to wait for sync fence 1\n");
|
||||
goto out_cleanup;
|
||||
@ -369,10 +367,10 @@ void amdgpu_test_ring_sync(struct amdgpu_device *adev,
|
||||
amdgpu_semaphore_free(adev, &semaphore, NULL);
|
||||
|
||||
if (fence1)
|
||||
amdgpu_fence_unref(&fence1);
|
||||
fence_put(fence1);
|
||||
|
||||
if (fence2)
|
||||
amdgpu_fence_unref(&fence2);
|
||||
fence_put(fence2);
|
||||
|
||||
if (r)
|
||||
printk(KERN_WARNING "Error while testing ring sync (%d).\n", r);
|
||||
@ -383,7 +381,7 @@ static void amdgpu_test_ring_sync2(struct amdgpu_device *adev,
|
||||
struct amdgpu_ring *ringB,
|
||||
struct amdgpu_ring *ringC)
|
||||
{
|
||||
struct amdgpu_fence *fenceA = NULL, *fenceB = NULL;
|
||||
struct fence *fenceA = NULL, *fenceB = NULL;
|
||||
struct amdgpu_semaphore *semaphore = NULL;
|
||||
bool sigA, sigB;
|
||||
int i, r;
|
||||
@ -419,11 +417,11 @@ static void amdgpu_test_ring_sync2(struct amdgpu_device *adev,
|
||||
|
||||
mdelay(1000);
|
||||
|
||||
if (amdgpu_fence_signaled(fenceA)) {
|
||||
if (fence_is_signaled(fenceA)) {
|
||||
DRM_ERROR("Fence A signaled without waiting for semaphore.\n");
|
||||
goto out_cleanup;
|
||||
}
|
||||
if (amdgpu_fence_signaled(fenceB)) {
|
||||
if (fence_is_signaled(fenceB)) {
|
||||
DRM_ERROR("Fence B signaled without waiting for semaphore.\n");
|
||||
goto out_cleanup;
|
||||
}
|
||||
@ -438,8 +436,8 @@ static void amdgpu_test_ring_sync2(struct amdgpu_device *adev,
|
||||
|
||||
for (i = 0; i < 30; ++i) {
|
||||
mdelay(100);
|
||||
sigA = amdgpu_fence_signaled(fenceA);
|
||||
sigB = amdgpu_fence_signaled(fenceB);
|
||||
sigA = fence_is_signaled(fenceA);
|
||||
sigB = fence_is_signaled(fenceB);
|
||||
if (sigA || sigB)
|
||||
break;
|
||||
}
|
||||
@ -464,12 +462,12 @@ static void amdgpu_test_ring_sync2(struct amdgpu_device *adev,
|
||||
|
||||
mdelay(1000);
|
||||
|
||||
r = amdgpu_fence_wait(fenceA, false);
|
||||
r = fence_wait(fenceA, false);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to wait for sync fence A\n");
|
||||
goto out_cleanup;
|
||||
}
|
||||
r = amdgpu_fence_wait(fenceB, false);
|
||||
r = fence_wait(fenceB, false);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to wait for sync fence B\n");
|
||||
goto out_cleanup;
|
||||
@ -479,10 +477,10 @@ static void amdgpu_test_ring_sync2(struct amdgpu_device *adev,
|
||||
amdgpu_semaphore_free(adev, &semaphore, NULL);
|
||||
|
||||
if (fenceA)
|
||||
amdgpu_fence_unref(&fenceA);
|
||||
fence_put(fenceA);
|
||||
|
||||
if (fenceB)
|
||||
amdgpu_fence_unref(&fenceB);
|
||||
fence_put(fenceB);
|
||||
|
||||
if (r)
|
||||
printk(KERN_WARNING "Error while testing ring sync (%d).\n", r);
|
||||
|
Loading…
Reference in New Issue
Block a user