Skip to contentSkip to conversation

drm/radeon: Don't use WC for VRAM if !RADEON_GEM_GTT_WC

PATCH New Huacai Chen 1 participant 2 messages Sep 9, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/radeon: Don't use WC for VRAM if !RADEON_GEM_GTT_WC

Though RADEON_GEM_GTT_WC is initially used for GTT, but this flag is bound to drm_arch_can_wc_memory(), and if arch doesn't support WC, then VRAM should not use WC.

---
 drivers/gpu/drm/radeon/radeon_object.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_object.c +10 -4
index f3dee01..07b82d9 100644
@@ -117,10 +117,16 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain)
 						     TTM_PL_FLAG_VRAM;
 		}
 
-		rbo->placements[c].fpfn = 0;
-		rbo->placements[c++].flags = TTM_PL_FLAG_WC |
-					     TTM_PL_FLAG_UNCACHED |
-					     TTM_PL_FLAG_VRAM;
+		if (rbo->flags & RADEON_GEM_GTT_WC) {
+			rbo->placements[c].fpfn = 0;
+			rbo->placements[c++].flags = TTM_PL_FLAG_WC |
+						     TTM_PL_FLAG_UNCACHED |
+						     TTM_PL_FLAG_VRAM;
+		} else {
+			rbo->placements[c].fpfn = 0;
+			rbo->placements[c++].flags = TTM_PL_FLAG_UNCACHED |
+						     TTM_PL_FLAG_VRAM;
+		}
 	}
 
 	if (domain & RADEON_GEM_DOMAIN_GTT) {
Signature · 6 lines
2.7.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/2 drm/amdgpu: Don't use WC for VRAM if !AMDGPU_GEM_CREATE_CPU_GTT_USWC

Though AMDGPU_GEM_CREATE_CPU_GTT_USWC is initially used for GTT, but this flag is bound to drm_arch_can_wc_memory(), and if arch doesn't support WC, then VRAM should not use WC.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -2
index 5ac7b55..04299f5 100644
@@ -136,8 +136,10 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain)
 
 		places[c].fpfn = 0;
 		places[c].lpfn = 0;
-		places[c].flags = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED |
-			TTM_PL_FLAG_VRAM;
+		places[c].flags = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM;
+
+		if (flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC)
+			places[c].flags |= TTM_PL_FLAG_WC;
 
 		if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)
 			places[c].lpfn = visible_pfn;
Signature · 6 lines
2.7.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel