From: Jammy Zhou Date: Mon, 3 Aug 2015 02:27:57 +0000 (+0800) Subject: drm/amdgpu: add amd_sched_next_queued_seq function X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=27f6642d066ecea7b535dd9b24e2f41e54f3dd85;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git drm/amdgpu: add amd_sched_next_queued_seq function This function is used to get the next queued sequence number Signed-off-by: Jammy Zhou Reviewed-by: Christian König Reviewed-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index e0eaa55bf636..6766ead31c4d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -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; diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c index 55ebbf0f8cd0..4ad1825e713e 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c @@ -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; +} diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h index 44f71cdf7c33..fd6d699d42e1 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h @@ -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