[2/8] drm/amdgpu: always bind pinned BOs

Submitted by Christian König on Oct. 26, 2017, 4:06 p.m.

Details

Message ID 1509033983-2977-2-git-send-email-deathsimple@vodafone.de
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Christian König Oct. 26, 2017, 4:06 p.m.
From: Christian König <christian.koenig@amd.com>

We always need to bind pinned BOs, not just when the caller requested the
address.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 76551cd..0b76d83 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -688,15 +688,15 @@  int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 		goto error;
 	}
 
+	r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
+	if (unlikely(r)) {
+		dev_err(adev->dev, "%p bind failed\n", bo);
+		goto error;
+	}
+
 	bo->pin_count = 1;
-	if (gpu_addr != NULL) {
-		r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
-		if (unlikely(r)) {
-			dev_err(adev->dev, "%p bind failed\n", bo);
-			goto error;
-		}
+	if (gpu_addr != NULL)
 		*gpu_addr = amdgpu_bo_gpu_offset(bo);
-	}
 
 	domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type);
 	if (domain == AMDGPU_GEM_DOMAIN_VRAM) {

Comments

> -----Original Message-----

> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf

> Of Christian König

> Sent: Thursday, October 26, 2017 12:06 PM

> To: amd-gfx@lists.freedesktop.org

> Subject: [PATCH 2/8] drm/amdgpu: always bind pinned BOs

> 

> From: Christian König <christian.koenig@amd.com>

> 

> We always need to bind pinned BOs, not just when the caller requested the

> address.

> 

> Signed-off-by: Christian König <christian.koenig@amd.com>


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


Should this go to stable as well?

Alex

> ---

>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 14 +++++++-------

>  1 file changed, 7 insertions(+), 7 deletions(-)

> 

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

> index 76551cd..0b76d83 100644

> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

> @@ -688,15 +688,15 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo

> *bo, u32 domain,

>  		goto error;

>  	}

> 

> +	r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);

> +	if (unlikely(r)) {

> +		dev_err(adev->dev, "%p bind failed\n", bo);

> +		goto error;

> +	}

> +

>  	bo->pin_count = 1;

> -	if (gpu_addr != NULL) {

> -		r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);

> -		if (unlikely(r)) {

> -			dev_err(adev->dev, "%p bind failed\n", bo);

> -			goto error;

> -		}

> +	if (gpu_addr != NULL)

>  		*gpu_addr = amdgpu_bo_gpu_offset(bo);

> -	}

> 

>  	domain = amdgpu_mem_type_to_domain(bo-

> >tbo.mem.mem_type);

>  	if (domain == AMDGPU_GEM_DOMAIN_VRAM) {

> --

> 2.7.4

> 

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 26.10.2017 um 19:55 schrieb Deucher, Alexander:
>> -----Original Message-----
>> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
>> Of Christian König
>> Sent: Thursday, October 26, 2017 12:06 PM
>> To: amd-gfx@lists.freedesktop.org
>> Subject: [PATCH 2/8] drm/amdgpu: always bind pinned BOs
>>
>> From: Christian König <christian.koenig@amd.com>
>>
>> We always need to bind pinned BOs, not just when the caller requested the
>> address.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
>
> Should this go to stable as well?

Good question. As far as I can see it didn't made a difference so far 
cause all users of pinned GART BOs provided an address as well.

Just the framebuffer code doesn't do this and so I stumbled over it when 
allowing scanout from GART.

Christian.

>
> Alex
>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 14 +++++++-------
>>   1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> index 76551cd..0b76d83 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> @@ -688,15 +688,15 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo
>> *bo, u32 domain,
>>   		goto error;
>>   	}
>>
>> +	r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
>> +	if (unlikely(r)) {
>> +		dev_err(adev->dev, "%p bind failed\n", bo);
>> +		goto error;
>> +	}
>> +
>>   	bo->pin_count = 1;
>> -	if (gpu_addr != NULL) {
>> -		r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
>> -		if (unlikely(r)) {
>> -			dev_err(adev->dev, "%p bind failed\n", bo);
>> -			goto error;
>> -		}
>> +	if (gpu_addr != NULL)
>>   		*gpu_addr = amdgpu_bo_gpu_offset(bo);
>> -	}
>>
>>   	domain = amdgpu_mem_type_to_domain(bo-
>>> tbo.mem.mem_type);
>>   	if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
>> --
>> 2.7.4
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx