aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
diff options
context:
space:
mode:
authorMonk Liu <monk.liu@amd.com>2016-01-14 06:07:38 -0500
committerAlex Deucher <alexander.deucher@amd.com>2016-05-02 15:11:09 -0400
commit03ccf481980f8d3363263e73c64473d8f2779dc0 (patch)
treedf0cad433591814429cc700ad4a013d51bdaec53 /drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
parent128cff1af68689cf4d85d3ba948c86a194dee30f (diff)
drm/amdgpu: patch cond exec for SDMA
More ground work for conditional execution on SDMA necessary for preemption. Signed-off-by: Monk Liu <monk.liu@amd.com> Reviewed-by: Christian König <christian.koenig@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.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index a15d690d9089..644336d76aca 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -124,7 +124,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
124 struct amdgpu_ctx *ctx, *old_ctx; 124 struct amdgpu_ctx *ctx, *old_ctx;
125 struct amdgpu_vm *vm; 125 struct amdgpu_vm *vm;
126 struct fence *hwf; 126 struct fence *hwf;
127 unsigned i; 127 unsigned i, patch_offset = ~0;
128
128 int r = 0; 129 int r = 0;
129 130
130 if (num_ibs == 0) 131 if (num_ibs == 0)
@@ -149,6 +150,9 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
149 return r; 150 return r;
150 } 151 }
151 152
153 if (ring->type == AMDGPU_RING_TYPE_SDMA && ring->funcs->init_cond_exec)
154 patch_offset = amdgpu_ring_init_cond_exec(ring);
155
152 if (vm) { 156 if (vm) {
153 /* do context switch */ 157 /* do context switch */
154 amdgpu_vm_flush(ring, ib->vm_id, ib->vm_pd_addr, 158 amdgpu_vm_flush(ring, ib->vm_id, ib->vm_pd_addr,
@@ -204,6 +208,9 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
204 if (f) 208 if (f)
205 *f = fence_get(hwf); 209 *f = fence_get(hwf);
206 210
211 if (patch_offset != ~0 && ring->funcs->patch_cond_exec)
212 amdgpu_ring_patch_cond_exec(ring, patch_offset);
213
207 amdgpu_ring_commit(ring); 214 amdgpu_ring_commit(ring);
208 return 0; 215 return 0;
209} 216}