Skip to content

Commit ee7a846

Browse files
committed
drm/amdgpu: Emit cleaner shader at end of IB submission
This commit introduces the emission of a cleaner shader at the end of the IB submission process. This is achieved by adding a new function pointer, `emit_cleaner_shader`, to the `amdgpu_ring_funcs` structure. If the `emit_cleaner_shader` function is set in the ring functions, it is called during the VM flush process. The cleaner shader is only emitted if the `enable_cleaner_shader` flag is set in the `amdgpu_device` structure. This allows the cleaner shader emission to be controlled on a per-device basis. By emitting a cleaner shader at the end of the IB submission, we can ensure that the VM state is properly cleaned up after each submission. Cc: Christian König <[email protected]> Cc: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Signed-off-by: Srinivasan Shanmugam <[email protected]> Suggested-by: Christian König <[email protected]>
1 parent aec773a commit ee7a846

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ struct amdgpu_ring_funcs {
236236
void (*patch_ce)(struct amdgpu_ring *ring, unsigned offset);
237237
void (*patch_de)(struct amdgpu_ring *ring, unsigned offset);
238238
int (*reset)(struct amdgpu_ring *ring, unsigned int vmid);
239+
void (*emit_cleaner_shader)(struct amdgpu_ring *ring);
239240
};
240241

241242
struct amdgpu_ring {

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,10 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
681681
pasid_mapping_needed &= adev->gmc.gmc_funcs->emit_pasid_mapping &&
682682
ring->funcs->emit_wreg;
683683

684+
if (adev->gfx.enable_cleaner_shader &&
685+
ring->funcs->emit_cleaner_shader)
686+
ring->funcs->emit_cleaner_shader(ring);
687+
684688
if (!vm_flush_needed && !gds_switch_needed && !need_pipe_sync)
685689
return 0;
686690

@@ -742,6 +746,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
742746
amdgpu_ring_emit_switch_buffer(ring);
743747
amdgpu_ring_emit_switch_buffer(ring);
744748
}
749+
745750
amdgpu_ring_ib_end(ring);
746751
return 0;
747752
}

0 commit comments

Comments
 (0)