[PATCH i-g-t v5 03/11] lib/intel_blt: Add i915 -> blt tile helper converter

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Tue May 14 11:37:18 UTC 2024


On Thu, May 09, 2024 at 07:33:51AM +0200, Zbigniew Kempczyński wrote:
> We have two kind of buffers in IGT - intel-buf for render and
> blt-object for blitter. intel-buf uses I915_TILING* whereas
> blt-object blt_tiling_type (T_*). To construct blt-object from
> intel-buf we need to convert I915_TILING* to T_*. Add function
> which does this conversion.
> 
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Reviewed-by: Karolina Stolarek <karolina.stolarek at intel.com>
> ---
>  lib/intel_blt.c | 21 +++++++++++++++++++++
>  lib/intel_blt.h |  1 +
>  2 files changed, 22 insertions(+)
> 
> diff --git a/lib/intel_blt.c b/lib/intel_blt.c
> index 5a281036c4..946adc538b 100644
> --- a/lib/intel_blt.c
> +++ b/lib/intel_blt.c
> @@ -560,6 +560,27 @@ int blt_tile_to_i915_tile(enum blt_tiling_type tiling)
>  	return 0;
>  }
>  
> +/**
> + * i915_tile_to_blt_tile:
> + * @tiling: tiling id
> + *
> + * Returns:
> + * id of blt tiling like T_LINEAR, T_XMAJOR, etc
> + */
> +enum blt_tiling_type i915_tile_to_blt_tile(uint32_t tiling)
> +{
> +	switch (tiling) {
> +	case I915_TILING_NONE:	return T_LINEAR;
> +	case I915_TILING_X:	return T_XMAJOR;
> +	case I915_TILING_Y:	return T_YMAJOR;
> +	case I915_TILING_4:	return T_TILE4;
> +	case I915_TILING_64:	return T_TILE64;
> +	case I915_TILING_Yf:	return T_YFMAJOR;
> +	default:
> +		igt_assert_f(0, "Unknown tiling!\n");
> +	}
> +}
> +
>  /**
>   * blt_get_min_stride
>   * @width: width in pixels
> diff --git a/lib/intel_blt.h b/lib/intel_blt.h
> index fcfce69bee..6daf46aea4 100644
> --- a/lib/intel_blt.h
> +++ b/lib/intel_blt.h
> @@ -214,6 +214,7 @@ bool blt_uses_extended_block_copy(int fd);
>  
>  const char *blt_tiling_name(enum blt_tiling_type tiling);
>  int blt_tile_to_i915_tile(enum blt_tiling_type tiling);
> +enum blt_tiling_type i915_tile_to_blt_tile(uint32_t tiling);
>  
>  uint32_t blt_get_min_stride(uint32_t width, uint32_t bpp,
>  			    enum blt_tiling_type tiling);
> -- 
> 2.34.1
> 

I need those two patches to my current work and as they are r-b'd
and safe I'm going to merge them individually.

--
Zbigniew


More information about the igt-dev mailing list