drm/amdgpu: add amd_sched_next_queued_seq function
authorJammy Zhou <Jammy.Zhou@amd.com>
Mon, 3 Aug 2015 02:27:57 +0000 (10:27 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 17 Aug 2015 20:50:58 +0000 (16:50 -0400)
This function is used to get the next queued sequence number

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

index e0eaa55bf636f9255173375a4bebc80ea28a6ed1..6766ead31c4d25bb4687338eca4201fc0fef21e2 100644 (file)
@@ -310,7 +310,7 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,
 
        spin_lock(&ctx->ring_lock);
        if (amdgpu_enable_scheduler)
-               queued_seq = atomic64_read(&cring->c_entity.last_queued_v_seq) + 1;
+               queued_seq = amd_sched_next_queued_seq(&cring->c_entity);
        else
                queued_seq = cring->sequence;
 
index 55ebbf0f8cd0a03606a0cf7f822e62c8c4797d33..4ad1825e713e09abe7b22366d91ba2a9a5e81db8 100644 (file)
@@ -507,3 +507,15 @@ void amd_sched_emit(struct amd_context_entity *c_entity, uint64_t seq)
        atomic64_set(&c_entity->last_emitted_v_seq, seq);
        wake_up_all(&c_entity->wait_emit);
 }
+
+/**
+ * Get next queued sequence number
+ *
+ * @entity The context entity
+ *
+ * return the next queued sequence number
+*/
+uint64_t amd_sched_next_queued_seq(struct amd_context_entity *c_entity)
+{
+       return atomic64_read(&c_entity->last_queued_v_seq) + 1;
+}
index 44f71cdf7c332b69becf09cbd2991d8d568d887c..fd6d699d42e1a48c58bca4f26203efe172a37f9c 100644 (file)
@@ -153,4 +153,6 @@ int amd_context_entity_init(struct amd_gpu_scheduler *sched,
 
 void amd_sched_emit(struct amd_context_entity *c_entity, uint64_t seq);
 
+uint64_t amd_sched_next_queued_seq(struct amd_context_entity *c_entity);
+
 #endif