[igt-dev] [PATCH v2] lib/igt_fb: Support Tile Size for AMD non linear modifiers.

Rodrigo Siqueira Rodrigo.Siqueira at amd.com
Tue Jun 22 18:11:52 UTC 2021


On 06/21, Mark Yacoub wrote:
> From: Mark Yacoub <markyacoub at google.com>
> 
> Calculate the width and height of the tile on amdgpu when the modifier
> is not linear.
> 
> v1:
> Change width_ret to bytes not pixels.
> 
> Cc: bas at basnieuwenhuizen.nl
> Cc: daniel.vetter at ffwll.ch
> Signed-off-by: Mark Yacoub <markyacoub at chromium.org>
> Change-Id: I30849ee1368fc626d1ce2826fb726cd76565a449
> ---
>  lib/igt_fb.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 71b89855..a3926dc9 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -396,6 +396,19 @@ void igt_get_fb_tile_size(int fd, uint64_t modifier, int fb_bpp,
>  		vc4_modifier_param = fourcc_mod_broadcom_param(modifier);
>  		modifier = fourcc_mod_broadcom_mod(modifier);
>  	}
> +	// For all non-linear modifiers, AMD uses 64 KiB tiles
> +	else if (IS_AMD_FMT_MOD(modifier)) {
> +		igt_require_amdgpu(fd);
> +		const int bytes_per_pixel = fb_bpp / 8;
> +		const int format_log2 = log2(bytes_per_pixel);
> +		const int pixel_log2 = log2(64 * 1024) - format_log2;
> +		const int width_log2 = (pixel_log2 + 1) / 2;
> +		const int height_log2 = pixel_log2 - width_log2;
> +
> +		*width_ret = bytes_per_pixel << width_log2;
> +		*height_ret = 1 << height_log2;
> +		return;
> +	}

Hi Mark,

This patch lgtm,

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira at amd.com>

However, let's check if Bas has any comment about it.

Btw, is the CI failure a false positive?

Thanks

>  
>  	switch (modifier) {
>  	case LOCAL_DRM_FORMAT_MOD_NONE:
> -- 
> 2.32.0.288.g62a8d224e6-goog
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Figt-dev&data=04%7C01%7CRodrigo.Siqueira%40amd.com%7C9bb62f4ec1014d6c59c508d934d9127e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637598929185530952%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=1D6ewDi%2FlMRkDjtg94ZNeaxHQFJhfMrYAbKLGQ2%2F9DA%3D&reserved=0

-- 
Rodrigo Siqueira
https://siqueira.tech


More information about the igt-dev mailing list