[PATCH 1/2] drm/amdgpu: do not call insert_nop fn for zero count

Christian König christian.koenig at amd.com
Wed Jul 31 09:24:17 UTC 2024


Adding Tvrtko since he was working on a similar patch.

Am 31.07.24 um 10:12 schrieb Sunil Khatri:
> Do not make a function call for zero size NOP as it
> does not add anything in the ring and is unnecessary
> function call.
>
> Signed-off-by: Sunil Khatri <sunil.khatri at amd.com>

Please double check if we have some count==0 handling in some of the NOP 
functions and if possible remove them.

Apart from that this patch set is Reviewed-by: Christian König 
<christian.koenig at amd.com>.

Thanks,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> index ad49cecb20b8..0d72d2cbb64b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> @@ -145,7 +145,9 @@ void amdgpu_ring_commit(struct amdgpu_ring *ring)
>   	count = ring->funcs->align_mask + 1 -
>   		(ring->wptr & ring->funcs->align_mask);
>   	count %= ring->funcs->align_mask + 1;
> -	ring->funcs->insert_nop(ring, count);
> +
> +	if (count != 0)
> +		ring->funcs->insert_nop(ring, count);
>   
>   	mb();
>   	amdgpu_ring_set_wptr(ring);



More information about the amd-gfx mailing list