[PATCH 08/10] drm/amdgpu: save uf_bo addr first since pipeline move
Christian König
deathsimple at vodafone.de
Thu Jun 30 08:19:18 UTC 2016
Am 30.06.2016 um 09:09 schrieb Chunming Zhou:
> Change-Id: I458118b9a5fba070338ff044fd28c5093d02cc3a
> Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
Yeah, I have the same patch in the pipeline. But this won't work like
this see below.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 ++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 4 ++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 1 -
> 4 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 163429c8..35248d0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1273,7 +1273,7 @@ struct amdgpu_job {
> uint32_t oa_base, oa_size;
>
> /* user fence handling */
> - struct amdgpu_bo *uf_bo;
> + uint64_t uf_bo_addr;
> uint32_t uf_offset;
> uint64_t uf_sequence;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index d16ed26..bb0c5ac 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -218,7 +218,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
> goto free_all_kdata;
>
> if (p->uf_entry.robj) {
> - p->job->uf_bo = amdgpu_bo_ref(p->uf_entry.robj);
> + p->job->uf_bo_addr = amdgpu_bo_gpu_offset(p->uf_entry.robj);
The BOs isn't locker nor validate here, so the address might still be
invalid.
Give me a second to cleanup my patch series, so that I can send them out.
Regards,
Christian.
> p->job->uf_offset = uf_offset;
> }
>
> @@ -762,7 +762,7 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,
> }
>
> /* UVD & VCE fw doesn't support user fences */
> - if (parser->job->uf_bo && (
> + if (parser->job->uf_bo_addr && (
> parser->job->ring->type == AMDGPU_RING_TYPE_UVD ||
> parser->job->ring->type == AMDGPU_RING_TYPE_VCE))
> return -EINVAL;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> index 34e3542..5d6a0f3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> @@ -203,8 +203,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
> }
>
> /* wrap the last IB with fence */
> - if (job && job->uf_bo) {
> - uint64_t addr = amdgpu_bo_gpu_offset(job->uf_bo);
> + if (job && job->uf_bo_addr) {
> + uint64_t addr = job->uf_bo_addr;
>
> addr += job->uf_offset;
> amdgpu_ring_emit_fence(ring, addr, job->uf_sequence,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> index b50a845..87b75d7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> @@ -91,7 +91,6 @@ static void amdgpu_job_free_resources(struct amdgpu_job *job)
> amdgpu_ib_free(job->adev, &job->ibs[i], f);
> fence_put(job->fence);
>
> - amdgpu_bo_unref(&job->uf_bo);
> amdgpu_sync_free(&job->sync);
> }
>
More information about the amd-gfx
mailing list