All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: ttm_bind only when user needs gpu_addr in bo pin
@ 2017-07-12  4:38 Chunming Zhou
       [not found] ` <1499834315-11413-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Chunming Zhou @ 2017-07-12  4:38 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Chunming Zhou

Change-Id: I282e1212346ed76470cadf39153109ab135f32f3
Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index a0ad0e0..81c1486 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -778,15 +778,16 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 		dev_err(adev->dev, "%p pin failed\n", bo);
 		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)
+	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;
+		}
 		*gpu_addr = amdgpu_bo_gpu_offset(bo);
+	}
 	if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
 		adev->vram_pin_size += amdgpu_bo_size(bo);
 		if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: ttm_bind only when user needs gpu_addr in bo pin
       [not found] ` <1499834315-11413-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
@ 2017-07-12  7:54   ` Christian König
       [not found]     ` <e2c6e19f-0bd8-b3d6-e7a3-9d07c52a68e9-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Christian König @ 2017-07-12  7:54 UTC (permalink / raw)
  To: Chunming Zhou, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Looks like it makes sense, but why should that be useful?

Christian.

Am 12.07.2017 um 06:38 schrieb Chunming Zhou:
> Change-Id: I282e1212346ed76470cadf39153109ab135f32f3
> Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 13 +++++++------
>   1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index a0ad0e0..81c1486 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -778,15 +778,16 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>   		dev_err(adev->dev, "%p pin failed\n", bo);
>   		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)
> +	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;
> +		}
>   		*gpu_addr = amdgpu_bo_gpu_offset(bo);
> +	}
>   	if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
>   		adev->vram_pin_size += amdgpu_bo_size(bo);
>   		if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: ttm_bind only when user needs gpu_addr in bo pin
       [not found]     ` <e2c6e19f-0bd8-b3d6-e7a3-9d07c52a68e9-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2017-07-12  8:06       ` zhoucm1
       [not found]         ` <5965D87E.5060006-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: zhoucm1 @ 2017-07-12  8:06 UTC (permalink / raw)
  To: Christian König, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW



On 2017年07月12日 15:54, Christian König wrote:
> Looks like it makes sense, but why should that be useful?
1. when you set gart size 256M, the space is limit, so only bind gart 
when necessary.
2. less cpu overhead with un-necessary statements.

Regards,
David Zhou
>
> Christian.
>
> Am 12.07.2017 um 06:38 schrieb Chunming Zhou:
>> Change-Id: I282e1212346ed76470cadf39153109ab135f32f3
>> Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 13 +++++++------
>>   1 file changed, 7 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> index a0ad0e0..81c1486 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> @@ -778,15 +778,16 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo 
>> *bo, u32 domain,
>>           dev_err(adev->dev, "%p pin failed\n", bo);
>>           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)
>> +    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;
>> +        }
>>           *gpu_addr = amdgpu_bo_gpu_offset(bo);
>> +    }
>>       if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
>>           adev->vram_pin_size += amdgpu_bo_size(bo);
>>           if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
>
>

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: ttm_bind only when user needs gpu_addr in bo pin
       [not found]         ` <5965D87E.5060006-5C7GfCeVMHo@public.gmane.org>
@ 2017-07-12  8:13           ` Christian König
  0 siblings, 0 replies; 4+ messages in thread
From: Christian König @ 2017-07-12  8:13 UTC (permalink / raw)
  To: zhoucm1, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Am 12.07.2017 um 10:06 schrieb zhoucm1:
>
>
> On 2017年07月12日 15:54, Christian König wrote:
>> Looks like it makes sense, but why should that be useful?
> 1. when you set gart size 256M, the space is limit, so only bind gart 
> when necessary.
> 2. less cpu overhead with un-necessary statements.

Yeah, that was obvious. My question was rather where we actually use the 
function this way in the upstream driver :)

But searching the code a bit I stumbled over the prime handling which 
can make good use of that.

So patch is Reviewed-by: Christian König <christian.koenig@amd.com>.

Regards,
Christian.

>
> Regards,
> David Zhou
>>
>> Christian.
>>
>> Am 12.07.2017 um 06:38 schrieb Chunming Zhou:
>>> Change-Id: I282e1212346ed76470cadf39153109ab135f32f3
>>> Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 13 +++++++------
>>>   1 file changed, 7 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c 
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> index a0ad0e0..81c1486 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> @@ -778,15 +778,16 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo 
>>> *bo, u32 domain,
>>>           dev_err(adev->dev, "%p pin failed\n", bo);
>>>           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)
>>> +    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;
>>> +        }
>>>           *gpu_addr = amdgpu_bo_gpu_offset(bo);
>>> +    }
>>>       if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
>>>           adev->vram_pin_size += amdgpu_bo_size(bo);
>>>           if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
>>
>>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-12  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-12  4:38 [PATCH] drm/amdgpu: ttm_bind only when user needs gpu_addr in bo pin Chunming Zhou
     [not found] ` <1499834315-11413-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-07-12  7:54   ` Christian König
     [not found]     ` <e2c6e19f-0bd8-b3d6-e7a3-9d07c52a68e9-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-07-12  8:06       ` zhoucm1
     [not found]         ` <5965D87E.5060006-5C7GfCeVMHo@public.gmane.org>
2017-07-12  8:13           ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.