[PATCH] drm/amdgpu: ttm_bind only when user needs gpu_addr in bo pin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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 at 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)
>
>



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux