winsys/amdgpu: don't set GTT with GDS & OA placements on APUs
authorMarek Olšák <marek.olsak@amd.com>
Mon, 15 Apr 2019 16:49:33 +0000 (12:49 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 16 Apr 2019 14:24:19 +0000 (10:24 -0400)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c

index c1863057370f927f6458e5ba85cad5a47e0c1013..09cf924775514e232dbab63e4dafdffd56925249 100644 (file)
@@ -478,8 +478,18 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
    request.alloc_size = size;
    request.phys_alignment = alignment;
 
-   if (initial_domain & RADEON_DOMAIN_VRAM)
+   if (initial_domain & RADEON_DOMAIN_VRAM) {
       request.preferred_heap |= AMDGPU_GEM_DOMAIN_VRAM;
+
+      /* Since VRAM and GTT have almost the same performance on APUs, we could
+       * just set GTT. However, in order to decrease GTT(RAM) usage, which is
+       * 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)
+         request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;
+   }
+
    if (initial_domain & RADEON_DOMAIN_GTT)
       request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;
    if (initial_domain & RADEON_DOMAIN_GDS)
@@ -487,14 +497,6 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
    if (initial_domain & RADEON_DOMAIN_OA)
       request.preferred_heap |= AMDGPU_GEM_DOMAIN_OA;
 
-   /* Since VRAM and GTT have almost the same performance on APUs, we could
-    * just set GTT. However, in order to decrease GTT(RAM) usage, which is
-    * 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)
-      request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;
-
    if (flags & RADEON_FLAG_NO_CPU_ACCESS)
       request.flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
    if (flags & RADEON_FLAG_GTT_WC)