Skip to content

Commit

Permalink
drm/amdgpu: move preamble IB handling into common code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christian König authored and Alex Deucher committed May 11, 2016
1 parent 914f9e1 commit 9f8fb5a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 7 additions & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
struct fence *hwf;
struct amdgpu_vm *vm = NULL;
unsigned i, patch_offset = ~0;
bool skip_preamble;

int r = 0;

Expand Down Expand Up @@ -172,9 +173,14 @@ 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 == ctx;
old_ctx = ring->current_ctx;
for (i = 0; i < num_ibs; ++i) {
ib = &ibs[i];

/* drop preamble IBs if we don't have a context switch */
if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && skip_preamble)
continue;

amdgpu_ring_emit_ib(ring, ib);
ring->current_ctx = ctx;
}
Expand Down
4 changes: 0 additions & 4 deletions drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -2036,10 +2036,6 @@ static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
u32 header, control = 0;
u32 next_rptr = ring->wptr + 5;

/* drop the CE preamble IB for the same context */
if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && !need_ctx_switch)
return;

if (need_ctx_switch)
next_rptr += 2;

Expand Down
4 changes: 0 additions & 4 deletions drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -5652,10 +5652,6 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
u32 header, control = 0;
u32 next_rptr = ring->wptr + 5;

/* drop the CE preamble IB for the same context */
if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && !need_ctx_switch)
return;

if (need_ctx_switch)
next_rptr += 2;

Expand Down

0 comments on commit 9f8fb5a

Please sign in to comment.