[AMD Official Use Only - General]
Jesse informed me that this patch solves the issue, he tested all the cases.
Thanks,
Arun
From: Christian König <ckoenig.leichtzumerken@xxxxxxxxx>
Sent: Wednesday, December 7, 2022 8:53:25 PM
To: Alex Deucher <alexdeucher@xxxxxxxxx>; Zhang, Jesse(Jie) <Jesse.Zhang@xxxxxxx>
Cc: Zhang, Yifan <Yifan1.Zhang@xxxxxxx>; amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx>; Paneer Selvam, Arunpravin <Arunpravin.PaneerSelvam@xxxxxxx>; amd-gfx@xxxxxxxxxxxxxxxxxxxxx <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>; Deucher, Alexander <Alexander.Deucher@xxxxxxx>; Koenig, Christian <Christian.Koenig@xxxxxxx>
Subject: Re: [PATCH] drm/amdgpu: try allowed domain when pin framebuffer failed
Sent: Wednesday, December 7, 2022 8:53:25 PM
To: Alex Deucher <alexdeucher@xxxxxxxxx>; Zhang, Jesse(Jie) <Jesse.Zhang@xxxxxxx>
Cc: Zhang, Yifan <Yifan1.Zhang@xxxxxxx>; amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx>; Paneer Selvam, Arunpravin <Arunpravin.PaneerSelvam@xxxxxxx>; amd-gfx@xxxxxxxxxxxxxxxxxxxxx <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>; Deucher, Alexander <Alexander.Deucher@xxxxxxx>; Koenig, Christian <Christian.Koenig@xxxxxxx>
Subject: Re: [PATCH] drm/amdgpu: try allowed domain when pin framebuffer failed
I would go a step further and just allow GTT domain on ASICs != CARRIZO
| STONEY.
I can't see a good reason we should still have any limitation here, VRAM
doesn't have any advantage any more as far as I know.
Christian.
Am 07.12.22 um 16:10 schrieb Alex Deucher:
> Does this patch fix the problem?
>
> Alex
>
> On Wed, Dec 7, 2022 at 2:27 AM Zhang, Jesse(Jie) <Jesse.Zhang@xxxxxxx> wrote:
>> [AMD Official Use Only - General]
>>
>>
>> drm/amdgpu: try allowed domain when pin framebuffer failed.
>>
>>
>>
>> [WHY&HOW]
>>
>>
>>
>> in some scenarios, the allocate memory often failed. such as do hot plug or play games.
>>
>> so we can try allowed domain, if the preferred domain cannot allocate memory.
>>
>>
>>
>> Signed-off-by: jie1zhan jesse.zhang@xxxxxxx
>>
>> Change-Id: I4b62e2ff072d02c515f901000a5789339d481273
>>
>>
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>
>> index 1ae0c8723348..05fcaf7f9d92 100644
>>
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>
>> @@ -39,6 +39,7 @@
>>
>> #include "amdgpu.h"
>>
>> #include "amdgpu_trace.h"
>>
>> #include "amdgpu_amdkfd.h"
>>
>> +#include "amdgpu_display.h"
>>
>>
>>
>> /**
>>
>> * DOC: amdgpu_object
>>
>> @@ -942,8 +943,14 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>>
>> bo->placements[i].lpfn = lpfn;
>>
>> }
>>
>>
>>
>> + retry:
>>
>> r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
>>
>> if (unlikely(r)) {
>>
>> + //try allowed domain when pin failed. just a workaround.
>>
>> + if (unlikely(r == -ENOMEM) && domain != bo->allowed_domains) {
>>
>> + amdgpu_bo_placement_from_domain(bo, bo->allowed_domains);
>>
>> + goto retry;
>>
>> + }
>>
>> dev_err(adev->dev, "%p pin failed\n", bo);
>>
>> goto error;
>>
>> }
| STONEY.
I can't see a good reason we should still have any limitation here, VRAM
doesn't have any advantage any more as far as I know.
Christian.
Am 07.12.22 um 16:10 schrieb Alex Deucher:
> Does this patch fix the problem?
>
> Alex
>
> On Wed, Dec 7, 2022 at 2:27 AM Zhang, Jesse(Jie) <Jesse.Zhang@xxxxxxx> wrote:
>> [AMD Official Use Only - General]
>>
>>
>> drm/amdgpu: try allowed domain when pin framebuffer failed.
>>
>>
>>
>> [WHY&HOW]
>>
>>
>>
>> in some scenarios, the allocate memory often failed. such as do hot plug or play games.
>>
>> so we can try allowed domain, if the preferred domain cannot allocate memory.
>>
>>
>>
>> Signed-off-by: jie1zhan jesse.zhang@xxxxxxx
>>
>> Change-Id: I4b62e2ff072d02c515f901000a5789339d481273
>>
>>
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>
>> index 1ae0c8723348..05fcaf7f9d92 100644
>>
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>
>> @@ -39,6 +39,7 @@
>>
>> #include "amdgpu.h"
>>
>> #include "amdgpu_trace.h"
>>
>> #include "amdgpu_amdkfd.h"
>>
>> +#include "amdgpu_display.h"
>>
>>
>>
>> /**
>>
>> * DOC: amdgpu_object
>>
>> @@ -942,8 +943,14 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>>
>> bo->placements[i].lpfn = lpfn;
>>
>> }
>>
>>
>>
>> + retry:
>>
>> r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
>>
>> if (unlikely(r)) {
>>
>> + //try allowed domain when pin failed. just a workaround.
>>
>> + if (unlikely(r == -ENOMEM) && domain != bo->allowed_domains) {
>>
>> + amdgpu_bo_placement_from_domain(bo, bo->allowed_domains);
>>
>> + goto retry;
>>
>> + }
>>
>> dev_err(adev->dev, "%p pin failed\n", bo);
>>
>> goto error;
>>
>> }