[PATCH 2/2] drm/amdgpu: allocate gart memory when it's required

Zhang, Jerry (Junwei) Jerry.Zhang at amd.com
Tue Jun 26 08:32:04 UTC 2018


On 06/26/2018 03:42 PM, Michel Dänzer wrote:
> On 2018-06-26 08:00 AM, Junwei Zhang wrote:
>> Instead of calling gart memory on every bo pin,
>> allocates it on demand
>>
>> Signed-off-by: Junwei Zhang <Jerry.Zhang at amd.com>
>>
>> [...]
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 036b6f7..0d1c4be 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -194,6 +194,12 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc,
>>   		goto unreserve;
>>   	}
>>
>> +	r = amdgpu_ttm_alloc_gart(&new_abo->tbo);
>> +	if (unlikely(r != 0)) {
>> +		DRM_ERROR("%p bind failed\n", new_abo);
>> +		goto unreserve;
>> +	}
>
> The error case here also needs to unpin the BO, otherwise we leak the
> pin. I suspect the same issue applies to at least some of the other
> places modified by this patch.

Aha, I felt into the similar error.

will update v2 and find one more unpin issue for bo creation in patch 3.

Jerry
>
>


More information about the amd-gfx mailing list