]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe: Refactor emit_clear_link_copy
authorBalasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Mon, 11 May 2026 12:37:49 +0000 (18:07 +0530)
committerBalasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Wed, 13 May 2026 06:51:12 +0000 (12:21 +0530)
Implement a function to return the length of the MEM_SET instruction.
This is to prepare for future platforms where the length of MEM_SET
instruction is expected to change.

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patch.msgid.link/20260511123746.616662-7-balasubramani.vivekanandan@intel.com
Signed-off-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
drivers/gpu/drm/xe/instructions/xe_gpu_commands.h
drivers/gpu/drm/xe/xe_migrate.c

index 4546c8f10516449da9cae1927eadc2734df9b9d5..edd204b8dfe5771f3e23ee06bf7ace495c2b7035 100644 (file)
@@ -37,7 +37,6 @@
 #define   MEM_COPY_DST_MOCS_INDEX_MASK GENMASK(6, 3)
 
 #define        PVC_MEM_SET_CMD         (2 << 29 | 0x5b << 22)
-#define   PVC_MEM_SET_CMD_LEN_DW       7
 #define   PVC_MEM_SET_MATRIX           REG_BIT(17)
 #define   PVC_MEM_SET_DATA_FIELD       GENMASK(31, 24)
 /* Bspec lists field as [6:0], but index alone is from [6:1] */
index 6ffd50050e3e87c1cb062d97369dfa8289f3821e..4f9be41b2f6457b3902cdbd39e22052c4427ebc9 100644 (file)
@@ -1461,12 +1461,17 @@ struct dma_fence *xe_migrate_vram_copy_chunk(struct xe_bo *vram_bo, u64 vram_off
        return fence;
 }
 
+static u32 blt_mem_set_cmd_len(struct xe_device *xe)
+{
+       return 7;
+}
+
 static void emit_clear_link_copy(struct xe_gt *gt, struct xe_bb *bb, u64 src_ofs,
                                 u32 size, u32 pitch)
 {
        struct xe_device *xe = gt_to_xe(gt);
        u32 *cs = bb->cs + bb->len;
-       u32 len = PVC_MEM_SET_CMD_LEN_DW;
+       u32 len = blt_mem_set_cmd_len(xe);
 
        *cs++ = PVC_MEM_SET_CMD | PVC_MEM_SET_MATRIX | (len - 2);
        *cs++ = pitch - 1;
@@ -1536,7 +1541,7 @@ static u32 emit_clear_cmd_len(struct xe_gt *gt)
        struct xe_device *xe = gt_to_xe(gt);
 
        if (gt->info.has_xe2_blt_instructions)
-               return PVC_MEM_SET_CMD_LEN_DW;
+               return blt_mem_set_cmd_len(xe);
        else
                return blt_fast_color_cmd_len(xe);
 }