drm/amd: add parent for sched fence
authorChunming Zhou <David1.Zhou@amd.com>
Thu, 30 Jun 2016 03:23:31 +0000 (11:23 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 19:06:13 +0000 (15:06 -0400)
Parent of sched fence is hw fence which is to signal sched fence.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
drivers/gpu/drm/amd/scheduler/sched_fence.c

index 3405372cda0c2f717bdb5b8b31a779ea404d11eb..717655d0c642160226eb1ab69bb185b38e9852d7 100644 (file)
@@ -516,6 +516,7 @@ static int amd_sched_main(void *param)
                fence = sched->ops->run_job(sched_job);
                amd_sched_fence_scheduled(s_fence);
                if (fence) {
+                       s_fence->parent = fence_get(fence);
                        r = fence_add_callback(fence, &s_fence->cb,
                                               amd_sched_process_job);
                        if (r == -ENOENT)
index 9024dc5592e37a1029d8b22f6e9f45ae233f982f..545fda73a05f10042187d394bae65dae7fda6ba7 100644 (file)
@@ -69,6 +69,7 @@ struct amd_sched_fence {
        struct fence                    scheduled;
        struct fence                    finished;
        struct fence_cb                 cb;
+       struct fence                    *parent;
        struct amd_gpu_scheduler        *sched;
        spinlock_t                      lock;
        void                            *owner;
index a5e3fef622fb7bc0f0726c36ad27c48b64977f92..6b63beaf75746848720f98d4eb2b5329c299267b 100644 (file)
@@ -98,6 +98,7 @@ static void amd_sched_fence_free(struct rcu_head *rcu)
        struct fence *f = container_of(rcu, struct fence, rcu);
        struct amd_sched_fence *fence = to_amd_sched_fence(f);
 
+       fence_put(fence->parent);
        kmem_cache_free(sched_fence_slab, fence);
 }