From nobody Mon Sep 15 04:06:17 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 9AE6DC677F1 for ; Sat, 14 Jan 2023 21:20:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231142AbjANVUa (ORCPT ); Sat, 14 Jan 2023 16:20:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230501AbjANVUX (ORCPT ); Sat, 14 Jan 2023 16:20:23 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B62BC9ED8 for ; Sat, 14 Jan 2023 13:20:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1673731215; bh=owq0V8Z5J5JXHykzSdI48m2IFtIiUsNYU2CP5ngYPr0=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=A3sl7bdOjcZqv6/dMNZdqqB5HykSBsZfnW1SBH/sg0DcUgFrd7LRGLXedDLyf26Ed rJx8xPFWovd4aGidkq6ev0TOk5HODUXQLwTo7FY0YCVAwMnJmQ3cAAtOoABGnfXYKh UOZ6xEPamQK6CQd6zdFXOWvev4ttGskj3PzTh1RU= Received: by b-5.in.mailobj.net [192.168.90.15] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 14 Jan 2023 22:20:15 +0100 (CET) X-EA-Auth: Gk7U1oU5YIpwDabO2Q8KWQ0UezeP9kSztRjBUwu5jSJBjOhRBDGBz3uA80uLYPP1KseRVuwVnhrOLtZ6cYFY7K5sSAbi+xFX Date: Sun, 15 Jan 2023 02:50:10 +0530 From: Deepak R Varma To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar Subject: [PATCH 1/4] drm/amd/display: Use min()/max() macros in dcn_calc_math Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Message-ID: <20230114212010.vLlASvG_oj597vARsfflymSOl_ZcFsnHCO3NM1zzChs@z> Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the standard min() / max() helper macros instead of direct variable comparison using if/else blocks or ternary operator. Change identified using minmax.cocci Coccinelle semantic patch. Signed-off-by: Deepak R Varma --- .../gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c b/dri= vers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c index cac72413a097..81629f3715d3 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c +++ b/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c @@ -52,12 +52,12 @@ float dcn_bw_min2(const float arg1, const float arg2) return arg2; if (isNaN(arg2)) return arg1; - return arg1 < arg2 ? arg1 : arg2; + return min(arg1, arg2); } =20 unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2) { - return arg1 > arg2 ? arg1 : arg2; + return max(arg1, arg2); } float dcn_bw_max2(const float arg1, const float arg2) { @@ -65,7 +65,7 @@ float dcn_bw_max2(const float arg1, const float arg2) return arg2; if (isNaN(arg2)) return arg1; - return arg1 > arg2 ? arg1 : arg2; + return max(arg1, arg2); } =20 float dcn_bw_floor2(const float arg, const float significance) @@ -93,12 +93,12 @@ float dcn_bw_ceil2(const float arg, const float signifi= cance) =20 float dcn_bw_max3(float v1, float v2, float v3) { - return v3 > dcn_bw_max2(v1, v2) ? v3 : dcn_bw_max2(v1, v2); + return max(v3, dcn_bw_max2(v1, v2)); } =20 float dcn_bw_max5(float v1, float v2, float v3, float v4, float v5) { - return dcn_bw_max3(v1, v2, v3) > dcn_bw_max2(v4, v5) ? dcn_bw_max3(v1, v2= , v3) : dcn_bw_max2(v4, v5); + return max(dcn_bw_max3(v1, v2, v3), dcn_bw_max2(v4, v5)); } =20 float dcn_bw_pow(float a, float exp) --=20 2.34.1 From nobody Mon Sep 15 04:06:17 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 81C8AC3DA78 for ; Sat, 14 Jan 2023 21:20:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230345AbjANVU6 (ORCPT ); Sat, 14 Jan 2023 16:20:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230478AbjANVUt (ORCPT ); Sat, 14 Jan 2023 16:20:49 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC8B29ED9 for ; Sat, 14 Jan 2023 13:20:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1673731242; bh=4z9iFsp+DoxOPsRSJrEoIW+T8SbcfTIo02z3jd9D0wM=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=CmnvkdPl6rp+Kbmh0xBTbVHp2sV2BGpyAvubPOyhS5BQIaNp3pYHMKajTRf/bdFfV zlySr32Jo+FnBoPPlKg31edrfRnLWY/aiAa/xKE7EiaysV1fmDnOSDzBhjtLTiTmiI 9YyW5KE1CthR2zbwTvrI2qfoCriqGd93Wfz1W4Xs= Received: by b-6.in.mailobj.net [192.168.90.16] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 14 Jan 2023 22:20:42 +0100 (CET) X-EA-Auth: cG/HSE5fIY7LcfmQRMBTYSk9qPaokkOPoCvufGol1mWz4fKAhqA0EQkemPxgt247sp/8c2u/07Yh6IU0+a9uvEVBusVi5/7j Date: Sun, 15 Jan 2023 02:50:37 +0530 From: Deepak R Varma To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar Subject: [PATCH 2/4] drm/amd/display: dcn20: Use min()/max() helper macros Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the standard min() / max() helper macros instead of direct variable comparison using if/else blocks or ternary operator. Change identified using minmax.cocci Coccinelle semantic patch. Signed-off-by: Deepak R Varma --- .../gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c | 5 +---- .../gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c= b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c index d3b5b6fedf04..850bb0f973d4 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c @@ -626,10 +626,7 @@ static bool CalculatePrefetchSchedule( =20 dst_y_prefetch_oto =3D Tpre_oto / LineTime; =20 - if (dst_y_prefetch_oto < dst_y_prefetch_equ) - *DestinationLinesForPrefetch =3D dst_y_prefetch_oto; - else - *DestinationLinesForPrefetch =3D dst_y_prefetch_equ; + *DestinationLinesForPrefetch =3D min(dst_y_prefetch_oto, dst_y_prefetch_e= qu); =20 *DestinationLinesForPrefetch =3D dml_floor(4.0 * (*DestinationLinesForPre= fetch + 0.125), 1) / 4; diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2= .c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c index edd098c7eb92..6f4903525acc 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c @@ -686,10 +686,7 @@ static bool CalculatePrefetchSchedule( =20 dst_y_prefetch_oto =3D Tpre_oto / LineTime; =20 - if (dst_y_prefetch_oto < dst_y_prefetch_equ) - *DestinationLinesForPrefetch =3D dst_y_prefetch_oto; - else - *DestinationLinesForPrefetch =3D dst_y_prefetch_equ; + *DestinationLinesForPrefetch =3D min(dst_y_prefetch_oto, dst_y_prefetch_e= qu); =20 *DestinationLinesForPrefetch =3D dml_floor(4.0 * (*DestinationLinesForPre= fetch + 0.125), 1) / 4; --=20 2.34.1 From nobody Mon Sep 15 04:06:17 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 90669C46467 for ; Sat, 14 Jan 2023 21:21:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230235AbjANVVW (ORCPT ); Sat, 14 Jan 2023 16:21:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230441AbjANVVT (ORCPT ); Sat, 14 Jan 2023 16:21:19 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C52555A2 for ; Sat, 14 Jan 2023 13:21:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1673731271; bh=wolWjCpEf1H3OIKgIMygLfimJEpe1hYUkjsFG3xvaSQ=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=c1tg4ZH5I0+IfBjxxi2KZAd7mkqw7NSo5wE9tI0G1AS0AvfH64X7qB/kbxE9TJ1zN wBYBPlleHVCre9oKfvtshgaiSFJAn9+y/y1t1h1Kc+aeVdTqJeFIyXlRj48sGz3Uvu 8KKExwiaRXcrnqNZvNQ87rVryO8Sj7fZo66RC2cM= Received: by b-6.in.mailobj.net [192.168.90.16] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 14 Jan 2023 22:21:11 +0100 (CET) X-EA-Auth: QPUqpE0hegBYiohcI3WBO46zBlZZafd7KjhOMaLKR2qPNKImrg+0H8TDInokhH06BXgI+ThOMBoLtvl3iKaVoyK+5PYKXj8y Date: Sun, 15 Jan 2023 02:51:06 +0530 From: Deepak R Varma To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar Subject: [PATCH 3/4] drm/amd/display: dcn21: Use min()/max() helper macros Message-ID: <3ef364025902b76f9aa388069026b6eace353827.1673730293.git.drv@mailo.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the standard min() / max() helper macros instead of direct variable comparison using if/else blocks or ternary operator. Change identified using minmax.cocci Coccinelle semantic patch. Signed-off-by: Deepak R Varma --- .../gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c= b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c index 1d84ae50311d..41fb5fddd85d 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c @@ -838,10 +838,7 @@ static bool CalculatePrefetchSchedule( =20 dst_y_prefetch_equ =3D dml_floor(4.0 * (dst_y_prefetch_equ + 0.125), 1) /= 4.0; =20 - if (dst_y_prefetch_oto < dst_y_prefetch_equ) - *DestinationLinesForPrefetch =3D dst_y_prefetch_oto; - else - *DestinationLinesForPrefetch =3D dst_y_prefetch_equ; + *DestinationLinesForPrefetch =3D min(dst_y_prefetch_oto, dst_y_prefetch_e= qu); =20 // Limit to prevent overflow in DST_Y_PREFETCH register *DestinationLinesForPrefetch =3D dml_min(*DestinationLinesForPrefetch, 63= .75); --=20 2.34.1 From nobody Mon Sep 15 04:06:17 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 0AF3EC46467 for ; Sat, 14 Jan 2023 21:22:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230514AbjANVV6 (ORCPT ); Sat, 14 Jan 2023 16:21:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230513AbjANVVs (ORCPT ); Sat, 14 Jan 2023 16:21:48 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9B6F59C3 for ; Sat, 14 Jan 2023 13:21:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1673731300; bh=EkdauZCzQ1cK93hqglTGGg1XeEnBheNqHiWtPXNdtH8=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=XhaDOnDIboT6HCOBi1Ymfsr1Y6Thl/XtXDfsJo0awOhjDpzE0YGLvpx7PZv9j6ILh F7ssoq7ABRMbWJVVbK+jNVcpD92miRRgcBenViQa/EDXB0PMgu5ElN5Liur2opihuC /l8bLK4o8/Qadrmo97MrkgVISH/z0KdN0C8yDL+E= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 14 Jan 2023 22:21:40 +0100 (CET) X-EA-Auth: wo+VQO9ffl4BHSNsx5JlMnia2RZdbHBhkeMPohaTckEHMhLVrBSduq54Ewvo2nRbQ50i0bdeCxQfsQUaF/76y+PJLAqy/qhx Date: Sun, 15 Jan 2023 02:51:35 +0530 From: Deepak R Varma To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar Subject: [PATCH 4/4] drm/amd/display: dcn32: Use min()/max() helper macros Message-ID: <85526bdbb34b6f9bff0118170578cea29755354d.1673730293.git.drv@mailo.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the standard min() / max() helper macros instead of direct variable comparison using if/else blocks or ternary operator. Change identified using minmax.cocci Coccinelle semantic patch. Signed-off-by: Deepak R Varma --- drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c b/drivers= /gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c index f94abd124021..80820f012891 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c @@ -908,7 +908,7 @@ static bool subvp_drr_schedulable(struct dc *dc, struct= dc_state *context, struc stretched_drr_us =3D drr_frame_us + mall_region_us + SUBVP_DRR_MARGIN_US; drr_stretched_vblank_us =3D (drr_timing->v_total - drr_timing->v_addressa= ble) * drr_timing->h_total / (double)(drr_timing->pix_clk_100hz * 100) * 1000000 + (stretched_drr_us= - drr_frame_us); - max_vblank_mallregion =3D drr_stretched_vblank_us > mall_region_us ? drr_= stretched_vblank_us : mall_region_us; + max_vblank_mallregion =3D max(drr_stretched_vblank_us, mall_region_us); =20 /* We consider SubVP + DRR schedulable if the stretched frame duration of= the DRR display (i.e. the * highest refresh rate + margin that can support UCLK P-State switch) pa= sses the static analysis @@ -999,7 +999,7 @@ static bool subvp_vblank_schedulable(struct dc *dc, str= uct dc_state *context) (double)(vblank_timing->pix_clk_100hz * 100) * 1000000; subvp_active_us =3D main_timing->v_addressable * main_timing->h_total / (double)(main_timing->pix_clk_100hz * 100) * 1000000; - max_vblank_mallregion =3D vblank_blank_us > mall_region_us ? vblank_blan= k_us : mall_region_us; + max_vblank_mallregion =3D max(vblank_blank_us, mall_region_us); =20 // Schedulable if VACTIVE region of the SubVP pipe can fit the MALL pref= etch, VBLANK frame time, // and the max of (VBLANK blanking time, MALL region) --=20 2.34.1