[PATCH 6/6] drm/amdgpu: use amdgpu_bo_create_kernel in amdgpu_ring.c

Deucher, Alexander Alexander.Deucher at amd.com
Thu Jul 28 03:56:32 UTC 2016


> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Christian König
> Sent: Tuesday, July 26, 2016 4:00 AM
> To: amd-gfx at lists.freedesktop.org
> Subject: [PATCH 6/6] drm/amdgpu: use amdgpu_bo_create_kernel in
> amdgpu_ring.c
> 
> From: Christian König <christian.koenig at amd.com>
> 
> Saves us quite a bunch of code.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>

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

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 27 +++++---------------------
> -
>  1 file changed, 5 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> index 85aeb0a..242ba04 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> @@ -222,33 +222,16 @@ int amdgpu_ring_init(struct amdgpu_device *adev,
> struct amdgpu_ring *ring,
> 
>  	/* Allocate ring buffer */
>  	if (ring->ring_obj == NULL) {
> -		r = amdgpu_bo_create(adev, ring->ring_size, PAGE_SIZE,
> true,
> -				     AMDGPU_GEM_DOMAIN_GTT, 0,
> -				     NULL, NULL, &ring->ring_obj);
> +		r = amdgpu_bo_create_kernel(adev, ring->ring_size,
> 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);
>  			return r;
>  		}
> -		r = amdgpu_bo_reserve(ring->ring_obj, false);
> -		if (unlikely(r != 0))
> -			return r;
> -		r = amdgpu_bo_pin(ring->ring_obj,
> AMDGPU_GEM_DOMAIN_GTT,
> -					&ring->gpu_addr);
> -		if (r) {
> -			amdgpu_bo_unreserve(ring->ring_obj);
> -			dev_err(adev->dev, "(%d) ring pin failed\n", r);
> -			return r;
> -		}
> -		r = amdgpu_bo_kmap(ring->ring_obj,
> -				       (void **)&ring->ring);
> -
>  		memset((void *)ring->ring, 0, ring->ring_size);
> -
> -		amdgpu_bo_unreserve(ring->ring_obj);
> -		if (r) {
> -			dev_err(adev->dev, "(%d) ring map failed\n", r);
> -			return r;
> -		}
>  	}
>  	ring->ptr_mask = (ring->ring_size / 4) - 1;
>  	ring->max_dw = max_dw;
> --
> 2.5.0
> 
> _______________________________________________
> 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