Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Skip empty preparser window in video ring ops
@ 2026-09-23 18:20 Shuicheng Lin
  2026-09-23 19:01 ` ✓ CI.KUnit: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shuicheng Lin @ 2026-09-23 18:20 UTC (permalink / raw)
  To: intel-xe; +Cc: Shuicheng Lin, Matthew Brost, Thomas Hellström

__emit_job_gen12_video() brackets the aux table invalidation and the
optional TLB flush with a preparser disable/enable pair. On platforms
without AuxCCS emit_aux_table_inv() emits nothing, so a job that does
not need a TLB flush wraps an empty region and burns two dwords of
ring space on every submission.

Add has_aux_table_inv() to expose the condition emit_aux_table_inv()
already tests internally, and enter the preparser window only when
something will be emitted inside it. The command stream is unchanged
whenever the window is non-empty.

Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Assisted-by: LLM
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
---
has_aux_table_inv(job->q->hwe) is equivalent to has_aux_ccs(xe) here:
emit_job_gen12_video() is only installed on the VIDEO_DECODE/VIDEO_ENHANCE
ring ops, and emit_aux_table_inv is only set on the auxccs_* variants,
which xe_ring_ops_get() picks based on has_aux_ccs() alone.

I went with the former because it tests exactly what emit_aux_table_inv()
tests, so the window cannot go unbalanced if a hook is ever added for some
other reason. Happy to switch to has_aux_ccs(xe) if consistency with
__emit_job_gen12_render_compute() is preferred.
---

 drivers/gpu/drm/xe/xe_ring_ops.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_ring_ops.c b/drivers/gpu/drm/xe/xe_ring_ops.c
index 3dd8cf4e2131..f1260fb6e894 100644
--- a/drivers/gpu/drm/xe/xe_ring_ops.c
+++ b/drivers/gpu/drm/xe/xe_ring_ops.c
@@ -80,6 +80,11 @@ static u32 *emit_aux_table_inv_video_enhance(struct xe_gt *gt, u32 *cmd)
 	return __emit_aux_table_inv(cmd, VE0_AUX_INV, gt->mmio.adj_offset);
 }
 
+static bool has_aux_table_inv(struct xe_hw_engine *hwe)
+{
+	return hwe->gt->ring_ops[hwe->class]->emit_aux_table_inv;
+}
+
 static int emit_aux_table_inv(struct xe_hw_engine *hwe, u32 *dw, int i)
 {
 	struct xe_gt *gt = hwe->gt;
@@ -404,16 +409,18 @@ static void __emit_job_gen12_video(struct xe_sched_job *job, struct xe_lrc *lrc,
 
 	i = emit_copy_timestamp(xe, lrc, dw, i);
 
-	dw[i++] = preparser_disable(true);
+	if (has_aux_table_inv(job->q->hwe) || job->ring_ops_flush_tlb) {
+		dw[i++] = preparser_disable(true);
 
-	/* hsdes: 1809175790 */
-	i = emit_aux_table_inv(job->q->hwe, dw, i);
+		/* hsdes: 1809175790 */
+		i = emit_aux_table_inv(job->q->hwe, dw, i);
 
-	if (job->ring_ops_flush_tlb)
-		i = emit_flush_imm_ggtt(xe_lrc_start_seqno_ggtt_addr(lrc),
-					seqno, MI_INVALIDATE_TLB, dw, i);
+		if (job->ring_ops_flush_tlb)
+			i = emit_flush_imm_ggtt(xe_lrc_start_seqno_ggtt_addr(lrc),
+						seqno, MI_INVALIDATE_TLB, dw, i);
 
-	dw[i++] = preparser_disable(false);
+		dw[i++] = preparser_disable(false);
+	}
 
 	if (!job->ring_ops_flush_tlb)
 		i = emit_store_imm_ggtt(xe_lrc_start_seqno_ggtt_addr(lrc),
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-24  9:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-23 18:20 [PATCH] drm/xe: Skip empty preparser window in video ring ops Shuicheng Lin
2026-09-23 19:01 ` ✓ CI.KUnit: success for " Patchwork
2026-09-23 20:40 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-24  9:39 ` ✓ Xe.CI.FULL: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox