<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 16, 2019 at 5:34 AM Michel Dänzer <<a href="mailto:michel@daenzer.net">michel@daenzer.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2019-04-15 7:21 p.m., Marek Olšák wrote:<br>
> From: Marek Olšák <<a href="mailto:marek.olsak@amd.com" target="_blank">marek.olsak@amd.com</a>><br>
> <br>
> ---<br>
>  src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 20 +++++++++++---------<br>
>  1 file changed, 11 insertions(+), 9 deletions(-)<br>
> <br>
> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c<br>
> index c1863057370..09cf9247755 100644<br>
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c<br>
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c<br>
> @@ -471,37 +471,39 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,<br>
>        return NULL;<br>
>     }<br>
>  <br>
>     if (heap >= 0) {<br>
>        pb_cache_init_entry(&ws->bo_cache, &bo->u.real.cache_entry, &bo->base,<br>
>                            heap);<br>
>     }<br>
>     request.alloc_size = size;<br>
>     request.phys_alignment = alignment;<br>
>  <br>
> -   if (initial_domain & RADEON_DOMAIN_VRAM)<br>
> +   if (initial_domain & RADEON_DOMAIN_VRAM) {<br>
>        request.preferred_heap |= AMDGPU_GEM_DOMAIN_VRAM;<br>
> +<br>
> +      /* Since VRAM and GTT have almost the same performance on APUs, we could<br>
> +       * just set GTT. However, in order to decrease GTT(RAM) usage, which is<br>
> +       * shared with the OS, allow VRAM placements too. The idea is not to use<br>
> +       * VRAM usefully, but to use it so that it's not unused and wasted.<br>
> +       */<br>
> +      if (!ws->info.has_dedicated_vram)<br>
> +         request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;<br>
> +   }<br>
> +<br>
>     if (initial_domain & RADEON_DOMAIN_GTT)<br>
>        request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;<br>
>     if (initial_domain & RADEON_DOMAIN_GDS)<br>
>        request.preferred_heap |= AMDGPU_GEM_DOMAIN_GDS;<br>
>     if (initial_domain & RADEON_DOMAIN_OA)<br>
>        request.preferred_heap |= AMDGPU_GEM_DOMAIN_OA;<br>
>  <br>
> -   /* Since VRAM and GTT have almost the same performance on APUs, we could<br>
> -    * just set GTT. However, in order to decrease GTT(RAM) usage, which is<br>
> -    * shared with the OS, allow VRAM placements too. The idea is not to use<br>
> -    * VRAM usefully, but to use it so that it's not unused and wasted.<br>
> -    */<br>
> -   if (!ws->info.has_dedicated_vram)<br>
> -      request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;<br>
> -<br>
>     if (flags & RADEON_FLAG_NO_CPU_ACCESS)<br>
>        request.flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS;<br>
>     if (flags & RADEON_FLAG_GTT_WC)<br>
>        request.flags |= AMDGPU_GEM_CREATE_CPU_GTT_USWC;<br>
>     if (flags & RADEON_FLAG_NO_INTERPROCESS_SHARING &&<br>
>         ws->info.has_local_buffers)<br>
>        request.flags |= AMDGPU_GEM_CREATE_VM_ALWAYS_VALID;<br>
>     if (ws->zero_all_vram_allocs &&<br>
>         (request.preferred_heap & AMDGPU_GEM_DOMAIN_VRAM))<br>
>        request.flags |= AMDGPU_GEM_CREATE_VRAM_CLEARED;<br>
> <br>
<br>
Does this fix a problem which could be mentioned in the commit log?<br></blockquote><div><br></div><div>Yes but the driver doesn't use GDS, so it doesn't matter.</div><div><br></div><div>Marek<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Either way,<br>
<br>
Reviewed-by: Michel Dänzer <<a href="mailto:michel.daenzer@amd.com" target="_blank">michel.daenzer@amd.com</a>><br>
<br>
<br>
-- <br>
Earthling Michel Dänzer               |              <a href="https://www.amd.com" rel="noreferrer" target="_blank">https://www.amd.com</a><br>
Libre software enthusiast             |             Mesa and X developer<br>
</blockquote></div></div>