From: Shuicheng Lin <shuicheng.lin@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Shuicheng Lin" <shuicheng.lin@intel.com>,
"Matthew Brost" <matthew.brost@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Subject: [PATCH] drm/xe: Skip empty preparser window in video ring ops
Date: Wed, 23 Sep 2026 18:20:01 +0000 [thread overview]
Message-ID: <20260923182001.669076-1-shuicheng.lin@intel.com> (raw)
__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
next reply other threads:[~2026-09-23 18:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 18:20 Shuicheng Lin [this message]
2026-09-23 19:01 ` ✓ CI.KUnit: success for drm/xe: Skip empty preparser window in video ring ops Patchwork
2026-09-23 20:40 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-24 9:39 ` ✓ Xe.CI.FULL: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260923182001.669076-1-shuicheng.lin@intel.com \
--to=shuicheng.lin@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=thomas.hellstrom@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox