drm/amdgpu: give a fence param to ib_free
authorMonk Liu <Monk.Liu@amd.com>
Thu, 17 Mar 2016 02:47:07 +0000 (10:47 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 17 Mar 2016 15:53:34 +0000 (11:53 -0400)
thus amdgpu_ib_free() can hook sched fence to SA manager
in later patches.

BTW:
for amdgpu_free_job(), it should only fence_put() the
fence of the last ib once, so fix it as well in this patch.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
drivers/gpu/drm/amd/amdgpu/cik_sdma.c
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c

index 31fd7ee62e69af4ad39eba47996206910d078b41..0523f11d915a6c08e3a1dee591349626d1bfef1f 100644 (file)
@@ -1178,7 +1178,7 @@ struct amdgpu_gfx {
 
 int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
                  unsigned size, struct amdgpu_ib *ib);
-void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib);
+void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib, struct fence *f);
 int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
                       struct amdgpu_ib *ib, struct fence *last_vm_update,
                       struct fence **f);
index 798d466268208cb9364998e6024f02349d3f0b5b..345cac9948be4778cea81ad38e1985be2567aa43 100644 (file)
@@ -85,12 +85,13 @@ int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
  *
  * @adev: amdgpu_device pointer
  * @ib: IB object to free
+ * @f: the fence SA bo need wait on for the ib alloation
  *
  * Free an IB (all asics).
  */
-void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib)
+void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib, struct fence *f)
 {
-       amdgpu_sa_bo_free(adev, &ib->sa_bo, ib->fence);
+       amdgpu_sa_bo_free(adev, &ib->sa_bo, f);
        fence_put(ib->fence);
 }
 
index 692b45560d0a8142f5e9d5aa17b9406057091e47..df2f66666f85e5f8915aefb40ca251cc0c68b7aa 100644 (file)
@@ -72,7 +72,8 @@ void amdgpu_job_free(struct amdgpu_job *job)
        unsigned i;
 
        for (i = 0; i < job->num_ibs; ++i)
-               amdgpu_ib_free(job->adev, &job->ibs[i]);
+               amdgpu_sa_bo_free(job->adev, &job->ibs[i].sa_bo, job->ibs[job->num_ibs - 1].fence);
+       fence_put(job->ibs[job->num_ibs - 1].fence);
 
        amdgpu_bo_unref(&job->uf.bo);
        amdgpu_sync_free(&job->sync);
index 8663a27018a4986817092b3bba1dec2b762a6321..35cacc52e98411b07c3e9f16d595634090dfcd92 100644 (file)
@@ -669,7 +669,7 @@ static int cik_sdma_ring_test_ib(struct amdgpu_ring *ring)
 
 err1:
        fence_put(f);
-       amdgpu_ib_free(adev, &ib);
+       amdgpu_ib_free(adev, &ib, NULL);
 err0:
        amdgpu_wb_free(adev, index);
        return r;
index a4913ebb673c236d8c0960f2689545ba6e64a2da..0b0689275b2684ad9b70ff5e027d1870449c6272 100644 (file)
@@ -2163,7 +2163,7 @@ static int gfx_v7_0_ring_test_ib(struct amdgpu_ring *ring)
 
 err2:
        fence_put(f);
-       amdgpu_ib_free(adev, &ib);
+       amdgpu_ib_free(adev, &ib, NULL);
 err1:
        amdgpu_gfx_scratch_free(adev, scratch);
        return r;
index 828e205a7326a0f1bc3c042b4e4526c8b0245741..7075bf7fcd69fa534131e45fef6087e8b30c8815 100644 (file)
@@ -732,7 +732,7 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring)
        }
 err2:
        fence_put(f);
-       amdgpu_ib_free(adev, &ib);
+       amdgpu_ib_free(adev, &ib, NULL);
 err1:
        amdgpu_gfx_scratch_free(adev, scratch);
        return r;
@@ -1289,7 +1289,7 @@ static int gfx_v8_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
 
 fail:
        fence_put(f);
-       amdgpu_ib_free(adev, &ib);
+       amdgpu_ib_free(adev, &ib, NULL);
 
        return r;
 }
index 6ac6cddf809eff03f89f2a88746039b2c55d89d0..5f148bd2d8ef668930765d131c91aa46d12f7797 100644 (file)
@@ -727,7 +727,7 @@ static int sdma_v2_4_ring_test_ib(struct amdgpu_ring *ring)
 
 err1:
        fence_put(f);
-       amdgpu_ib_free(adev, &ib);
+       amdgpu_ib_free(adev, &ib, NULL);
 err0:
        amdgpu_wb_free(adev, index);
        return r;
index 4c24c371fec71c16cb77c0e48a7e7a14c2e8f191..1d67bce5b3596b38314fd97890bc50da9671458c 100644 (file)
@@ -878,7 +878,7 @@ static int sdma_v3_0_ring_test_ib(struct amdgpu_ring *ring)
        }
 err1:
        fence_put(f);
-       amdgpu_ib_free(adev, &ib);
+       amdgpu_ib_free(adev, &ib, NULL);
 err0:
        amdgpu_wb_free(adev, index);
        return r;