All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chen, Guchun" <Guchun.Chen@amd.com>
To: "Huang, Ray" <Ray.Huang@amd.com>, "Yu, Lang" <Lang.Yu@amd.com>
Cc: "Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"Lakha, Bhawanpreet" <Bhawanpreet.Lakha@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Subject: RE: [PATCH] drm/amd/display: 64-bit division on 32-bit arch issue
Date: Fri, 22 Jan 2021 09:31:49 +0000	[thread overview]
Message-ID: <CY4PR12MB1287269C14BF57706BCCC78AF1A09@CY4PR12MB1287.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20210122090353.GB735357@hr-amd>

[AMD Public Use]

Maybe it's good to modify subject to " drm/amd/display: fix 64-bit division issue on 32-bit OS"

And if header <linux/math64.h> should be included?

Regards,
Guchun

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Huang Rui
Sent: Friday, January 22, 2021 5:04 PM
To: Yu, Lang <Lang.Yu@amd.com>
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com>; amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amd/display: 64-bit division on 32-bit arch issue

On Fri, Jan 22, 2021 at 05:00:59PM +0800, Yu, Lang wrote:
> Replace "/" with div_u64 for 32-bit arch. On 32-bit arch, the use of 
> "/" for 64-bit division will cause build error, i.e. 
> "__udivdi3/__divdi3 undefined!".
> 
> Fixes: 27755cdf83f1
> drm/amd/display: Update dcn30_apply_idle_power_optimizations() code
> 
> Signed-off-by: Lang Yu <Lang.Yu@amd.com>

Acked-by: Huang Rui <ray.huang@amd.com>

> ---
>  drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c 
> b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
> index dff83c6a142a..9620fb8a27dc 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
> @@ -772,8 +772,8 @@ bool dcn30_apply_idle_power_optimizations(struct dc *dc, bool enable)
>  							cursor_cache_enable ? &cursor_attr : NULL)) {
>  				unsigned int v_total = stream->adjust.v_total_max ?
>  						stream->adjust.v_total_max : stream->timing.v_total;
> -				unsigned int refresh_hz = (unsigned long long) stream->timing.pix_clk_100hz *
> -						100LL /	(v_total * stream->timing.h_total);
> +				unsigned int refresh_hz = div_u64((unsigned long long) stream->timing.pix_clk_100hz *
> +						100LL, (v_total * stream->timing.h_total));
>  
>  				/*
>  				 * one frame time in microsec:
> @@ -800,8 +800,8 @@ bool dcn30_apply_idle_power_optimizations(struct dc *dc, bool enable)
>  				unsigned int denom = refresh_hz * 6528;
>  				unsigned int stutter_period = 
> dc->current_state->perf_params.stutter_period_us;
>  
> -				tmr_delay = (((1000000LL + 2 * stutter_period * refresh_hz) *
> -						(100LL + dc->debug.mall_additional_timer_percent) + denom - 1) /
> +				tmr_delay = div_u64(((1000000LL + 2 * stutter_period * refresh_hz) *
> +						(100LL + dc->debug.mall_additional_timer_percent) + denom - 1),
>  						denom) - 64LL;
>  
>  				/* scale should be increased until it fits into 6 bits */ @@ 
> -815,8 +815,8 @@ bool dcn30_apply_idle_power_optimizations(struct dc *dc, bool enable)
>  					}
>  
>  					denom *= 2;
> -					tmr_delay = (((1000000LL + 2 * stutter_period * refresh_hz) *
> -							(100LL + dc->debug.mall_additional_timer_percent) + denom - 1) /
> +					tmr_delay = div_u64(((1000000LL + 2 * stutter_period * refresh_hz) *
> +							(100LL + dc->debug.mall_additional_timer_percent) + denom - 
> +1),
>  							denom) - 64LL;
>  				}
>  
> --
> 2.25.1
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cguchun.chen%40amd.com%7Cd61b9d6686b64c78d73b08d8beb4ac34%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637469030487750031%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=zKx39HfCyPJmDR9NH1r0Vtap5HBImUxVBae7h1ORhUA%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2021-01-22  9:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22  9:00 [PATCH] drm/amd/display: 64-bit division on 32-bit arch issue Lang Yu
2021-01-22  9:03 ` Huang Rui
2021-01-22  9:31   ` Chen, Guchun [this message]
2021-01-22 12:35     ` Yu, Lang
2021-01-22 20:03       ` Lakha, Bhawanpreet

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=CY4PR12MB1287269C14BF57706BCCC78AF1A09@CY4PR12MB1287.namprd12.prod.outlook.com \
    --to=guchun.chen@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=Lang.Yu@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.