Skip to content

Commit 8ca21f0

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 9b6c69c commit 8ca21f0

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
@@ -1169,32 +1169,22 @@ impl GpuManager for GpuManager::ver {
11691169

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

1186-
let (garbage_count, garbage_bytes) = guard.gpu_ro.garbage();
1187-
if garbage_bytes > MAX_FW_ALLOC_GARBAGE {
1174+
if garbage_bytes > MAX_FW_ALLOC_GARBAGE || ro_garbage_bytes > MAX_FW_ALLOC_GARBAGE {
11881175
mod_dev_dbg!(
11891176
self.dev,
1190-
"Collecting kalloc/gpuro garbage ({} objects, {} bytes)\n",
1177+
"Collecting kalloc garbage (private: {} objects, {} bytes, gpuro: {} objects, {} bytes)\n",
11911178
garbage_count,
1192-
garbage_bytes
1179+
garbage_bytes,
1180+
ro_garbage_count,
1181+
ro_garbage_bytes
11931182
);
11941183
if self.flush_fw_cache().is_err() {
11951184
dev_err!(self.dev.as_ref(), "Failed to flush FW cache\n");
11961185
} else {
1197-
guard.gpu_ro.collect_garbage(garbage_count);
1186+
guard.private.collect_garbage(garbage_count);
1187+
guard.gpu_ro.collect_garbage(ro_garbage_count);
11981188
}
11991189
}
12001190

0 commit comments

Comments
 (0)