On 01.09.25 12:00, Timur Kristóf wrote:
> The amdgpu_bo_create_kernel function takes a byte count,
> so we need to multiply the extra dword count by four.
> (The ring_size is already in bytes so that one is correct here.)
Good catch, it just doesn't make a difference in practice since everything is
rounded up to 4k anyway.
But I'm really wondering if we shouldn't replace the extra_dw with extra_bytes
instead.
It should only be used by some multimedia engines anyway.
Regards,
Christian.
>
> Fixes: c8c1a1d2ef04 ("drm/amdgpu: define and add extra dword for jpeg ring")
> Signed-off-by: Timur Kristóf <[email protected]>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> index 6379bb25bf5c..13f0f0209cbe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> @@ -364,11 +364,12 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct
> amdgpu_ring *ring,
>
> /* Allocate ring buffer */
> if (ring->ring_obj == NULL) {
> - r = amdgpu_bo_create_kernel(adev, ring->ring_size +
> ring->funcs->extra_dw, PAGE_SIZE,
> - AMDGPU_GEM_DOMAIN_GTT,
> - &ring->ring_obj,
> - &ring->gpu_addr,
> - (void **)&ring->ring);
> + r = amdgpu_bo_create_kernel(adev, ring->ring_size +
> ring->funcs->extra_dw * 4,
> + PAGE_SIZE,
> + AMDGPU_GEM_DOMAIN_GTT,
> + &ring->ring_obj,
> + &ring->gpu_addr,
> + (void **)&ring->ring);
> if (r) {
> dev_err(adev->dev, "(%d) ring create failed\n", r);
> kvfree(ring->ring_backup);