Commit 2c0ac321 authored by Haridhar Kalvala's avatar Haridhar Kalvala Committed by Rodrigo Vivi
Browse files

drm/xe: Adjust mocs field mask definitions



Instead of using xe_mocs_index_to_value(), simply define the bitmask
with the shift left applied. This will make it easier to adapt to new
platforms that simply use the index.

This also fixes PVC bug in emit_clear_link_copy() where the MOCS was
getting shifted both by PVC_MS_MOCS_INDEX_MASK definition and by the
xe_moc_index_to_value function.

Bspec: 44509
Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: default avatarHaridhar Kalvala <haridhar.kalvala@intel.com>
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Link: https://lore.kernel.org/r/20230929213640.3189912-2-lucas.demarchi@intel.com


Signed-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 0dcac636
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@
#define   DST_ACCESS_TYPE_SHIFT		20
#define   CCS_SIZE_MASK			0x3FF
#define   CCS_SIZE_SHIFT		8
#define   XY_CTRL_SURF_MOCS_MASK	GENMASK(31, 25)
#define   XY_CTRL_SURF_MOCS_MASK	GENMASK(31, 26)
#define   NUM_CCS_BYTES_PER_BLOCK	256
#define   NUM_BYTES_PER_CCS_BYTE	256
#define   NUM_CCS_BLKS_PER_XFER		1024
@@ -52,7 +52,7 @@
#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, 21)
#define   XY_FAST_COLOR_BLT_MOCS_MASK	GENMASK(27, 22)
#define   XY_FAST_COLOR_BLT_MEM_TYPE_SHIFT 31

#define XY_FAST_COPY_BLT_CMD		(2 << 29 | 0x42 << 22)
+3 −3
Original line number Diff line number Diff line
@@ -519,7 +519,7 @@ static void emit_copy_ccs(struct xe_gt *gt, struct xe_bb *bb,
{
	u32 *cs = bb->cs + bb->len;
	u32 num_ccs_blks;
	u32 mocs = xe_mocs_index_to_value(gt->mocs.uc_index);
	u32 mocs = gt->mocs.uc_index;

	num_ccs_blks = DIV_ROUND_UP(xe_device_ccs_bytes(gt_to_xe(gt), size),
				    NUM_CCS_BYTES_PER_BLOCK);
@@ -806,7 +806,7 @@ static void emit_clear_link_copy(struct xe_gt *gt, struct xe_bb *bb, u64 src_ofs
				 u32 size, u32 pitch)
{
	u32 *cs = bb->cs + bb->len;
	u32 mocs = xe_mocs_index_to_value(gt->mocs.uc_index);
	u32 mocs = gt->mocs.uc_index;
	u32 len = PVC_MEM_SET_CMD_LEN_DW;

	*cs++ = PVC_MEM_SET_CMD | PVC_MS_MATRIX | (len - 2);
@@ -828,7 +828,7 @@ static void emit_clear_main_copy(struct xe_gt *gt, struct xe_bb *bb,
	struct xe_device *xe = gt_to_xe(gt);
	u32 *cs = bb->cs + bb->len;
	u32 len = XY_FAST_COLOR_BLT_DW;
	u32 mocs = xe_mocs_index_to_value(gt->mocs.uc_index);
	u32 mocs = gt->mocs.uc_index;

	if (GRAPHICS_VERx100(xe) < 1250)
		len = 11;
+0 −12
Original line number Diff line number Diff line
@@ -14,16 +14,4 @@ struct xe_gt;
void xe_mocs_init_early(struct xe_gt *gt);
void xe_mocs_init(struct xe_gt *gt);

/**
 * xe_mocs_index_to_value - Translate mocs index to the mocs value exected by
 * most blitter commands.
 * @mocs_index: index into the mocs tables
 *
 * Return: The corresponding mocs value to be programmed.
 */
static inline u32 xe_mocs_index_to_value(u32 mocs_index)
{
	return mocs_index << 1;
}

#endif