Commit b2bce0e5 authored by Xin Wang's avatar Xin Wang Committed by Matthew Auld
Browse files

drm/xe/pat: Add helper to query compression enable status



Add xe_pat_index_get_comp_en() helper function to check whether
compression is enabled for a given PAT index by extracting the
XE2_COMP_EN bit from the PAT table entry.

There are no current users, however there are multiple in-flight series
which will all use this helper.

CC: Nitin Gote <nitin.r.gote@intel.com>
CC: Sanjay Yadav <sanjay.kumar.yadav@intel.com>
CC: Matt Roper <matthew.d.roper@intel.com>
Suggested-by: default avatarMatthew Auld <matthew.auld@intel.com>
Signed-off-by: default avatarXin Wang <x.wang@intel.com>
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Reviewed-by: default avatarNitin Gote <nitin.r.gote@intel.com>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarSanjay Yadav <sanjay.kumar.yadav@intel.com>
Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patch.msgid.link/20251110221458.1864507-2-x.wang@intel.com
parent 6bcb180f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -196,6 +196,12 @@ u16 xe_pat_index_get_coh_mode(struct xe_device *xe, u16 pat_index)
	return xe->pat.table[pat_index].coh_mode;
}

bool xe_pat_index_get_comp_en(struct xe_device *xe, u16 pat_index)
{
	WARN_ON(pat_index >= xe->pat.n_entries);
	return !!(xe->pat.table[pat_index].value & XE2_COMP_EN);
}

static void program_pat(struct xe_gt *gt, const struct xe_pat_table_entry table[],
			int n_entries)
{
+10 −0
Original line number Diff line number Diff line
@@ -58,4 +58,14 @@ int xe_pat_dump(struct xe_gt *gt, struct drm_printer *p);
 */
u16 xe_pat_index_get_coh_mode(struct xe_device *xe, u16 pat_index);

/**
 * xe_pat_index_get_comp_en - Extract the compression enable flag for
 * the given pat_index.
 * @xe: xe device
 * @pat_index: The pat_index to query
 *
 * Return: true if compression is enabled for this pat_index, false otherwise.
 */
bool xe_pat_index_get_comp_en(struct xe_device *xe, u16 pat_index);

#endif