Skip to contentSkip to conversation

drm/amdgpu: always allocate cleared VRAM for GEM allocations

PATCH In review Alex Deucher 2 participants 2 messages Aug 23, 2024

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: always allocate cleared VRAM for GEM allocations

This adds allocation latency, but aligns better with user expectations. The latency should improve with the drm buddy clearing patches that Arun has been working on.

In addition this fixes the high CPU spikes seen when doing wipe on release.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -0
index 1f149c9e2177..16af465f1c01 100644
@@ -349,6 +349,10 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
 		return -EINVAL;
 	}
 
+	/* always clear VRAM */
+	if (args->in.domains & AMDGPU_GEM_DOMAIN_VRAM)
+		flags |= AMDGPU_GEM_CREATE_VRAM_CLEARED;
+
 	/* create a gem object to contain this object in */
 	if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS |
 	    AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA)) {
Signature · 1 line
2.46.0
maintainer
#1 lore raw

Am 23.08.24 um 15:36 schrieb Alex Deucher:

Quoted 3 lines

This adds allocation latency, but aligns better with user expectations. The latency should improve with the drm buddy clearing patches that Arun has been working on.

The problem is still that we can't most likely will run into issues with some of the bootup time constrains we have.

Quoted 3 lines

In addition this fixes the high CPU spikes seen when doing wipe on release.

Mhm, interesting.

Quoted 15 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -0
index 1f149c9e2177..16af465f1c01 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · line 353

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +2 -0
@@ -349,6 +349,10 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
  		return -EINVAL;
  	}
 
+	/* always clear VRAM */
+	if (args->in.domains & AMDGPU_GEM_DOMAIN_VRAM)

I think we should drop that if. When only GTT is allocated the flag is ignored and it can be the we switch the domain later on.

Christian.

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +2 -0
+		flags |= AMDGPU_GEM_CREATE_VRAM_CLEARED;
+
  	/* create a gem object to contain this object in */
  	if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS |
  	    AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA)) {