[PATCH 1/2] drm/amdgpu: amdgpu_ctx_add_fence can't fail

Chunming Zhou zhoucm1 at amd.com
Fri Aug 24 13:24:52 UTC 2018



在 2018/8/24 20:50, Christian König 写道:
> No more waiting for a fence done here.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
Reviewed-by: Chunming Zhou <david1.zhou at amd.com>


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 10 +---------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c |  8 +++-----
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h |  6 +++---
>   3 files changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index fd3902983195..80ad23061f1c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -1217,15 +1217,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
>   	job->owner = p->filp;
>   	p->fence = dma_fence_get(&job->base.s_fence->finished);
>   
> -	r = amdgpu_ctx_add_fence(p->ctx, entity, p->fence, &seq);
> -	if (r) {
> -		dma_fence_put(p->fence);
> -		dma_fence_put(&job->base.s_fence->finished);
> -		amdgpu_job_free(job);
> -		amdgpu_mn_unlock(p->mn);
> -		return r;
> -	}
> -
> +	amdgpu_ctx_add_fence(p->ctx, entity, p->fence, &seq);
>   	amdgpu_cs_post_dependencies(p);
>   
>   	if ((job->preamble_status & AMDGPU_PREAMBLE_IB_PRESENT) &&
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index 987b7f256463..f9b54236102d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -434,9 +434,9 @@ int amdgpu_ctx_put(struct amdgpu_ctx *ctx)
>   	return 0;
>   }
>   
> -int amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx,
> -			 struct drm_sched_entity *entity,
> -			 struct dma_fence *fence, uint64_t* handle)
> +void amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx,
> +			  struct drm_sched_entity *entity,
> +			  struct dma_fence *fence, uint64_t* handle)
>   {
>   	struct amdgpu_ctx_entity *centity = to_amdgpu_ctx_entity(entity);
>   	uint64_t seq = centity->sequence;
> @@ -458,8 +458,6 @@ int amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx,
>   	dma_fence_put(other);
>   	if (handle)
>   		*handle = seq;
> -
> -	return 0;
>   }
>   
>   struct dma_fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h
> index d67c1d285a4f..b3b012c0a7da 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h
> @@ -65,9 +65,9 @@ int amdgpu_ctx_put(struct amdgpu_ctx *ctx);
>   
>   int amdgpu_ctx_get_entity(struct amdgpu_ctx *ctx, u32 hw_ip, u32 instance,
>   			  u32 ring, struct drm_sched_entity **entity);
> -int amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx,
> -			 struct drm_sched_entity *entity,
> -			 struct dma_fence *fence, uint64_t *seq);
> +void amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx,
> +			  struct drm_sched_entity *entity,
> +			  struct dma_fence *fence, uint64_t *seq);
>   struct dma_fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,
>   				       struct drm_sched_entity *entity,
>   				       uint64_t seq);



More information about the amd-gfx mailing list