Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5A1D606A322 for ; Tue, 1 Dec 2026 20:27:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=s5xkkijU Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5ECC010FCFC; Tue, 1 Dec 2026 20:27:20 +0000 (UTC) Received: from CH1PR05CU001.outbound.protection.outlook.com (mail-northcentralusazon11010045.outbound.protection.outlook.com [52.101.193.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 675F610FCE0 for ; Tue, 1 Dec 2026 20:27:06 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WDo+8sPuAv2B2X884jOdNqHUwKK+sITmEykPtddXJ3twTAJ0DG6KULSocx4kWT6mJRmGgbO7nbiFHoNkDJFoJTVvJywcerTPBcEQfXqy4tS9X1yqqoHkettZrLWAC6JKsze02TYq5b7fX53p/PAv1LHLYMC86ypP+iTSrmuiVPC70QVpeqlvCWJ+K+Jo9hhfdhwshgpCvqj7I8RtoGAKLsGXLkOyupyBn2QqQzJ0Xy4cWdasU3X4woxSDTl1WTECaxDcmcUCsxh4ZnztT6LARFt6h4lR1sgWjF9QIRNCM929LtRnR/5z/sniFzI6stxA5mlHl4uD12awLU7NOPHBcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qSTj/gPGJGzZvvwKFb/XFtbs4ZeiULVbcc65Lj0xpsc=; b=YX+aDY4mFRsJPYF48flEliN9IoPKnImqdxz7k/LhLobmfNwwnE0xeeiVETz1wg2ZE6qaVXKrxjL7iZfqhD2+ITP2frc+Gs9oSC/R3P8vQTdHp9S4IKHTaKS9v5lvHOYUZJnjnq5ct9VLb0hiF/evGQLfGH+AP/lt3CGG9c19EMS4xamuMJYs1ATbKvxXzsRBzXRE8z5L9Oc9B4PG3+hB3fvT8zhefXPivZMleW4YvxNscHSBf5bwbtBBmJD/FI5yhFr/BeQW+8ef7xgpCp4kXVpWf5YI5UDr5gA5FDWClqcb8AWORmqOPAxGXQ5MLLM9StVRHg30DecpE3gL+C2nHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qSTj/gPGJGzZvvwKFb/XFtbs4ZeiULVbcc65Lj0xpsc=; b=s5xkkijUBNOHGrw7Eizfpcv9TYqdGg+pdCZnruYwiXv9C689WbpF/IPgLMFqHr0zc/h/fAln+o6ycdyvTNPMn/5jLQoAP7dR/Q/Od+77EX2NbBrshmTD1VSyjascA2I1jYe5WiVTPKkmAILG75Qfdlynf7nDJTRp4utcsUUoWsI= Received: from CH0PR04CA0029.namprd04.prod.outlook.com (2603:10b6:610:76::34) by SJ0PR12MB7007.namprd12.prod.outlook.com (2603:10b6:a03:486::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Tue, 1 Dec 2026 20:27:00 +0000 Received: from DSM2EPF0000000C.namprd02.prod.outlook.com (2603:10b6:610:76:cafe::89) by CH0PR04CA0029.outlook.office365.com (2603:10b6:610:76::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.13 via Frontend Transport; Tue, 1 Dec 2026 20:26:59 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by DSM2EPF0000000C.mail.protection.outlook.com (10.167.23.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Tue, 1 Dec 2026 20:26:59 +0000 Received: from georzhanmkm.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Tue, 1 Dec 2026 14:26:37 -0600 From: George Zhang To: CC: Harry Wentland , Leo Li , Aurabindo Pillai , Roman Li , Wayne Lin , Tom Chung , "Fangzhi Zuo" , Dan Wheeler , Ray Wu , Ivan Lipski , Alex Hung , James Lin , Chenyu Chen , Tony Cheng , Jun Lei , George Zhang Subject: [PATCH v2 23/30] drm/amd/display: Report a DC2 BLS step overflow behind a debug option Date: Tue, 1 Dec 2026 15:22:57 -0500 Message-ID: <20261201202451.463794-25-george.zhang@amd.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261201202451.463794-2-george.zhang@amd.com> References: <20261201202451.463794-2-george.zhang@amd.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DSM2EPF0000000C:EE_|SJ0PR12MB7007:EE_ X-MS-Office365-Filtering-Correlation-Id: 04d34801-83b6-403d-3be0-08df4fe973b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700016|1800799024|376014|23010399003|82310400026|10067099003|56012099006|261026121527099003|261026140227099003|261028144727099003|261021123027099003|261022105027099003|261021121427099003|261102123227099003|261009223027099003|22082099003|18002099003|11063799006|6133799003|3023799007; X-Microsoft-Antispam-Message-Info: a5fil86s2SY43MqDmMqCWEBM5PRWeMKlOYuN3f17ztj8iJUIqPapX1jz8b2b3xT59kigQ1gnaaebVaG5OdX4UTWgF7ifg4jGYFxOQVjeI4wbFipIjGfDeW4wDdAhbcgovPOyaFOQJsLbne530d7NPAjORnaYug7AUSB/u4YxvGIegiT08tMPDvpzfBaWjBBDMDb5P4fdri9RqKS3Pc0x/bII/BDfm7hFQC8CHX6vFqwyKaNjVFLj90ipQ+DPm2VN5LD0mnQHkIoQTSRhe8LQYB+h/+745DtoG8aIy4cLwfeVORdwjnfh6dEeZpLMqjLNFBE5nyckd6iXwEVR9V8KLUfq73ysWCpVL04vVhJdnKf+UWHBZoqmk8bCD1pMvHB1sFo6cf0nWUGjax8654LDbnl/dsdNwRp/m6O0VXSz7nN/WBn7v/PEYfvLdxy5hFp9tcxmY36elmBPSAG7vCbnYXbJVvOFabSO7v2jNF7BpAjgce8AYnS0pSsTLRvVNE+MPGBT65UEF2RxacNgqWYdq1PI0LuKrjkZGdBR9wz0mehXCxojI8IOmRfzAILvV/3GQohK/WW2jBBhQtOkQVVpwQWyjKvfGUFUFEPKZMrpZiP6Bv3WdVcVttg+h2jZZxql5lEyhKJETAfvo1juR+++eZi2N8fYWCvP5B1sKkYTHXglhX8FGjQM/PnSJi34MgUAr00mg/l7Dosct1LAceUXSg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700016)(1800799024)(376014)(23010399003)(82310400026)(10067099003)(56012099006)(261026121527099003)(261026140227099003)(261028144727099003)(261021123027099003)(261022105027099003)(261021121427099003)(261102123227099003)(261009223027099003)(22082099003)(18002099003)(11063799006)(6133799003)(3023799007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: quFGrqdhap+/CPxm856JYOteStp8V1RVgzL0Hgn+LUxUglf7JtO2eo2UH0mg+sDBadh308yAto6wOWNe+O/xk3lrgJs4dsdONs90Lk2tAM4v0IC1u/MZUblyX1JAz+ge2yHKOBHr+BYBPdbsvBJFtq18fGWVDkclOXP0e4RfPzRnv5uvCLuZCAtIpZdx4aZJj3libf2J++LLg9+zW4raBf00N121P4e8CM9zzUoZLzwfoMQSFy0FXC9WmJs6MEt52PbMsnoN4qXHhIcVfkfB84D6O+E4qQMOCAE1UMtsBcvJyTpKtHyOa71/8FHxzIJUOYD1IVetDl4A2jpIMSNDmuB+uljiRJlytdj4xm06jEco2VhQhcbhBzGLcHIqkJs+gin3bCV7LC4N/mkN2jRFjGWfjVZYtI1l2V3x/GSOU/S30PU9WyaNZV4Ngw/w18T2 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 20:26:59.6648 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 04d34801-83b6-403d-3be0-08df4fe973b9 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DSM2EPF0000000C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB7007 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "amd-gfx" X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: Tony Cheng [Why] The dcn401 DC2 builders bound each sequence with a hand-counted static_assert that every table change must update. The builder already stops writing at the bound, and the commit rejects the longer sequence. [How] Drop the static_asserts. With dc->debug.dc2_bls_report_step_overflow set, the builder logs an error and breaks to the debugger at the first step past the bound. Cc: Jun Lei Signed-off-by: Tony Cheng Signed-off-by: George Zhang --- .../bls_builder/dcn401_non_seamless_builder.c | 31 ------------- .../dc/bls_builder/dcn401_seamless_builder.c | 45 +++---------------- drivers/gpu/drm/amd/display/dc/dc.h | 2 + 3 files changed, 9 insertions(+), 69 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c index 9bf814f70423..8400c3ad6e81 100644 --- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c +++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c @@ -391,37 +391,6 @@ static const struct dcn401_commit_step postamble[] = { .meta.clk_mgr_update_clocks_for_state.safe_to_lower = true }, }; -/* Bounds on what build adds for one stream in either state. */ -static_assert(ARRAY_SIZE(prepare_bandwidth) + - ARRAY_SIZE(lock) + - DCN401_MAX_OPP_HEADS * ARRAY_SIZE(blank) + - DCN401_MAX_DPP_PIPES * ARRAY_SIZE(dcn401_disconnect) + - ARRAY_SIZE(unlock) + - DCN401_MAX_DPP_PIPES * ARRAY_SIZE(dcn401_power_down) + - ARRAY_SIZE(stream_off) + - ARRAY_SIZE(optc_dsc_off) + - DCN401_MAX_OPP_HEADS * ARRAY_SIZE(dsc_off) + - ARRAY_SIZE(otg_off) + - ARRAY_SIZE(postamble) <= - DC2_BLS_MAX_STEPS, - "dcn401 commit stream-off head exceeds DC2_BLS_MAX_STEPS"); -static_assert(ARRAY_SIZE(prepare_bandwidth) + - ARRAY_SIZE(stream_timing) + - ARRAY_SIZE(opp_clock) + - ARRAY_SIZE(crtc) + - 2 * ARRAY_SIZE(optc_dsc) + - ARRAY_SIZE(output) + - ARRAY_SIZE(front_end_lock) + - ARRAY_SIZE(front_end) + - DCN401_MAX_OPP_HEADS * ( - ARRAY_SIZE(odm) + - 2 * ARRAY_SIZE(blank) + - 2 * ARRAY_SIZE(dsc) + - ARRAY_SIZE(front_end_odm)) + - ARRAY_SIZE(postamble) <= - DC2_BLS_MAX_STEPS, - "dcn401 commit enable head exceeds DC2_BLS_MAX_STEPS"); - static const struct dcn401_sub_sequence bls_head[] = { { .flags = DCN401_NEW_STATE, .steps = prepare_bandwidth, diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c index 69d6c55e78e8..402217cec1b5 100644 --- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c +++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c @@ -1786,11 +1786,6 @@ static const struct dcn401_stage enable_plane[] = { { setup_pipe_3, ARRAY_SIZE(setup_pipe_3) }, }; -#define DCN401_ENABLE_PLANE_STEPS (ARRAY_SIZE(ungate_hw) + \ - ARRAY_SIZE(setup_pipe_1) + ARRAY_SIZE(reconfigure_mpc) + \ - ARRAY_SIZE(setup_pipe_2) + ARRAY_SIZE(program_flip) + \ - ARRAY_SIZE(setup_pipe_3)) - /* * The pipe unlock, then dcn401_post_unlock_program_front_end: the * flip-pending wait, the p-state release and the MALL selection. Last, @@ -1834,39 +1829,6 @@ static const struct dcn401_commit_step trigger[] = { .meta.skip_if.no_manual_trigger = true }, }; -/* - * The update programs one stream. A pipe that leaves the stream emits - * fewer steps than a pipe the update programs, so the bound counts every - * pipe as programmed. dcn401_add_step catches a longer sequence. - */ -static_assert(ARRAY_SIZE(dcn401_disconnect) + ARRAY_SIZE(dcn401_power_down) <= - ARRAY_SIZE(dpp_lock) + DCN401_ENABLE_PLANE_STEPS + - ARRAY_SIZE(dpp_flip) + ARRAY_SIZE(dpp_mall), - "a removed pipe emits more than a programmed pipe"); -static_assert( - ARRAY_SIZE(preamble) + - ARRAY_SIZE(global_preamble) + - ARRAY_SIZE(prepare_bandwidth) + - ARRAY_SIZE(pending) + - ARRAY_SIZE(lock) + - ARRAY_SIZE(first_hubp) + - ARRAY_SIZE(global_sync) + - ARRAY_SIZE(optc_dsc) + - DCN401_MAX_OPP_HEADS * ( - ARRAY_SIZE(opp_unblank) + - ARRAY_SIZE(opp_odm) + - ARRAY_SIZE(dsc)) + - ARRAY_SIZE(unlock) + - ARRAY_SIZE(pstate) + - ARRAY_SIZE(odm_wait) + - ARRAY_SIZE(trigger) + - DCN401_MAX_DPP_PIPES * ( - ARRAY_SIZE(dpp_lock) + - DCN401_ENABLE_PLANE_STEPS + - ARRAY_SIZE(dpp_flip) + - ARRAY_SIZE(dpp_mall)) <= DC2_BLS_MAX_STEPS, - "dcn401 seamless update head exceeds DC2_BLS_MAX_STEPS"); - /* enable_stream_timing_calc: manual mode unless every span is even. */ static bool dcn401_h_timing_div_manual_mode( const struct dc_crtc_timing *timing) @@ -2127,6 +2089,13 @@ static void dcn401_add_step(struct block_sequence_state *sequence, const struct dcn401_commit_step_meta *m = &step->meta; if (*sequence->num_steps >= DC2_BLS_MAX_STEPS) { + if (*sequence->num_steps == DC2_BLS_MAX_STEPS && + dc->debug.dc2_bls_report_step_overflow && + dc->ctx && dc->ctx->logger) { + DC_LOG_ERROR("%s: more than %u BLS steps\n", __func__, + DC2_BLS_MAX_STEPS); + BREAK_TO_DEBUGGER(); + } (*sequence->num_steps)++; return; } diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index 14703c0e0224..134204f4b051 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h @@ -1349,6 +1349,8 @@ struct dc_debug_options { bool disable_dynamic_expansion_for_test_pattern; bool psr_phy_force_phy_power_down_up_level_2; bool dmub_send_az_pme_restore; + /* Log and break when a DC2 builder emits more than DC2_BLS_MAX_STEPS. */ + bool dc2_bls_report_step_overflow; uint32_t dml21_custom_derate_num_dpms; uint32_t dml21_custom_derate_at_dpm[DML2_MAX_NUM_DPM_LVL]; bool override_utm_client_qc_profile; -- 2.56.1