AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Aurabindo Pillai <aurabindo.pillai@amd.com>
To: "Marek Olšák" <maraeo@gmail.com>, amd-gfx@lists.freedesktop.org
Cc: "Marek Olšák" <marek.olsak@amd.com>
Subject: Re: [PATCH 11/13] drm/amdgpu/display: set plane attributes for gfx12 correctly
Date: Wed, 26 Jun 2024 16:19:51 -0400	[thread overview]
Message-ID: <6d873cc5-7e44-464f-a8d7-db57f071e885@amd.com> (raw)
In-Reply-To: <20240626183135.8606-11-marek.olsak@amd.com>



On 6/26/24 2:31 PM, Marek Olšák wrote:
> It used gfx9 flags, which has undefined behavior on gfx12.
> 
> Signed-off-by: Marek Olšák <marek.olsak@amd.com>
> ---
>   .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   | 50 ++++++++++++++++++-
>   1 file changed, 49 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> index 5a6a21e28548..e13938e01b70 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> @@ -352,6 +352,46 @@ static int amdgpu_dm_plane_fill_gfx9_plane_attributes_from_modifiers(struct amdg
>   	return ret;
>   }
>   
> +static int amdgpu_dm_plane_fill_gfx12_plane_attributes_from_modifiers(struct amdgpu_device *adev,
> +								      const struct amdgpu_framebuffer *afb,
> +								      const enum surface_pixel_format format,
> +								      const enum dc_rotation_angle rotation,
> +								      const struct plane_size *plane_size,
> +								      union dc_tiling_info *tiling_info,
> +								      struct dc_plane_dcc_param *dcc,
> +								      struct dc_plane_address *address,
> +								      const bool force_disable_dcc)
> +{
> +	const uint64_t modifier = afb->base.modifier;
> +	int ret = 0;
> +
> +	/* TODO: Most of this function shouldn't be needed on GFX12. */
> +	amdgpu_dm_plane_fill_gfx9_tiling_info_from_device(adev, tiling_info);
> +
> +	tiling_info->gfx9.swizzle = amdgpu_dm_plane_modifier_gfx9_swizzle_mode(modifier);
> +
> +	if (amdgpu_dm_plane_modifier_has_dcc(modifier) && !force_disable_dcc) {
> +		int max_compressed_block = AMD_FMT_MOD_GET(DCC_MAX_COMPRESSED_BLOCK, modifier);
> +
> +		dcc->enable = 1;
> +		dcc->independent_64b_blks = max_compressed_block == 0;
> +
> +		if (max_compressed_block == 0)
> +			dcc->dcc_ind_blk = hubp_ind_block_64b;
> +		else if (max_compressed_block == 1)
> +			dcc->dcc_ind_blk = hubp_ind_block_128b;
> +		else
> +			dcc->dcc_ind_blk = hubp_ind_block_unconstrained;
> +	}
> +
> +	/* TODO: This seems wrong because there is no DCC plane on GFX12. */
> +	ret = amdgpu_dm_plane_validate_dcc(adev, format, rotation, tiling_info, dcc, address, plane_size);
> +	if (ret)
> +		drm_dbg_kms(adev_to_drm(adev), "amdgpu_dm_plane_validate_dcc: returned error: %d\n", ret);

This can probably be removed, but lets do so after some more testing.

> +
> +	return ret;
> +}
> +
>   static void amdgpu_dm_plane_add_gfx10_1_modifiers(const struct amdgpu_device *adev,
>   						  uint64_t **mods,
>   						  uint64_t *size,
> @@ -835,7 +875,15 @@ int amdgpu_dm_plane_fill_plane_buffer_attributes(struct amdgpu_device *adev,
>   			upper_32_bits(chroma_addr);
>   	}
>   
> -	if (adev->family >= AMDGPU_FAMILY_AI) {
> +	if (adev->family >= AMDGPU_FAMILY_GC_12_0_0) {
> +		ret = amdgpu_dm_plane_fill_gfx12_plane_attributes_from_modifiers(adev, afb, format,
> +										 rotation, plane_size,
> +										 tiling_info, dcc,
> +										 address,
> +										 force_disable_dcc);
> +		if (ret)
> +			return ret;
> +	} else if (adev->family >= AMDGPU_FAMILY_AI) {
>   		ret = amdgpu_dm_plane_fill_gfx9_plane_attributes_from_modifiers(adev, afb, format,
>   										rotation, plane_size,
>   										tiling_info, dcc,

Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>

--

Thanks & Regards,
Aurabindo Pillai

  reply	other threads:[~2024-06-26 20:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26 18:31 [PATCH 01/13] drm/amdgpu: check for LINEAR_ALIGNED correctly in check_tiling_flags_gfx6 Marek Olšák
2024-06-26 18:31 ` [PATCH 02/13] drm/amdgpu/gfx11: remove superfluous cache flags Marek Olšák
2024-06-26 18:31 ` [PATCH 03/13] drm/amdgpu/gfx12: " Marek Olšák
2024-06-26 18:31 ` [PATCH 04/13] drm/amdgpu/gfx12: remove GDS leftovers Marek Olšák
2024-06-26 18:31 ` [PATCH 05/13] drm/amdgpu: remove AMD_FMT_MOD_GFX12_DCC_MAX_COMPRESSED_BLOCK_* definitions Marek Olšák
2024-06-26 20:21   ` Aurabindo Pillai
2024-06-26 18:31 ` [PATCH 06/13] drm/amdgpu/display: handle gfx12 in dm_check_cursor_fb Marek Olšák
2024-06-26 20:16   ` Aurabindo Pillai
2024-06-26 18:31 ` [PATCH 07/13] drm/amdgpu: add amdgpu_framebuffer::gfx12_dcc Marek Olšák
2024-06-26 20:51   ` Alex Deucher
2024-06-26 18:31 ` [PATCH 08/13] drm/amdgpu: don't use amdgpu_lookup_format_info on gfx12 Marek Olšák
2024-06-26 18:31 ` [PATCH 09/13] drm/amdgpu: handle gfx12 in amdgpu_display_verify_sizes Marek Olšák
2024-06-26 18:31 ` [PATCH 10/13] drm/amdgpu/display: handle gfx12 in amdgpu_dm_plane_format_mod_supported Marek Olšák
2024-06-26 20:16   ` Aurabindo Pillai
2024-06-26 18:31 ` [PATCH 11/13] drm/amdgpu/display: set plane attributes for gfx12 correctly Marek Olšák
2024-06-26 20:19   ` Aurabindo Pillai [this message]
2024-06-26 18:31 ` [PATCH 12/13] drm/amdgpu/display: add all gfx12 modifiers Marek Olšák
2024-06-26 20:20   ` Aurabindo Pillai
2024-06-26 18:31 ` [PATCH 13/13] drm/amdgpu: rewrite convert_tiling_flags_to_modifier_gfx12 Marek Olšák
2024-06-26 20:20   ` Aurabindo Pillai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6d873cc5-7e44-464f-a8d7-db57f071e885@amd.com \
    --to=aurabindo.pillai@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=maraeo@gmail.com \
    --cc=marek.olsak@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox