winsys/amdgpu: Restrict allocation to GTT for small vram size

Submitted by Agrawal, Akshu on April 25, 2019, 11:37 a.m.

Details

Message ID 20190425113724.82608-1-akshu.agrawal@amd.com
State New
Headers show
Series "winsys/amdgpu: Restrict allocation to GTT for small vram size" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Agrawal, Akshu April 25, 2019, 11:37 a.m.
To avoid evictions, use GTT only for allocation on devices with
small vram size.

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>

---
 src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

-- 
2.19.1

Patch hide | download patch | download mbox

diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
index 09cf9247755..aab801b6337 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
@@ -486,8 +486,15 @@  static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
        * shared with the OS, allow VRAM placements too. The idea is not to use
        * VRAM usefully, but to use it so that it's not unused and wasted.
        */
-      if (!ws->info.has_dedicated_vram)
+   if (!ws->info.has_dedicated_vram) {
+      /* For devices having small VRAM size use GTT only to
+       * avoid evictions.
+       */
+      if (ws->info.vram_size <= 16777216)
+         request.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
+      else
          request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;
+      }
    }
 
    if (initial_domain & RADEON_DOMAIN_GTT)

Comments

Am 25.04.19 um 13:37 schrieb Agrawal, Akshu:
> To avoid evictions, use GTT only for allocation on devices with
> small vram size.
>
> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
> ---
>   src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
> index 09cf9247755..aab801b6337 100644
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
> @@ -486,8 +486,15 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
>          * shared with the OS, allow VRAM placements too. The idea is not to use
>          * VRAM usefully, but to use it so that it's not unused and wasted.
>          */
> -      if (!ws->info.has_dedicated_vram)
> +   if (!ws->info.has_dedicated_vram) {
> +      /* For devices having small VRAM size use GTT only to
> +       * avoid evictions.
> +       */
> +      if (ws->info.vram_size <= 16777216)
> +         request.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;

Well that will certainly cause problems because it would result in 
scanout BOs to be forced into GTT.

Christian.

> +      else
>            request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;
> +      }
>      }
>   
>      if (initial_domain & RADEON_DOMAIN_GTT)
On 2019-04-26 9:35 a.m., Christian König wrote:
> Am 25.04.19 um 13:37 schrieb Agrawal, Akshu:
>> To avoid evictions, use GTT only for allocation on devices with
>> small vram size.
>>
>> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
>> ---
>>   src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 9 ++++++++-
>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
>> b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
>> index 09cf9247755..aab801b6337 100644
>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
>> @@ -486,8 +486,15 @@ static struct amdgpu_winsys_bo
>> *amdgpu_create_bo(struct amdgpu_winsys *ws,
>>          * shared with the OS, allow VRAM placements too. The idea is
>> not to use
>>          * VRAM usefully, but to use it so that it's not unused and
>> wasted.
>>          */
>> -      if (!ws->info.has_dedicated_vram)
>> +   if (!ws->info.has_dedicated_vram) {
>> +      /* For devices having small VRAM size use GTT only to
>> +       * avoid evictions.
>> +       */
>> +      if (ws->info.vram_size <= 16777216)
>> +         request.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
> 
> Well that will certainly cause problems because it would result in
> scanout BOs to be forced into GTT.

The patch is also lacking a rationale, e.g. what problem does it solve?