[PATCH 10/18] drm/amd: add last fence in sched entity
Chunming Zhou
David1.Zhou at amd.com
Fri Aug 12 06:38:59 UTC 2016
Change-Id: I68f67da25c482ac9dbd26e186cb953a539555a74
Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
---
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 9 +++++++--
drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
index f96aa82..5dab231 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
@@ -134,6 +134,7 @@ int amd_sched_entity_init(struct amd_gpu_scheduler *sched,
INIT_LIST_HEAD(&entity->list);
entity->rq = rq;
entity->sched = sched;
+ entity->last_fence = NULL;
spin_lock_init(&entity->queue_lock);
r = kfifo_alloc(&entity->job_queue, jobs * sizeof(void *), GFP_KERNEL);
@@ -219,6 +220,7 @@ void amd_sched_entity_fini(struct amd_gpu_scheduler *sched,
amd_sched_rq_remove_entity(rq, entity);
kfifo_free(&entity->job_queue);
+ fence_put(entity->last_fence);
}
static void amd_sched_entity_wakeup(struct fence *f, struct fence_cb *cb)
@@ -304,6 +306,7 @@ static bool amd_sched_entity_in(struct amd_sched_job *sched_job)
{
struct amd_gpu_scheduler *sched = sched_job->sched;
struct amd_sched_entity *entity = sched_job->s_entity;
+ struct amd_sched_fence *s_fence = sched_job->s_fence;
bool added, first = false;
spin_lock(&entity->queue_lock);
@@ -312,9 +315,11 @@ static bool amd_sched_entity_in(struct amd_sched_job *sched_job)
if (added && kfifo_len(&entity->job_queue) == sizeof(sched_job))
first = true;
-
+ if (added) {
+ fence_put(entity->last_fence);
+ entity->last_fence = fence_get(&s_fence->finished);
+ }
spin_unlock(&entity->queue_lock);
-
/* first job wakes up scheduler */
if (first) {
/* Add the entity to the run queue */
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
index 7cbbbfb..256a851 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
@@ -49,6 +49,7 @@ struct amd_sched_entity {
atomic_t fence_seq;
uint64_t fence_context;
+ struct fence *last_fence;
struct fence *dependency;
struct fence_cb cb;
--
1.9.1
More information about the amd-gfx
mailing list