Skip to content

Commit 4494834

Browse files
hoshinolinajannau
authored andcommitted
drm/asahi: gpu: Collect garbage for private/gpuro together
Avoids double firmware flushes Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent c30c0c6 commit 4494834

1 file changed

Lines changed: 8 additions & 18 deletions

File tree

drivers/gpu/drm/asahi/gpu.rs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,32 +1172,22 @@ impl GpuManager for GpuManager::ver {
11721172

11731173
let mut guard = self.alloc.lock();
11741174
let (garbage_count, garbage_bytes) = guard.private.garbage();
1175-
if garbage_bytes > MAX_FW_ALLOC_GARBAGE {
1176-
mod_dev_dbg!(
1177-
self.dev,
1178-
"Collecting kalloc/private garbage ({} objects, {} bytes)\n",
1179-
garbage_count,
1180-
garbage_bytes
1181-
);
1182-
if self.flush_fw_cache().is_err() {
1183-
dev_err!(self.dev.as_ref(), "Failed to flush FW cache\n");
1184-
} else {
1185-
guard.private.collect_garbage(garbage_count);
1186-
}
1187-
}
1175+
let (ro_garbage_count, ro_garbage_bytes) = guard.gpu_ro.garbage();
11881176

1189-
let (garbage_count, garbage_bytes) = guard.gpu_ro.garbage();
1190-
if garbage_bytes > MAX_FW_ALLOC_GARBAGE {
1177+
if garbage_bytes > MAX_FW_ALLOC_GARBAGE || ro_garbage_bytes > MAX_FW_ALLOC_GARBAGE {
11911178
mod_dev_dbg!(
11921179
self.dev,
1193-
"Collecting kalloc/gpuro garbage ({} objects, {} bytes)\n",
1180+
"Collecting kalloc garbage (private: {} objects, {} bytes, gpuro: {} objects, {} bytes)\n",
11941181
garbage_count,
1195-
garbage_bytes
1182+
garbage_bytes,
1183+
ro_garbage_count,
1184+
ro_garbage_bytes
11961185
);
11971186
if self.flush_fw_cache().is_err() {
11981187
dev_err!(self.dev.as_ref(), "Failed to flush FW cache\n");
11991188
} else {
1200-
guard.gpu_ro.collect_garbage(garbage_count);
1189+
guard.private.collect_garbage(garbage_count);
1190+
guard.gpu_ro.collect_garbage(ro_garbage_count);
12011191
}
12021192
}
12031193

0 commit comments

Comments
 (0)