]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe: Refactor emit_clear_main_copy
authorBalasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Mon, 11 May 2026 12:37:48 +0000 (18:07 +0530)
committerBalasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Wed, 13 May 2026 06:51:12 +0000 (12:21 +0530)
Implement a function which returns the length of XY_FAST_COLOR_BLT
instruction instead of hardcoding it inside the emit_clear_main_copy.
In future platforms, the length of this instruction is expected to
change and this patch helps in preparing for it.

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patch.msgid.link/20260511123746.616662-6-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 885fcf211e6d080e19de8eed9aa3bda0bf25c71b..4546c8f10516449da9cae1927eadc2734df9b9d5 100644 (file)
@@ -20,7 +20,6 @@
 
 #define XY_FAST_COLOR_BLT_CMD          (2 << 29 | 0x44 << 22)
 #define   XY_FAST_COLOR_BLT_DEPTH_32   (2 << 19)
-#define   XY_FAST_COLOR_BLT_DW         16
 #define   XY_FAST_COLOR_BLT_MOCS_MASK  GENMASK(27, 22)
 #define   XE2_XY_FAST_COLOR_BLT_MOCS_INDEX_MASK        GENMASK(27, 24)
 #define   XY_FAST_COLOR_BLT_MEM_TYPE_SHIFT 31
index f3c2ef269ba8c533107770e3c4bf1375eabf9584..6ffd50050e3e87c1cb062d97369dfa8289f3821e 100644 (file)
@@ -1484,15 +1484,21 @@ static void emit_clear_link_copy(struct xe_gt *gt, struct xe_bb *bb, u64 src_ofs
        bb->len += len;
 }
 
+static u32 blt_fast_color_cmd_len(struct xe_device *xe)
+{
+       if (GRAPHICS_VERx100(xe) >= 1250)
+               return 16;
+       else
+               return 11;
+}
+
 static void emit_clear_main_copy(struct xe_gt *gt, struct xe_bb *bb,
                                 u64 src_ofs, u32 size, u32 pitch, bool is_vram)
 {
        struct xe_device *xe = gt_to_xe(gt);
        u32 *cs = bb->cs + bb->len;
-       u32 len = XY_FAST_COLOR_BLT_DW;
+       u32 len = blt_fast_color_cmd_len(xe);
 
-       if (GRAPHICS_VERx100(xe) < 1250)
-               len = 11;
 
        *cs++ = XY_FAST_COLOR_BLT_CMD | XY_FAST_COLOR_BLT_DEPTH_32 |
                (len - 2);
@@ -1527,10 +1533,12 @@ static void emit_clear_main_copy(struct xe_gt *gt, struct xe_bb *bb,
 
 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;
        else
-               return XY_FAST_COLOR_BLT_DW;
+               return blt_fast_color_cmd_len(xe);
 }
 
 static void emit_clear(struct xe_gt *gt, struct xe_bb *bb, u64 src_ofs,