[PATCH 03/10] drm/amd: add parent for sched fence
Christian König
deathsimple at vodafone.de
Thu Jun 30 07:38:18 UTC 2016
Am 30.06.2016 um 09:09 schrieb Chunming Zhou:
> Parent of sched fence is hw fence which is to signal sched fence.
>
> Change-Id: I9441545175a35875779d050038d0d099995503b8
> Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
> ---
> drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 1 +
> drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | 1 +
> drivers/gpu/drm/amd/scheduler/sched_fence.c | 1 +
> 3 files changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
> index 2baedc4e..3794691 100644
> --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
> +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
> @@ -518,6 +518,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)
> diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
> index 221a515..0a9f086 100644
> --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
> +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
> @@ -70,6 +70,7 @@ struct amd_sched_rq {
> };
>
> struct amd_sched_fence {
> + struct fence *parent;
> struct fence scheduled;
> struct fence finished;
Minor nit pick, don't put parent as the first element in the structure,
that makes casting from scheduled to the parent structure slightly faster.
With that fixed the patch is Reviewed-by: Christian König
<christian.koenig at amd.com>
> struct fence_cb cb;
> diff --git a/drivers/gpu/drm/amd/scheduler/sched_fence.c b/drivers/gpu/drm/amd/scheduler/sched_fence.c
> index a5e3fef..6b63bea 100644
> --- a/drivers/gpu/drm/amd/scheduler/sched_fence.c
> +++ b/drivers/gpu/drm/amd/scheduler/sched_fence.c
> @@ -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);
> }
>
More information about the amd-gfx
mailing list