diff --git a/drivers/gpu/drm/asahi/g17/job.rs b/drivers/gpu/drm/asahi/g17/job.rs index c724a2266bb15..9b85de020d24d 100644 --- a/drivers/gpu/drm/asahi/g17/job.rs +++ b/drivers/gpu/drm/asahi/g17/job.rs @@ -315,6 +315,10 @@ pub(crate) trait Backend: Send + Sync { fn supports_submission(&self) -> bool { true } /// Whether this backend's scheduler workers run in their queue creator's cluster (M5). fn creator_cluster_scheduling(&self) -> bool { false } + /// Whether to keep compute input completion waits and wait on the host for other-engine + /// prefix producers: without the G17D forms an M5 kick may start while its ring + /// predecessor still runs. + fn host_producer_waits(&self) -> bool { false } /// The reclaim-safe queue for the scheduler's timeout work, whose handler signals the /// fences of timed-out jobs. fn fence_queue(&self) -> Arc; diff --git a/drivers/gpu/drm/asahi/g17/queue/mod.rs b/drivers/gpu/drm/asahi/g17/queue/mod.rs index 32a7e9e19fd25..b750313faa76a 100644 --- a/drivers/gpu/drm/asahi/g17/queue/mod.rs +++ b/drivers/gpu/drm/asahi/g17/queue/mod.rs @@ -225,7 +225,11 @@ impl Queue { if engine == Engine::Compute { super::trace::inputs(self.context.id(), order.sequence, 0, inputs.len(), None); } - let sources = if engine == Engine::Compute + // Ring order completes a converted input only if a kick waits for its + // ring predecessor; without that, keep the input's completion wait. + let host_waits = self.backend.host_producer_waits(); + let sources = if !host_waits + && engine == Engine::Compute && !inputs.is_empty() && !destinations.has_outputs() && self.frontiers[0].iter().all(|(sequence, fences)| { @@ -325,9 +329,17 @@ impl Queue { inputs.len() + count + timestamp_count + failure_count, GFP_KERNEL, )?; - let mut checked_inputs = - KVec::with_capacity(inputs.len() + timestamp_count + failure_count, GFP_KERNEL)?; - let mut firmware = KVec::with_capacity(count, GFP_KERNEL)?; + // Host-waited producers are checked on the host instead of in firmware. + let (host_count, firmware_count) = if host_waits { + (count, 0) + } else { + (0, count) + }; + let mut checked_inputs = KVec::with_capacity( + inputs.len() + host_count + timestamp_count + failure_count, + GFP_KERNEL, + )?; + let mut firmware = KVec::with_capacity(firmware_count, GFP_KERNEL)?; for fence in failures.into_iter().flatten() { checked_inputs.push(fence.clone(), GFP_KERNEL)?; dependencies.push(fence.clone(), GFP_KERNEL)?; @@ -348,8 +360,15 @@ impl Queue { if fences.status() > 0 { continue; } - dependencies.push(fences.ready.clone(), GFP_KERNEL)?; - firmware.push(fences.completed.clone(), GFP_KERNEL)?; + if host_waits { + // Keep other-engine producers on the host until completion, and + // propagate their errors before publishing the consumer. + dependencies.push(fences.completed.clone(), GFP_KERNEL)?; + checked_inputs.push(fences.completed.clone(), GFP_KERNEL)?; + } else { + dependencies.push(fences.ready.clone(), GFP_KERNEL)?; + firmware.push(fences.completed.clone(), GFP_KERNEL)?; + } } // Each command owns every input fence; independent engines may publish in // either order and must each consume an input's error status before running. diff --git a/drivers/gpu/drm/asahi/g17/runtime/backend.rs b/drivers/gpu/drm/asahi/g17/runtime/backend.rs index c83edeef6ba1a..af0e4b801ba99 100644 --- a/drivers/gpu/drm/asahi/g17/runtime/backend.rs +++ b/drivers/gpu/drm/asahi/g17/runtime/backend.rs @@ -121,6 +121,9 @@ impl job::Backend for Backend { fn creator_cluster_scheduling(&self) -> bool { self.shared.follows_submitter() } + fn host_producer_waits(&self) -> bool { + self.shared.m5_board.is_some_and(|board| !board.g17d_forms()) + } fn fence_queue(&self) -> Arc { self.shared.fence_queue() }