summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2016-05-06 15:57:42 +0200
committerAlex Deucher <alexander.deucher@amd.com>2016-05-11 13:30:31 -0400
commit92f250989b7098f4b52d50183a7b2fc4e010731b (patch)
tree27e9b9a83675ce36313a789dac7ad27a827d671f /drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
parentf153d2867bf74f84d47f67c377a8e3a34865e562 (diff)
downloadlinux-92f250989b7098f4b52d50183a7b2fc4e010731b.tar.bz2
drm/amdgpu: move the context from the IBs into the job
We only have one context for all IBs. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 88b8fda7340f..dacbd2e32072 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -121,18 +121,26 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
{
struct amdgpu_device *adev = ring->adev;
struct amdgpu_ib *ib = &ibs[0];
- struct fence *hwf;
- struct amdgpu_vm *vm = NULL;
- unsigned i, patch_offset = ~0;
bool skip_preamble, need_ctx_switch;
+ unsigned patch_offset = ~0;
+ struct amdgpu_vm *vm;
+ struct fence *hwf;
+ uint64_t ctx;
+ unsigned i;
int r = 0;
if (num_ibs == 0)
return -EINVAL;
- if (job) /* for domain0 job like ring test, ibs->job is not assigned */
+ /* ring tests don't use a job */
+ if (job) {
vm = job->vm;
+ ctx = job->ctx;
+ } else {
+ vm = NULL;
+ ctx = 0;
+ }
if (!ring->ready) {
dev_err(adev->dev, "couldn't schedule ib\n");
@@ -170,8 +178,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
/* always set cond_exec_polling to CONTINUE */
*ring->cond_exe_cpu_addr = 1;
- skip_preamble = ring->current_ctx == ib->ctx;
- need_ctx_switch = ring->current_ctx != ib->ctx;
+ skip_preamble = ring->current_ctx == ctx;
+ need_ctx_switch = ring->current_ctx != ctx;
for (i = 0; i < num_ibs; ++i) {
ib = &ibs[i];
@@ -209,7 +217,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
if (patch_offset != ~0 && ring->funcs->patch_cond_exec)
amdgpu_ring_patch_cond_exec(ring, patch_offset);
- ring->current_ctx = ibs->ctx;
+ ring->current_ctx = ctx;
amdgpu_ring_commit(ring);
return 0;
}