aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2016-05-06 08:52:57 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-05-11 13:30:30 -0400
commit9f8fb5a2b339ba83493991ca8f1173a939a696d3 (patch)
tree7a2e13996140d08ee2df803442e43c7e0dcbc529 /drivers/gpu/drm/amd/amdgpu
parent914f9e18c859d9413058c3632aba54d348a6527e (diff)
drm/amdgpu: move preamble IB handling into common code
This fixes the handling which was completely broken when you ad more than one preamble IB. 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')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c4
3 files changed, 7 insertions, 9 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index f670519efbbc..d6f85923edcd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -125,6 +125,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
125 struct fence *hwf; 125 struct fence *hwf;
126 struct amdgpu_vm *vm = NULL; 126 struct amdgpu_vm *vm = NULL;
127 unsigned i, patch_offset = ~0; 127 unsigned i, patch_offset = ~0;
128 bool skip_preamble;
128 129
129 int r = 0; 130 int r = 0;
130 131
@@ -172,9 +173,14 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
172 /* always set cond_exec_polling to CONTINUE */ 173 /* always set cond_exec_polling to CONTINUE */
173 *ring->cond_exe_cpu_addr = 1; 174 *ring->cond_exe_cpu_addr = 1;
174 175
176 skip_preamble = ring->current_ctx == ctx;
175 old_ctx = ring->current_ctx; 177 old_ctx = ring->current_ctx;
176 for (i = 0; i < num_ibs; ++i) { 178 for (i = 0; i < num_ibs; ++i) {
177 ib = &ibs[i]; 179
180 /* drop preamble IBs if we don't have a context switch */
181 if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && skip_preamble)
182 continue;
183
178 amdgpu_ring_emit_ib(ring, ib); 184 amdgpu_ring_emit_ib(ring, ib);
179 ring->current_ctx = ctx; 185 ring->current_ctx = ctx;
180 } 186 }
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index f4068f753fbe..d82fa9641f0e 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -2036,10 +2036,6 @@ static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
2036 u32 header, control = 0; 2036 u32 header, control = 0;
2037 u32 next_rptr = ring->wptr + 5; 2037 u32 next_rptr = ring->wptr + 5;
2038 2038
2039 /* drop the CE preamble IB for the same context */
2040 if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && !need_ctx_switch)
2041 return;
2042
2043 if (need_ctx_switch) 2039 if (need_ctx_switch)
2044 next_rptr += 2; 2040 next_rptr += 2;
2045 2041
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 7886228b8318..9a0b6df210c1 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -5652,10 +5652,6 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
5652 u32 header, control = 0; 5652 u32 header, control = 0;
5653 u32 next_rptr = ring->wptr + 5; 5653 u32 next_rptr = ring->wptr + 5;
5654 5654
5655 /* drop the CE preamble IB for the same context */
5656 if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && !need_ctx_switch)
5657 return;
5658
5659 if (need_ctx_switch) 5655 if (need_ctx_switch)
5660 next_rptr += 2; 5656 next_rptr += 2;
5661 5657