[PATCH i-g-t v2 1/2] lib/intel_blt: Add helper function to ensure platform supports compression

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Fri Mar 29 05:01:32 UTC 2024


On Fri, Mar 29, 2024 at 09:30:12AM -0700, Akshata Jahagirdar wrote:
> Add helper function to check if platform has flat-ccs enabled  by
> reading from debugfs entry.
> 
> Signed-off-by: Akshata Jahagirdar <akshata.jahagirdar at intel.com>
> ---
>  lib/intel_blt.c | 14 ++++++++++++++
>  lib/intel_blt.h |  1 +
>  2 files changed, 15 insertions(+)
> 
> diff --git a/lib/intel_blt.c b/lib/intel_blt.c
> index fe0a45cb8..0e569c5a2 100644
> --- a/lib/intel_blt.c
> +++ b/lib/intel_blt.c
> @@ -464,6 +464,20 @@ bool blt_block_copy_supports_compression(int fd)
>  				    BLT_CMD_SUPPORTS_COMPRESSION);
>  }
>  
> +/**
> + * blt_platform_supports_compression
> + * @fd: drm fd
> + *
> + * Check if platform provided by @fd device supports compression.
> + *
> + * Returns:
> + * true if it does, false otherwise.
> + */
> +bool blt_platform_supports_compression(int fd)
> +{
> +	return igt_debugfs_search(fd, "info", "has_flat_ccs yes");
> +}

I would use 'blt_platform_has_flat_ccs_enabled' as the function name, as
this describes BIOS may have disabled it. Same I would update comment
because platform may support compression but it is not enabled.

--
Zbigniew

> +
>  /**
>   * blt_uses_extended_block_copy
>   * @fd: drm fd
> diff --git a/lib/intel_blt.h b/lib/intel_blt.h
> index 1f6c71359..a2c4a4adb 100644
> --- a/lib/intel_blt.h
> +++ b/lib/intel_blt.h
> @@ -209,6 +209,7 @@ bool blt_fast_copy_supports_tiling(int fd, enum blt_tiling_type tiling);
>  bool blt_block_copy_supports_tiling(int fd, enum blt_tiling_type tiling);
>  bool blt_xy_src_copy_supports_tiling(int fd, enum blt_tiling_type tiling);
>  bool blt_block_copy_supports_compression(int fd);
> +bool blt_platform_supports_compression(int fd);
>  bool blt_uses_extended_block_copy(int fd);
>  
>  const char *blt_tiling_name(enum blt_tiling_type tiling);
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list