mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-27 12:55:59 -05:00
drm/amdgpu: optimize insert_nop using multi dwords
Optimize the ring_insert_nop fn for n dwords in one step rather then call to amdgpu_ring_write for each nop packet. This avoid function call for each nop packet and also wptr is updated once only. Signed-off-by: Sunil Khatri <sunil.khatri@amd.com> Suggested-by: Christian König <christian.koenig@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
ed3dac4bf9
commit
ea4e4754c9
@@ -108,10 +108,26 @@ int amdgpu_ring_alloc(struct amdgpu_ring *ring, unsigned int ndw)
|
||||
*/
|
||||
void amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
|
||||
{
|
||||
int i;
|
||||
uint32_t occupied, chunk1, chunk2;
|
||||
uint32_t *dst;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
amdgpu_ring_write(ring, ring->funcs->nop);
|
||||
occupied = ring->wptr & ring->buf_mask;
|
||||
dst = (void *)&ring->ring[occupied];
|
||||
chunk1 = ring->buf_mask + 1 - occupied;
|
||||
chunk1 = (chunk1 >= count) ? count : chunk1;
|
||||
chunk2 = count - chunk1;
|
||||
|
||||
if (chunk1)
|
||||
memset32(dst, ring->funcs->nop, chunk1);
|
||||
|
||||
if (chunk2) {
|
||||
dst = (void *)ring->ring;
|
||||
memset32(dst, ring->funcs->nop, chunk2);
|
||||
}
|
||||
|
||||
ring->wptr += count;
|
||||
ring->wptr &= ring->ptr_mask;
|
||||
ring->count_dw -= count;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user