@@ -971,6 +971,13 @@ static u32 emit_clear_cmd_len(struct xe_gt *gt)
return XY_FAST_COLOR_BLT_DW;
}
+static bool can_fast_color_blt_cmd_clear_ccs(struct xe_gt *gt)
+{
+ /* On XE2 XY_FAST_COLOR_BLT can clear CCS with uncompress pte */
+ return (GRAPHICS_VERx100(gt_to_xe(gt)) >= 2000) &&
+ emit_clear_cmd_len(gt) == XY_FAST_COLOR_BLT_DW;
+}
+
static void emit_clear(struct xe_gt *gt, struct xe_bb *bb, u64 src_ofs,
u32 size, u32 pitch, bool is_vram)
{
@@ -1061,7 +1068,8 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
if (clear_vram && xe_migrate_allow_identity(clear_L0, &src_it))
xe_res_next(&src_it, clear_L0);
else
- emit_pte(m, bb, clear_L0_pt, clear_vram, clear_ccs,
+ /* Use uncompressed pte so clear happens in the real memory. */
+ emit_pte(m, bb, clear_L0_pt, clear_vram, false,
&src_it, clear_L0, dst);
bb->cs[bb->len++] = MI_BATCH_BUFFER_END;
@@ -1070,7 +1078,9 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
if (clear_bo_data)
emit_clear(gt, bb, clear_L0_ofs, clear_L0, XE_PAGE_SIZE, clear_vram);
- if (xe_device_has_flat_ccs(xe)) {
+ /* XY_FAST_COLOR_BLT on uncompress PTE will clear CCS metadata as well */
+ if (xe_device_has_flat_ccs(xe) && clear_ccs && !(clear_bo_data &&
+ can_fast_color_blt_cmd_clear_ccs(gt))) {
emit_copy_ccs(gt, bb, clear_L0_ofs, true,
m->cleared_mem_ofs, false, clear_L0);
flush_flags = MI_FLUSH_DW_CCS;
XE_FAST_COLOR_BLT will clear out CCS meta data when clearing bo with uncompress PTE, so skip emit_copy_ccs() when XE_FAST_COLOR_BLT is used to clear out a bo. Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Cc: Matthew Auld <matthew.auld@intel.com> Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com> --- drivers/gpu/drm/xe/xe_migrate.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)