[PATCH] drm/amdgpu: Clear VRAM for DRM dumb_create buffers

Christian König ckoenig.leichtzumerken at gmail.com
Mon Mar 11 16:58:58 UTC 2019


Am 08.03.19 um 17:47 schrieb Alex Deucher:
> On Fri, Mar 8, 2019 at 10:38 AM Nicholas Kazlauskas
> <nicholas.kazlauskas at amd.com> wrote:
>> The dumb_create API isn't intended for high performance rendering
>> and it's more useful for userspace (ie. IGT) to have them precleared.
>>
>> The bonus here is that we also won't needlessly leak whatever was
>> previously in VRAM, but it also probably wasn't sensitive if it was
>> going through this API.
>>
>> Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas at amd.com>
> Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

NAK, IIRC we used to have this bit here before.

In general I agree that this would be a good idea, but the problem is 
the that first dump buffer is sometimes created before the engine 
(usually SDMA) to clear VRAM is initialized.

So you can run into a nice crash on suspend/resume.

Christian.

>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> index fcaaac30e84b..a58072bbc9b8 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> @@ -743,7 +743,8 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
>>          domain = amdgpu_bo_get_preferred_pin_domain(adev,
>>                                  amdgpu_display_supported_domains(adev));
>>          r = amdgpu_gem_object_create(adev, args->size, 0, domain,
>> -                                    AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
>> +                                    AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
>> +                                    AMDGPU_GEM_CREATE_VRAM_CLEARED,
>>                                       ttm_bo_type_device, NULL, &gobj);
>>          if (r)
>>                  return -ENOMEM;
>> --
>> 2.17.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx



More information about the amd-gfx mailing list