From nobody Thu Dec 18 04:17:14 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A10EC32771 for ; Mon, 26 Sep 2022 12:00:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236747AbiIZMAl (ORCPT ); Mon, 26 Sep 2022 08:00:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238962AbiIZL5E (ORCPT ); Mon, 26 Sep 2022 07:57:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4867579A7B; Mon, 26 Sep 2022 03:51:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8229AB80171; Mon, 26 Sep 2022 10:50:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0E9DC433C1; Mon, 26 Sep 2022 10:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189422; bh=FtwDgHom7j0u6AGoS2AkrkclrI63h8CA0BZH3cF+vKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vquZUGPCYsHYx7n0SR6eL/XaL/iilFyS+04CVfIsZpiyA0LVP0k5gsEkbzVA3Po2c OIGJDS7w0RK5EZC6muUUBHtEjDzZr4zKas3LwdOE0ZzGVFPDHED99wnJWKJyf+v/8m 9wLOT6pGqsNK/0E0nTgqFRHprq/LPOjFUABq0Wxk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Sudip Mukherjee (Codethink)" , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Rodrigo Siqueira , Nathan Chancellor , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 183/207] drm/amd/display: Reduce number of arguments of dml31s CalculateFlipSchedule() Date: Mon, 26 Sep 2022 12:12:52 +0200 Message-Id: <20220926100814.801813402@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor [ Upstream commit 21485d3da659b66c37d99071623af83ee1c6733d ] Most of the arguments are identical between the two call sites and they can be accessed through the 'struct vba_vars_st' pointer. This reduces the total amount of stack space that dml31_ModeSupportAndSystemConfigurationFull() uses by 112 bytes with LLVM 16 (1976 -> 1864), helping clear up the following clang warning: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_mode_vba_31.c:= 3908:6: error: stack frame size (2216) exceeds limit (2048) in 'dml31_ModeS= upportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than] void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib = *mode_lib) ^ 1 error generated. Link: https://github.com/ClangBuiltLinux/linux/issues/1681 Reported-by: "Sudip Mukherjee (Codethink)" Tested-by: Ma=C3=ADra Canal Reviewed-by: Rodrigo Siqueira Signed-off-by: Nathan Chancellor Signed-off-by: Rodrigo Siqueira Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../dc/dml/dcn31/display_mode_vba_31.c | 172 +++++------------- 1 file changed, 47 insertions(+), 125 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c= b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c index 586825d85d66..40a672236198 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c @@ -261,33 +261,13 @@ static void CalculateRowBandwidth( =20 static void CalculateFlipSchedule( struct display_mode_lib *mode_lib, + unsigned int k, double HostVMInefficiencyFactor, double UrgentExtraLatency, double UrgentLatency, - unsigned int GPUVMMaxPageTableLevels, - bool HostVMEnable, - unsigned int HostVMMaxNonCachedPageTableLevels, - bool GPUVMEnable, - double HostVMMinPageSize, double PDEAndMetaPTEBytesPerFrame, double MetaRowBytes, - double DPTEBytesPerRow, - double BandwidthAvailableForImmediateFlip, - unsigned int TotImmediateFlipBytes, - enum source_format_class SourcePixelFormat, - double LineTime, - double VRatio, - double VRatioChroma, - double Tno_bw, - bool DCCEnable, - unsigned int dpte_row_height, - unsigned int meta_row_height, - unsigned int dpte_row_height_chroma, - unsigned int meta_row_height_chroma, - double *DestinationLinesToRequestVMInImmediateFlip, - double *DestinationLinesToRequestRowInImmediateFlip, - double *final_flip_bw, - bool *ImmediateFlipSupportedForPipe); + double DPTEBytesPerRow); static double CalculateWriteBackDelay( enum source_format_class WritebackPixelFormat, double WritebackHRatio, @@ -2878,33 +2858,13 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchPar= ametersWatermarksAndPerforman for (k =3D 0; k < v->NumberOfActivePlanes; ++k) { CalculateFlipSchedule( mode_lib, + k, HostVMInefficiencyFactor, v->UrgentExtraLatency, v->UrgentLatency, - v->GPUVMMaxPageTableLevels, - v->HostVMEnable, - v->HostVMMaxNonCachedPageTableLevels, - v->GPUVMEnable, - v->HostVMMinPageSize, v->PDEAndMetaPTEBytesFrame[k], v->MetaRowByte[k], - v->PixelPTEBytesPerRow[k], - v->BandwidthAvailableForImmediateFlip, - v->TotImmediateFlipBytes, - v->SourcePixelFormat[k], - v->HTotal[k] / v->PixelClock[k], - v->VRatio[k], - v->VRatioChroma[k], - v->Tno_bw[k], - v->DCCEnable[k], - v->dpte_row_height[k], - v->meta_row_height[k], - v->dpte_row_height_chroma[k], - v->meta_row_height_chroma[k], - &v->DestinationLinesToRequestVMInImmediateFlip[k], - &v->DestinationLinesToRequestRowInImmediateFlip[k], - &v->final_flip_bw[k], - &v->ImmediateFlipSupportedForPipe[k]); + v->PixelPTEBytesPerRow[k]); } =20 v->total_dcn_read_bw_with_flip =3D 0.0; @@ -3624,61 +3584,43 @@ static void CalculateRowBandwidth( =20 static void CalculateFlipSchedule( struct display_mode_lib *mode_lib, + unsigned int k, double HostVMInefficiencyFactor, double UrgentExtraLatency, double UrgentLatency, - unsigned int GPUVMMaxPageTableLevels, - bool HostVMEnable, - unsigned int HostVMMaxNonCachedPageTableLevels, - bool GPUVMEnable, - double HostVMMinPageSize, double PDEAndMetaPTEBytesPerFrame, double MetaRowBytes, - double DPTEBytesPerRow, - double BandwidthAvailableForImmediateFlip, - unsigned int TotImmediateFlipBytes, - enum source_format_class SourcePixelFormat, - double LineTime, - double VRatio, - double VRatioChroma, - double Tno_bw, - bool DCCEnable, - unsigned int dpte_row_height, - unsigned int meta_row_height, - unsigned int dpte_row_height_chroma, - unsigned int meta_row_height_chroma, - double *DestinationLinesToRequestVMInImmediateFlip, - double *DestinationLinesToRequestRowInImmediateFlip, - double *final_flip_bw, - bool *ImmediateFlipSupportedForPipe) + double DPTEBytesPerRow) { + struct vba_vars_st *v =3D &mode_lib->vba; double min_row_time =3D 0.0; unsigned int HostVMDynamicLevelsTrips; double TimeForFetchingMetaPTEImmediateFlip; double TimeForFetchingRowInVBlankImmediateFlip; double ImmediateFlipBW; + double LineTime =3D v->HTotal[k] / v->PixelClock[k]; =20 - if (GPUVMEnable =3D=3D true && HostVMEnable =3D=3D true) { - HostVMDynamicLevelsTrips =3D HostVMMaxNonCachedPageTableLevels; + if (v->GPUVMEnable =3D=3D true && v->HostVMEnable =3D=3D true) { + HostVMDynamicLevelsTrips =3D v->HostVMMaxNonCachedPageTableLevels; } else { HostVMDynamicLevelsTrips =3D 0; } =20 - if (GPUVMEnable =3D=3D true || DCCEnable =3D=3D true) { - ImmediateFlipBW =3D (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEByt= esPerRow) * BandwidthAvailableForImmediateFlip / TotImmediateFlipBytes; + if (v->GPUVMEnable =3D=3D true || v->DCCEnable[k] =3D=3D true) { + ImmediateFlipBW =3D (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEByt= esPerRow) * v->BandwidthAvailableForImmediateFlip / v->TotImmediateFlipByte= s; } =20 - if (GPUVMEnable =3D=3D true) { + if (v->GPUVMEnable =3D=3D true) { TimeForFetchingMetaPTEImmediateFlip =3D dml_max3( - Tno_bw + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / Immed= iateFlipBW, - UrgentExtraLatency + UrgentLatency * (GPUVMMaxPageTableLevels * (HostV= MDynamicLevelsTrips + 1) - 1), + v->Tno_bw[k] + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor /= ImmediateFlipBW, + UrgentExtraLatency + UrgentLatency * (v->GPUVMMaxPageTableLevels * (Ho= stVMDynamicLevelsTrips + 1) - 1), LineTime / 4.0); } else { TimeForFetchingMetaPTEImmediateFlip =3D 0; } =20 - *DestinationLinesToRequestVMInImmediateFlip =3D dml_ceil(4.0 * (TimeForFe= tchingMetaPTEImmediateFlip / LineTime), 1) / 4.0; - if ((GPUVMEnable =3D=3D true || DCCEnable =3D=3D true)) { + v->DestinationLinesToRequestVMInImmediateFlip[k] =3D dml_ceil(4.0 * (Time= ForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0; + if ((v->GPUVMEnable =3D=3D true || v->DCCEnable[k] =3D=3D true)) { TimeForFetchingRowInVBlankImmediateFlip =3D dml_max3( (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / Immediat= eFlipBW, UrgentLatency * (HostVMDynamicLevelsTrips + 1), @@ -3687,54 +3629,54 @@ static void CalculateFlipSchedule( TimeForFetchingRowInVBlankImmediateFlip =3D 0; } =20 - *DestinationLinesToRequestRowInImmediateFlip =3D dml_ceil(4.0 * (TimeForF= etchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0; + v->DestinationLinesToRequestRowInImmediateFlip[k] =3D dml_ceil(4.0 * (Tim= eForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0; =20 - if (GPUVMEnable =3D=3D true) { - *final_flip_bw =3D dml_max( - PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (*DestinationL= inesToRequestVMInImmediateFlip * LineTime), - (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*Destin= ationLinesToRequestRowInImmediateFlip * LineTime)); - } else if ((GPUVMEnable =3D=3D true || DCCEnable =3D=3D true)) { - *final_flip_bw =3D (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyF= actor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime); + if (v->GPUVMEnable =3D=3D true) { + v->final_flip_bw[k] =3D dml_max( + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (v->Destinatio= nLinesToRequestVMInImmediateFlip[k] * LineTime), + (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->Dest= inationLinesToRequestRowInImmediateFlip[k] * LineTime)); + } else if ((v->GPUVMEnable =3D=3D true || v->DCCEnable[k] =3D=3D true)) { + v->final_flip_bw[k] =3D (MetaRowBytes + DPTEBytesPerRow * HostVMIneffici= encyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime= ); } else { - *final_flip_bw =3D 0; + v->final_flip_bw[k] =3D 0; } =20 - if (SourcePixelFormat =3D=3D dm_420_8 || SourcePixelFormat =3D=3D dm_420_= 10 || SourcePixelFormat =3D=3D dm_rgbe_alpha) { - if (GPUVMEnable =3D=3D true && DCCEnable !=3D true) { - min_row_time =3D dml_min(dpte_row_height * LineTime / VRatio, dpte_row_= height_chroma * LineTime / VRatioChroma); - } else if (GPUVMEnable !=3D true && DCCEnable =3D=3D true) { - min_row_time =3D dml_min(meta_row_height * LineTime / VRatio, meta_row_= height_chroma * LineTime / VRatioChroma); + if (v->SourcePixelFormat[k] =3D=3D dm_420_8 || v->SourcePixelFormat[k] = =3D=3D dm_420_10 || v->SourcePixelFormat[k] =3D=3D dm_rgbe_alpha) { + if (v->GPUVMEnable =3D=3D true && v->DCCEnable[k] !=3D true) { + min_row_time =3D dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k= ], v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); + } else if (v->GPUVMEnable !=3D true && v->DCCEnable[k] =3D=3D true) { + min_row_time =3D dml_min(v->meta_row_height[k] * LineTime / v->VRatio[k= ], v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); } else { min_row_time =3D dml_min4( - dpte_row_height * LineTime / VRatio, - meta_row_height * LineTime / VRatio, - dpte_row_height_chroma * LineTime / VRatioChroma, - meta_row_height_chroma * LineTime / VRatioChroma); + v->dpte_row_height[k] * LineTime / v->VRatio[k], + v->meta_row_height[k] * LineTime / v->VRatio[k], + v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k], + v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); } } else { - if (GPUVMEnable =3D=3D true && DCCEnable !=3D true) { - min_row_time =3D dpte_row_height * LineTime / VRatio; - } else if (GPUVMEnable !=3D true && DCCEnable =3D=3D true) { - min_row_time =3D meta_row_height * LineTime / VRatio; + if (v->GPUVMEnable =3D=3D true && v->DCCEnable[k] !=3D true) { + min_row_time =3D v->dpte_row_height[k] * LineTime / v->VRatio[k]; + } else if (v->GPUVMEnable !=3D true && v->DCCEnable[k] =3D=3D true) { + min_row_time =3D v->meta_row_height[k] * LineTime / v->VRatio[k]; } else { - min_row_time =3D dml_min(dpte_row_height * LineTime / VRatio, meta_row_= height * LineTime / VRatio); + min_row_time =3D dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k= ], v->meta_row_height[k] * LineTime / v->VRatio[k]); } } =20 - if (*DestinationLinesToRequestVMInImmediateFlip >=3D 32 || *DestinationLi= nesToRequestRowInImmediateFlip >=3D 16 + if (v->DestinationLinesToRequestVMInImmediateFlip[k] >=3D 32 || v->Destin= ationLinesToRequestRowInImmediateFlip[k] >=3D 16 || TimeForFetchingMetaPTEImmediateFlip + 2 * TimeForFetchingRowInVBlank= ImmediateFlip > min_row_time) { - *ImmediateFlipSupportedForPipe =3D false; + v->ImmediateFlipSupportedForPipe[k] =3D false; } else { - *ImmediateFlipSupportedForPipe =3D true; + v->ImmediateFlipSupportedForPipe[k] =3D true; } =20 #ifdef __DML_VBA_DEBUG__ - dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip =3D %f\n",= __func__, *DestinationLinesToRequestVMInImmediateFlip); - dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip =3D %f\n"= , __func__, *DestinationLinesToRequestRowInImmediateFlip); + dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip =3D %f\n",= __func__, v->DestinationLinesToRequestVMInImmediateFlip[k]); + dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip =3D %f\n"= , __func__, v->DestinationLinesToRequestRowInImmediateFlip[k]); dml_print("DML::%s: TimeForFetchingMetaPTEImmediateFlip =3D %f\n", __func= __, TimeForFetchingMetaPTEImmediateFlip); dml_print("DML::%s: TimeForFetchingRowInVBlankImmediateFlip =3D %f\n", __= func__, TimeForFetchingRowInVBlankImmediateFlip); dml_print("DML::%s: min_row_time =3D %f\n", __func__, min_row_time); - dml_print("DML::%s: ImmediateFlipSupportedForPipe =3D %d\n", __func__, *I= mmediateFlipSupportedForPipe); + dml_print("DML::%s: ImmediateFlipSupportedForPipe =3D %d\n", __func__, v-= >ImmediateFlipSupportedForPipe[k]); #endif =20 } @@ -5325,33 +5267,13 @@ void dml31_ModeSupportAndSystemConfigurationFull(st= ruct display_mode_lib *mode_l for (k =3D 0; k < v->NumberOfActivePlanes; k++) { CalculateFlipSchedule( mode_lib, + k, HostVMInefficiencyFactor, v->ExtraLatency, v->UrgLatency[i], - v->GPUVMMaxPageTableLevels, - v->HostVMEnable, - v->HostVMMaxNonCachedPageTableLevels, - v->GPUVMEnable, - v->HostVMMinPageSize, v->PDEAndMetaPTEBytesPerFrame[i][j][k], v->MetaRowBytes[i][j][k], - v->DPTEBytesPerRow[i][j][k], - v->BandwidthAvailableForImmediateFlip, - v->TotImmediateFlipBytes, - v->SourcePixelFormat[k], - v->HTotal[k] / v->PixelClock[k], - v->VRatio[k], - v->VRatioChroma[k], - v->Tno_bw[k], - v->DCCEnable[k], - v->dpte_row_height[k], - v->meta_row_height[k], - v->dpte_row_height_chroma[k], - v->meta_row_height_chroma[k], - &v->DestinationLinesToRequestVMInImmediateFlip[k], - &v->DestinationLinesToRequestRowInImmediateFlip[k], - &v->final_flip_bw[k], - &v->ImmediateFlipSupportedForPipe[k]); + v->DPTEBytesPerRow[i][j][k]); } v->total_dcn_read_bw_with_flip =3D 0.0; for (k =3D 0; k < v->NumberOfActivePlanes; k++) { --=20 2.35.1