uint32_t length_dw;
uint64_t gpu_addr;
uint32_t *ptr;
- struct fence *fence;
struct amdgpu_user_fence *user;
struct amdgpu_vm *vm;
unsigned vm_id;
struct amdgpu_ring *ring;
struct amdgpu_sync sync;
struct amdgpu_ib *ibs;
+ struct fence *fence; /* the hw fence */
uint32_t num_ibs;
void *owner;
struct amdgpu_user_fence uf;
void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib, struct fence *f)
{
amdgpu_sa_bo_free(adev, &ib->sa_bo, f);
- fence_put(ib->fence);
}
/**
struct amdgpu_ib *ib = &ibs[0];
struct amdgpu_ctx *ctx, *old_ctx;
struct amdgpu_vm *vm;
+ struct fence *hwf;
unsigned i;
int r = 0;
amdgpu_ring_emit_hdp_invalidate(ring);
}
- r = amdgpu_fence_emit(ring, &ib->fence);
+ r = amdgpu_fence_emit(ring, &hwf);
if (r) {
dev_err(adev->dev, "failed to emit fence (%d)\n", r);
ring->current_ctx = old_ctx;
}
if (f)
- *f = fence_get(ib->fence);
+ *f = fence_get(hwf);
amdgpu_ring_commit(ring);
return 0;
unsigned i;
for (i = 0; i < job->num_ibs; ++i)
- amdgpu_sa_bo_free(job->adev, &job->ibs[i].sa_bo, job->ibs[job->num_ibs - 1].fence);
- fence_put(job->ibs[job->num_ibs - 1].fence);
+ amdgpu_sa_bo_free(job->adev, &job->ibs[i].sa_bo, job->fence);
+ fence_put(job->fence);
amdgpu_bo_unref(&job->uf.bo);
amdgpu_sync_free(&job->sync);
}
err:
+ job->fence = fence;
amdgpu_job_free(job);
return fence;
}
if (direct) {
r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f);
+ job->fence = f;
if (r)
goto err_free;
ib->ptr[i] = 0x0;
r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f);
+ job->fence = f;
if (r)
goto err;
if (direct) {
r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f);
+ job->fence = f;
if (r)
goto err;
err1:
fence_put(f);
amdgpu_ib_free(adev, &ib, NULL);
+ fence_put(f);
err0:
amdgpu_wb_free(adev, index);
return r;
err2:
fence_put(f);
amdgpu_ib_free(adev, &ib, NULL);
+ fence_put(f);
err1:
amdgpu_gfx_scratch_free(adev, scratch);
return r;
err2:
fence_put(f);
amdgpu_ib_free(adev, &ib, NULL);
+ fence_put(f);
err1:
amdgpu_gfx_scratch_free(adev, scratch);
return r;
fail:
fence_put(f);
amdgpu_ib_free(adev, &ib, NULL);
+ fence_put(f);
return r;
}
err1:
fence_put(f);
amdgpu_ib_free(adev, &ib, NULL);
+ fence_put(f);
err0:
amdgpu_wb_free(adev, index);
return r;
err1:
fence_put(f);
amdgpu_ib_free(adev, &ib, NULL);
+ fence_put(f);
err0:
amdgpu_wb_free(adev, index);
return r;