mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Hung <alex.hung@amd.com>
To: "Xi Ruoyao" <xry111@xry111.site>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Cc: amd-gfx@lists.freedesktop.org,
	Huacai Chen <chenhuacai@kernel.org>,
	WANG Xuerui <kernel@xen0n.name>, Mingcong Bai <jeffbai@aosc.io>,
	dri-devel@lists.freedesktop.org, loongarch@lists.linux.dev,
	linux-kernel@vger.kernel.org, Asiacn <710187964@qq.com>
Subject: Re: [PATCH] drm/amd/display/dml2: Guard dml21_map_dc_state_into_dml_display_cfg with DC_FP_START
Date: Sun, 14 Sep 2025 19:02:37 -0600	[thread overview]
Message-ID: <834110fd-a7a9-49df-acda-3fd9e7508aeb@amd.com> (raw)
In-Reply-To: <20250825085211.34396-1-xry111@xry111.site>

No regression found in DC promotion test.

Reviewed-by: Alex Hung <alex.hung@amd.com>

On 8/25/25 02:52, Xi Ruoyao wrote:
> dml21_map_dc_state_into_dml_display_cfg calls (the call is usually
> inlined by the compiler) populate_dml21_surface_config_from_plane_state
> and populate_dml21_plane_config_from_plane_state which may use FPU.  In
> a x86-64 build:
> 
>      $ objdump --disassemble=dml21_map_dc_state_into_dml_display_cfg \
>      > drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_translation_helper.o |
>      > grep %xmm -c
>      63
> 
> Thus it needs to be guarded with DC_FP_START.  But we must note that the
> current code quality of the in-kernel FPU use in AMD dml2 is very much
> problematic: we are actually calling DC_FP_START in dml21_wrapper.c
> here, and this translation unit is built with CC_FLAGS_FPU.  Strictly
> speaking this does not make any sense: with CC_FLAGS_FPU the compiler is
> allowed to generate FPU uses anywhere in the translated code, perhaps
> out of the DC_FP_START guard.  This problematic pattern also occurs in
> at least dml2_wrapper.c, dcn35_fpu.c, and dcn351_fpu.c.  Thus we really
> need a careful audit and refactor for the in-kernel FPU uses, and this
> patch is simply whacking a mole.  However per the reporter, whacking
> this mole is enough to make a 9060XT "just work."
> 
> Reported-by: Asiacn <710187964@qq.com>
> Link: https://github.com/loongson-community/discussions/issues/102
> Tested-by: Asiacn <710187964@qq.com>
> Signed-off-by: Xi Ruoyao <xry111@xry111.site>
> ---
>   drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c b/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c
> index 03de3cf06ae5..059ede6ff256 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c
> @@ -224,7 +224,9 @@ static bool dml21_mode_check_and_programming(const struct dc *in_dc, struct dc_s
>   	dml_ctx->config.svp_pstate.callbacks.release_phantom_streams_and_planes(in_dc, context);
>   
>   	/* Populate stream, plane mappings and other fields in display config. */
> +	DC_FP_START();
>   	result = dml21_map_dc_state_into_dml_display_cfg(in_dc, context, dml_ctx);
> +	DC_FP_END();
>   	if (!result)
>   		return false;
>   
> @@ -279,7 +281,9 @@ static bool dml21_check_mode_support(const struct dc *in_dc, struct dc_state *co
>   	dml_ctx->config.svp_pstate.callbacks.release_phantom_streams_and_planes(in_dc, context);
>   
>   	mode_support->dml2_instance = dml_init->dml2_instance;
> +	DC_FP_START();
>   	dml21_map_dc_state_into_dml_display_cfg(in_dc, context, dml_ctx);
> +	DC_FP_END();
>   	dml_ctx->v21.mode_programming.dml2_instance->scratch.build_mode_programming_locals.mode_programming_params.programming = dml_ctx->v21.mode_programming.programming;
>   	DC_FP_START();
>   	is_supported = dml2_check_mode_supported(mode_support);


      parent reply	other threads:[~2025-09-15  1:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25  8:52 Xi Ruoyao
2025-09-08 20:18 ` Alex Hung
2025-09-09  1:47   ` Xi Ruoyao
2025-09-09  2:02     ` Xi Ruoyao
2025-09-09  0:36 ` Huacai Chen
2025-09-15  1:02 ` Alex Hung [this message]

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=834110fd-a7a9-49df-acda-3fd9e7508aeb@amd.com \
    --to=alex.hung@amd.com \
    --cc=710187964@qq.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=chenhuacai@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jeffbai@aosc.io \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=xry111@xry111.site \
    /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

all inboxes | Powered by JetHome®