[PATCH 05/13] drm/amdgpu:fix ring init sequence

Deucher, Alexander Alexander.Deucher at amd.com
Mon Mar 27 15:54:30 UTC 2017


> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Monk Liu
> Sent: Friday, March 24, 2017 6:38 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Liu, Monk
> Subject: [PATCH 05/13] drm/amdgpu:fix ring init sequence
> 
> ring->buf_mask need be set prior to ring_clear_ring invoke
> and fix ring_clear_ring as well which should use buf_mask
> instead of ptr_mask
> 
> Change-Id: I7778a7afe27ac2bdedcaba1b0146582100602f9d
> Signed-off-by: Monk Liu <Monk.Liu at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 6 +++---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> index e619833..10e94d0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> @@ -235,6 +235,9 @@ int amdgpu_ring_init(struct amdgpu_device *adev,
> struct amdgpu_ring *ring,
>  	ring->ring_size = roundup_pow_of_two(max_dw * 4 *
>  					     amdgpu_sched_hw_submission);
> 
> +	ring->buf_mask = (ring->ring_size / 4) - 1;
> +	ring->ptr_mask = ring->funcs->support_64bit_ptrs ?
> +		0xffffffffffffffff : ring->buf_mask;
>  	/* Allocate ring buffer */
>  	if (ring->ring_obj == NULL) {
>  		r = amdgpu_bo_create_kernel(adev, ring->ring_size,
> PAGE_SIZE,
> @@ -248,9 +251,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev,
> struct amdgpu_ring *ring,
>  		}
>  		amdgpu_ring_clear_ring(ring);
>  	}
> -	ring->buf_mask = (ring->ring_size / 4) - 1;
> -	ring->ptr_mask = ring->funcs->support_64bit_ptrs ?
> -		0xffffffffffffffff : ring->buf_mask;
> 
>  	ring->max_dw = max_dw;
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> index 9f57eda..5fd3dd1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> @@ -194,7 +194,7 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring);
>  static inline void amdgpu_ring_clear_ring(struct amdgpu_ring *ring)
>  {
>  	int i = 0;
> -	while (i <= ring->ptr_mask)
> +	while (i <= ring->buf_mask)
>  		ring->ring[i++] = ring->funcs->nop;
> 
>  }
> --
> 2.7.4
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list