[PATCH] drm/amdgpu: consider user preference when pinning for SG display

Alex Deucher alexdeucher at gmail.com
Fri May 18 19:12:29 UTC 2018


On Fri, May 18, 2018 at 4:21 AM, Michel Dänzer <michel at daenzer.net> wrote:
> On 2018-05-17 06:55 PM, Alex Deucher wrote:
>> If the pin domain is set to GTT | VRAM, look at the preferred domains
>> for the bo and respect that if it's been set explicitly.
>>
>> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> index 6a9e46ae7f0a..16192f17653e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> @@ -704,9 +704,14 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>>        * See function amdgpu_display_supported_domains()
>>        */
>>       if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
>> -             domain = AMDGPU_GEM_DOMAIN_VRAM;
>> -             if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>> +             if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM)
>> +                     domain = AMDGPU_GEM_DOMAIN_VRAM; /* if user really wants vram, respect it */
>> +             else if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT)
>> +                     domain = AMDGPU_GEM_DOMAIN_GTT; /* if user really wants gtt, respect it */
>
> I'd spell VRAM and GTT in capital letters in the comments.

OK.

>
>
>> +             else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>                       domain = AMDGPU_GEM_DOMAIN_GTT;
>> +             else
>> +                     domain = AMDGPU_GEM_DOMAIN_VRAM;
>>       }
>
> Is everything in place to deal with any issues that might occur when
> flipping between buffers in VRAM and GTT?
>

Ah, right, I forgot about that, we still need to do that.  In practice
I don't think this will change anything compared things now at least
the way mesa is currently configured.  I can hold off on this this
patch for now until we handle that if you think it will be an issue.

Alex


More information about the amd-gfx mailing list