drm/amdgpu: earlier free SA resources
authorChristian König <christian.koenig@amd.com>
Wed, 29 Jun 2016 13:10:31 +0000 (15:10 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 19:06:10 +0000 (15:06 -0400)
Keep the time we don't have a fence associated with the resource smaller.

Signed-off-by: Christian König <christian.koenig@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_cs.c
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c

index 4fc879e594aae9d123dab485c7e0c7f284efcea7..9f70546594a8f444d010736107b5fd1a926ebbef 100644 (file)
@@ -760,6 +760,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
 int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size,
                             struct amdgpu_job **job);
 
+void amdgpu_job_free_resources(struct amdgpu_job *job);
 void amdgpu_job_free(struct amdgpu_job *job);
 int amdgpu_job_submit(struct amdgpu_job *job, struct amdgpu_ring *ring,
                      struct amd_sched_entity *entity, void *owner,
index 475c95f670f81f421c8bbd3c5809d3e6b6534dc6..0db32e3b13c0e2ec2a18008424afdd4bb66fbc65 100644 (file)
@@ -855,6 +855,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
        p->fence = fence_get(fence);
        cs->out.handle = amdgpu_ctx_add_fence(p->ctx, ring, fence);
        job->uf_sequence = cs->out.handle;
+       amdgpu_job_free_resources(job);
 
        trace_amdgpu_cs_ioctl(job);
        amd_sched_entity_push_job(&job->base);
index 347962ea17abd6de0be7258d2a99bf80e3ec1892..cdcfda6618d0c0e0ef6c5c1651bc6dfc8da45458 100644 (file)
@@ -79,7 +79,7 @@ int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size,
        return r;
 }
 
-static void amdgpu_job_free_resources(struct amdgpu_job *job)
+void amdgpu_job_free_resources(struct amdgpu_job *job)
 {
        struct fence *f;
        unsigned i;
@@ -127,6 +127,7 @@ int amdgpu_job_submit(struct amdgpu_job *job, struct amdgpu_ring *ring,
        job->owner = owner;
        job->ctx = entity->fence_context;
        *f = fence_get(fence);
+       amdgpu_job_free_resources(job);
        amd_sched_entity_push_job(&job->base);
 
        return 0;
@@ -179,7 +180,6 @@ static struct fence *amdgpu_job_run(struct amd_sched_job *sched_job)
 
 err:
        job->fence = fence;
-       amdgpu_job_free_resources(job);
        return fence;
 }