diff mbox series

[1/7] drm/radeon: stop using pages with drm_prime_sg_to_page_addr_arrays v2

Message ID 20201125125919.1372-1-christian.koenig@amd.com (mailing list archive)
State New, archived
Headers show
Series [1/7] drm/radeon: stop using pages with drm_prime_sg_to_page_addr_arrays v2 | expand

Commit Message

Christian König Nov. 25, 2020, 12:59 p.m. UTC
This is deprecated.

v2: also use ttm_sg_tt_init to avoid allocating the page array.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/radeon/radeon_ttm.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Christian König Nov. 27, 2020, 2:11 p.m. UTC | #1
Ping? Daniel any more ideas on this or should we push it?

Thanks,
Christian.

Am 25.11.20 um 13:59 schrieb Christian König:
> This is deprecated.
>
> v2: also use ttm_sg_tt_init to avoid allocating the page array.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/gpu/drm/radeon/radeon_ttm.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
> index 0ca381b95d3d..5d00b3dff388 100644
> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> @@ -401,8 +401,8 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_bo_device *bdev, struct ttm_tt *
>   	if (r)
>   		goto release_sg;
>   
> -	drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
> -					 gtt->ttm.dma_address, ttm->num_pages);
> +	drm_prime_sg_to_page_addr_arrays(ttm->sg, NULL, gtt->ttm.dma_address,
> +					 ttm->num_pages);
>   
>   	return 0;
>   
> @@ -542,7 +542,7 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo,
>   	else
>   		caching = ttm_cached;
>   
> -	if (ttm_dma_tt_init(&gtt->ttm, bo, page_flags, caching)) {
> +	if (ttm_sg_tt_init(&gtt->ttm, bo, page_flags, caching)) {
>   		kfree(gtt);
>   		return NULL;
>   	}
> @@ -580,8 +580,9 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,
>   	}
>   
>   	if (slave && ttm->sg) {
> -		drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
> -						 gtt->ttm.dma_address, ttm->num_pages);
> +		drm_prime_sg_to_page_addr_arrays(ttm->sg, NULL,
> +						 gtt->ttm.dma_address,
> +						 ttm->num_pages);
>   		return 0;
>   	}
>
Daniel Vetter Nov. 27, 2020, 3:07 p.m. UTC | #2
On Fri, Nov 27, 2020 at 03:11:05PM +0100, Christian König wrote:
> Ping? Daniel any more ideas on this or should we push it?

Occasionally I bit more prose would be nice about why things changed or
so. Iirc the reason I asked about using ttm_sg_tt_init is that it makes it
easier to convince ourselves that we don't mix things up. Maybe add that
(or cover letter next time around). Just helps since at least my silly
brain forgets details like that within days, and is usually terminally
lost when git bisect lands on such a patch. Also helps reviewers stay
motivated sometimes :-)

Anyway I think this looks all reasonable now, on the series:

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> 
> Thanks,
> Christian.
> 
> Am 25.11.20 um 13:59 schrieb Christian König:
> > This is deprecated.
> > 
> > v2: also use ttm_sg_tt_init to avoid allocating the page array.
> > 
> > Signed-off-by: Christian König <christian.koenig@amd.com>
> > ---
> >   drivers/gpu/drm/radeon/radeon_ttm.c | 11 ++++++-----
> >   1 file changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
> > index 0ca381b95d3d..5d00b3dff388 100644
> > --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> > +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> > @@ -401,8 +401,8 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_bo_device *bdev, struct ttm_tt *
> >   	if (r)
> >   		goto release_sg;
> > -	drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
> > -					 gtt->ttm.dma_address, ttm->num_pages);
> > +	drm_prime_sg_to_page_addr_arrays(ttm->sg, NULL, gtt->ttm.dma_address,
> > +					 ttm->num_pages);
> >   	return 0;
> > @@ -542,7 +542,7 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo,
> >   	else
> >   		caching = ttm_cached;
> > -	if (ttm_dma_tt_init(&gtt->ttm, bo, page_flags, caching)) {
> > +	if (ttm_sg_tt_init(&gtt->ttm, bo, page_flags, caching)) {
> >   		kfree(gtt);
> >   		return NULL;
> >   	}
> > @@ -580,8 +580,9 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,
> >   	}
> >   	if (slave && ttm->sg) {
> > -		drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
> > -						 gtt->ttm.dma_address, ttm->num_pages);
> > +		drm_prime_sg_to_page_addr_arrays(ttm->sg, NULL,
> > +						 gtt->ttm.dma_address,
> > +						 ttm->num_pages);
> >   		return 0;
> >   	}
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 0ca381b95d3d..5d00b3dff388 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -401,8 +401,8 @@  static int radeon_ttm_tt_pin_userptr(struct ttm_bo_device *bdev, struct ttm_tt *
 	if (r)
 		goto release_sg;
 
-	drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
-					 gtt->ttm.dma_address, ttm->num_pages);
+	drm_prime_sg_to_page_addr_arrays(ttm->sg, NULL, gtt->ttm.dma_address,
+					 ttm->num_pages);
 
 	return 0;
 
@@ -542,7 +542,7 @@  static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo,
 	else
 		caching = ttm_cached;
 
-	if (ttm_dma_tt_init(&gtt->ttm, bo, page_flags, caching)) {
+	if (ttm_sg_tt_init(&gtt->ttm, bo, page_flags, caching)) {
 		kfree(gtt);
 		return NULL;
 	}
@@ -580,8 +580,9 @@  static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,
 	}
 
 	if (slave && ttm->sg) {
-		drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
-						 gtt->ttm.dma_address, ttm->num_pages);
+		drm_prime_sg_to_page_addr_arrays(ttm->sg, NULL,
+						 gtt->ttm.dma_address,
+						 ttm->num_pages);
 		return 0;
 	}