drm/amdgpu: change uvd ib test to use kernel fence directly
authorChunming Zhou <david1.zhou@amd.com>
Mon, 3 Aug 2015 05:11:04 +0000 (13:11 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 17 Aug 2015 20:50:51 +0000 (16:50 -0400)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c

index df202999fbfe7c54f5c96b39dea8dc856c0f185a..567c5b3c6f3a0ddb0879b1dd214c240a16200bf9 100644 (file)
@@ -244,17 +244,19 @@ static int amdgpu_test_create_and_emit_fence(struct amdgpu_device *adev,
        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, fence);
+               r = amdgpu_uvd_get_destroy_msg(ring, handle, &f);
                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]) {
index c1be7db36a69955e83d653a35606b8bc0fadad0d..9b2730599134ac422f8f097aec5efa242fcfa3bf 100644 (file)
@@ -288,7 +288,7 @@ void amdgpu_uvd_free_handles(struct amdgpu_device *adev, struct drm_file *filp)
        for (i = 0; i < AMDGPU_MAX_UVD_HANDLES; ++i) {
                uint32_t handle = atomic_read(&adev->uvd.handles[i]);
                if (handle != 0 && adev->uvd.filp[i] == filp) {
-                       struct amdgpu_fence *fence;
+                       struct fence *fence;
 
                        amdgpu_uvd_note_usage(adev);
 
@@ -298,8 +298,8 @@ void amdgpu_uvd_free_handles(struct amdgpu_device *adev, struct drm_file *filp)
                                continue;
                        }
 
-                       amdgpu_fence_wait(fence, false);
-                       amdgpu_fence_unref(&fence);
+                       fence_wait(fence, false);
+                       fence_put(fence);
 
                        adev->uvd.filp[i] = NULL;
                        atomic_set(&adev->uvd.handles[i], 0);
@@ -819,7 +819,7 @@ static int amdgpu_uvd_free_job(
 
 static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring,
                               struct amdgpu_bo *bo,
-                              struct amdgpu_fence **fence)
+                              struct fence **fence)
 {
        struct ttm_validate_buffer tv;
        struct ww_acquire_ctx ticket;
@@ -876,7 +876,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring,
        ttm_eu_fence_buffer_objects(&ticket, &head, &ib->fence->base);
 
        if (fence)
-               *fence = amdgpu_fence_ref(ib->fence);
+               *fence = fence_get(&ib->fence->base);
        amdgpu_bo_unref(&bo);
 
        if (amdgpu_enable_scheduler)
@@ -898,7 +898,7 @@ err:
    crash the vcpu so just try to emmit a dummy create/destroy msg to
    avoid this */
 int amdgpu_uvd_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
-                             struct amdgpu_fence **fence)
+                             struct fence **fence)
 {
        struct amdgpu_device *adev = ring->adev;
        struct amdgpu_bo *bo;
@@ -945,7 +945,7 @@ int amdgpu_uvd_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
 }
 
 int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
-                              struct amdgpu_fence **fence)
+                              struct fence **fence)
 {
        struct amdgpu_device *adev = ring->adev;
        struct amdgpu_bo *bo;
index 2255aa710e33934a4abcccfaf19278f7b8e18f6e..1724c2c861516eea61b7d23f7521e7c8c834a5e6 100644 (file)
@@ -29,9 +29,9 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev);
 int amdgpu_uvd_suspend(struct amdgpu_device *adev);
 int amdgpu_uvd_resume(struct amdgpu_device *adev);
 int amdgpu_uvd_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
-                             struct amdgpu_fence **fence);
+                             struct fence **fence);
 int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
-                              struct amdgpu_fence **fence);
+                              struct fence **fence);
 void amdgpu_uvd_free_handles(struct amdgpu_device *adev,
                             struct drm_file *filp);
 int amdgpu_uvd_ring_parse_cs(struct amdgpu_cs_parser *parser, uint32_t ib_idx);
index 4efd671d7a9b28dac74d8af4da549401287de57e..9ac383bc6c1fad659ba69d9b9f212fe7e888ac17 100644 (file)
@@ -534,7 +534,7 @@ static void uvd_v4_2_ring_emit_ib(struct amdgpu_ring *ring,
 static int uvd_v4_2_ring_test_ib(struct amdgpu_ring *ring)
 {
        struct amdgpu_device *adev = ring->adev;
-       struct amdgpu_fence *fence = NULL;
+       struct fence *fence = NULL;
        int r;
 
        r = amdgpu_asic_set_uvd_clocks(adev, 53300, 40000);
@@ -555,14 +555,14 @@ static int uvd_v4_2_ring_test_ib(struct amdgpu_ring *ring)
                goto error;
        }
 
-       r = amdgpu_fence_wait(fence, false);
+       r = fence_wait(fence, false);
        if (r) {
                DRM_ERROR("amdgpu: fence wait failed (%d).\n", r);
                goto error;
        }
        DRM_INFO("ib test on ring %d succeeded\n",  ring->idx);
 error:
-       amdgpu_fence_unref(&fence);
+       fence_put(fence);
        amdgpu_asic_set_uvd_clocks(adev, 0, 0);
        return r;
 }
index b756bd99c0fd1a00dac0fb0a1d38f24a2f632689..de4b3f57902d24320cc90c446bf9f4c4d5d27dde 100644 (file)
@@ -580,7 +580,7 @@ static void uvd_v5_0_ring_emit_ib(struct amdgpu_ring *ring,
 static int uvd_v5_0_ring_test_ib(struct amdgpu_ring *ring)
 {
        struct amdgpu_device *adev = ring->adev;
-       struct amdgpu_fence *fence = NULL;
+       struct fence *fence = NULL;
        int r;
 
        r = amdgpu_asic_set_uvd_clocks(adev, 53300, 40000);
@@ -601,14 +601,14 @@ static int uvd_v5_0_ring_test_ib(struct amdgpu_ring *ring)
                goto error;
        }
 
-       r = amdgpu_fence_wait(fence, false);
+       r = fence_wait(fence, false);
        if (r) {
                DRM_ERROR("amdgpu: fence wait failed (%d).\n", r);
                goto error;
        }
        DRM_INFO("ib test on ring %d succeeded\n",  ring->idx);
 error:
-       amdgpu_fence_unref(&fence);
+       fence_put(fence);
        amdgpu_asic_set_uvd_clocks(adev, 0, 0);
        return r;
 }
index 49aa931b2cb4dad3c0fc6ad7da17b493babafe7a..66c975870e974870011de9de0603c4c5926070f6 100644 (file)
@@ -575,7 +575,7 @@ static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring,
  */
 static int uvd_v6_0_ring_test_ib(struct amdgpu_ring *ring)
 {
-       struct amdgpu_fence *fence = NULL;
+       struct fence *fence = NULL;
        int r;
 
        r = amdgpu_uvd_get_create_msg(ring, 1, NULL);
@@ -590,14 +590,14 @@ static int uvd_v6_0_ring_test_ib(struct amdgpu_ring *ring)
                goto error;
        }
 
-       r = amdgpu_fence_wait(fence, false);
+       r = fence_wait(fence, false);
        if (r) {
                DRM_ERROR("amdgpu: fence wait failed (%d).\n", r);
                goto error;
        }
        DRM_INFO("ib test on ring %d succeeded\n",  ring->idx);
 error:
-       amdgpu_fence_unref(&fence);
+       fence_put(fence);
        return r;
 }