[PATCH 1/4] drm/xe/pat: annotate pat index table with compression info
Ghimiray, Himal Prasad
himal.prasad.ghimiray at intel.com
Wed Jan 31 05:32:36 UTC 2024
On 31-01-2024 01:06, Juha-Pekka Heikkila wrote:
> From: Matthew Auld<matthew.auld at intel.com>
>
> In a future patch we need to be able to determine if a given pat_index
> enables compression on xe2. Simplest is to annotate the PAT index table
> with this information.
>
> Signed-off-by: Matthew Auld<matthew.auld at intel.com>
> Reviewed-by: Juha-Pekka Heikkila<juhapekka.heikkila at gmail.com>
> Signed-off-by: Juha-Pekka Heikkila<juhapekka.heikkila at gmail.com>
> ---
> drivers/gpu/drm/xe/xe_pat.c | 9 ++++++++-
> drivers/gpu/drm/xe/xe_pat.h | 14 ++++++++++++++
> 2 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_pat.c b/drivers/gpu/drm/xe/xe_pat.c
> index 1ff6bc79e7d4..c3cc6e90b068 100644
> --- a/drivers/gpu/drm/xe/xe_pat.c
> +++ b/drivers/gpu/drm/xe/xe_pat.c
> @@ -104,7 +104,8 @@ static const struct xe_pat_table_entry xelpg_pat_table[] = {
> REG_FIELD_PREP(XE2_L3_POLICY, l3_policy) | \
> REG_FIELD_PREP(XE2_L4_POLICY, l4_policy) | \
> REG_FIELD_PREP(XE2_COH_MODE, __coh_mode), \
> - .coh_mode = __coh_mode ? XE_COH_AT_LEAST_1WAY : XE_COH_NONE \
> + .coh_mode = __coh_mode ? XE_COH_AT_LEAST_1WAY : XE_COH_NONE, \
> + .compressed = comp_en \
> }
>
> static const struct xe_pat_table_entry xe2_pat_table[] = {
> @@ -148,6 +149,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_has_compression(struct xe_device *xe, u16 pat_index)
> +{
> + WARN_ON(pat_index >= xe->pat.n_entries);
> + return xe->pat.table[pat_index].compressed;
> +}
> +
> static void program_pat(struct xe_gt *gt, const struct xe_pat_table_entry table[],
> int n_entries)
> {
> diff --git a/drivers/gpu/drm/xe/xe_pat.h b/drivers/gpu/drm/xe/xe_pat.h
> index fa0dfbe525cd..8c0fc68e844f 100644
> --- a/drivers/gpu/drm/xe/xe_pat.h
> +++ b/drivers/gpu/drm/xe/xe_pat.h
> @@ -29,6 +29,10 @@ struct xe_pat_table_entry {
> #define XE_COH_NONE 1
> #define XE_COH_AT_LEAST_1WAY 2
> u16 coh_mode;
> + /**
> + * @compressed: Whether compression is enabled or not with @value.
> + */
> + bool compressed;
> };
>
> /**
> @@ -58,4 +62,14 @@ void 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_has_compression - Check if the given pat_index enables
> + * compression.
> + * @xe: xe device
> + * @pat_index: The pat_index to query
> + *
> + * Note: Only applicable to xe2+, where compression is part of the PAT index.
> + */
> +bool xe_pat_index_has_compression(struct xe_device *xe, u16 pat_index);
> +
> #endif
Looks good.
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-xe/attachments/20240131/f5673956/attachment-0001.htm>
More information about the Intel-xe
mailing list