[i-g-t,v3,04/21] lib/igt_fb: Add support for VC4 SAND tiling modes

Submitted by Paul Kocialkowski on Jan. 11, 2019, 9:05 a.m.

Details

Message ID 20190111090532.19235-5-paul.kocialkowski@bootlin.com
State Accepted
Commit 9f9e7c4213b1696c7f7b143d32b2bccebd0a8245
Headers show
Series "Chamelium VC4 plane fuzzy testing, with SAND and T-tiled mode" ( rev: 1 ) in IGT

Not browsing as part of any series.

Commit Message

Paul Kocialkowski Jan. 11, 2019, 9:05 a.m.
This introduces support for the VC4 SAND tiling modes, that take a
specific parameter indicating their column height. This parameter acts
as a height-based stride equivalent, that shall be equal or greater
than the displayed height.

The parameter is extracted and returned as tile height so that enough
memory can be reserved for column heights containing extra padding.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
 lib/igt_fb.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 73f33a26a81f..7fb8e7d44bd2 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -238,8 +238,12 @@  static const struct format_desc_struct *lookup_drm_format(uint32_t drm_format)
 void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 			  unsigned *width_ret, unsigned *height_ret)
 {
-	if (is_vc4_device(fd))
+	uint32_t vc4_tiling_param = 0;
+
+	if (is_vc4_device(fd)) {
+		vc4_tiling_param = fourcc_mod_broadcom_param(tiling);
 		tiling = fourcc_mod_broadcom_mod(tiling);
+	}
 
 	switch (tiling) {
 	case LOCAL_DRM_FORMAT_MOD_NONE:
@@ -299,6 +303,26 @@  void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 		*width_ret = 128;
 		*height_ret = 32;
 		break;
+	case DRM_FORMAT_MOD_BROADCOM_SAND32:
+		igt_require_vc4(fd);
+		*width_ret = 32;
+		*height_ret = vc4_tiling_param;
+		break;
+	case DRM_FORMAT_MOD_BROADCOM_SAND64:
+		igt_require_vc4(fd);
+		*width_ret = 64;
+		*height_ret = vc4_tiling_param;
+		break;
+	case DRM_FORMAT_MOD_BROADCOM_SAND128:
+		igt_require_vc4(fd);
+		*width_ret = 128;
+		*height_ret = vc4_tiling_param;
+		break;
+	case DRM_FORMAT_MOD_BROADCOM_SAND256:
+		igt_require_vc4(fd);
+		*width_ret = 256;
+		*height_ret = vc4_tiling_param;
+		break;
 	default:
 		igt_assert(false);
 	}

Comments

On Fri, Jan 11, 2019 at 10:05:15AM +0100, Paul Kocialkowski wrote:
> This introduces support for the VC4 SAND tiling modes, that take a
> specific parameter indicating their column height. This parameter acts
> as a height-based stride equivalent, that shall be equal or greater
> than the displayed height.
> 
> The parameter is extracted and returned as tile height so that enough
> memory can be reserved for column heights containing extra padding.
> 
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>

Maxime
Reviewed-by: Lyude Paul <lyude@redhat.com>

On Fri, 2019-01-11 at 10:05 +0100, Paul Kocialkowski wrote:
> This introduces support for the VC4 SAND tiling modes, that take a
> specific parameter indicating their column height. This parameter acts
> as a height-based stride equivalent, that shall be equal or greater
> than the displayed height.
> 
> The parameter is extracted and returned as tile height so that enough
> memory can be reserved for column heights containing extra padding.
> 
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> ---
>  lib/igt_fb.c | 26 +++++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 73f33a26a81f..7fb8e7d44bd2 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -238,8 +238,12 @@ static const struct format_desc_struct
> *lookup_drm_format(uint32_t drm_format)
>  void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
>  			  unsigned *width_ret, unsigned *height_ret)
>  {
> -	if (is_vc4_device(fd))
> +	uint32_t vc4_tiling_param = 0;
> +
> +	if (is_vc4_device(fd)) {
> +		vc4_tiling_param = fourcc_mod_broadcom_param(tiling);
>  		tiling = fourcc_mod_broadcom_mod(tiling);
> +	}
>  
>  	switch (tiling) {
>  	case LOCAL_DRM_FORMAT_MOD_NONE:
> @@ -299,6 +303,26 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int
> fb_bpp,
>  		*width_ret = 128;
>  		*height_ret = 32;
>  		break;
> +	case DRM_FORMAT_MOD_BROADCOM_SAND32:
> +		igt_require_vc4(fd);
> +		*width_ret = 32;
> +		*height_ret = vc4_tiling_param;
> +		break;
> +	case DRM_FORMAT_MOD_BROADCOM_SAND64:
> +		igt_require_vc4(fd);
> +		*width_ret = 64;
> +		*height_ret = vc4_tiling_param;
> +		break;
> +	case DRM_FORMAT_MOD_BROADCOM_SAND128:
> +		igt_require_vc4(fd);
> +		*width_ret = 128;
> +		*height_ret = vc4_tiling_param;
> +		break;
> +	case DRM_FORMAT_MOD_BROADCOM_SAND256:
> +		igt_require_vc4(fd);
> +		*width_ret = 256;
> +		*height_ret = vc4_tiling_param;
> +		break;
>  	default:
>  		igt_assert(false);
>  	}