From patchwork Thu Jan 5 20:33:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hamza Mahfooz X-Patchwork-Id: 39793 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp486616wrt; Thu, 5 Jan 2023 12:39:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXvVOgnfE87DCD3JcUl4RKolMXHvgxM0tOElLW4qWk3bT7lBg/YrMqK8Zef+n5GC5+LtV7/y X-Received: by 2002:a05:6402:331:b0:48a:e829:76e2 with SMTP id q17-20020a056402033100b0048ae82976e2mr21493832edw.11.1672951173085; Thu, 05 Jan 2023 12:39:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672951173; cv=pass; d=google.com; s=arc-20160816; b=s+Y5eaLL+gS+JRAFjTWPgZ4PizQ5Hd73UMvOKPcN6Pj+lF99yM8b9OlwUKoWexJK6r e9wJDMPS1y+mws9b/09S1Dqz6xCLmcs6an4g+IsT1kgZvgut0GyA1d45R90kcqEaOvI5 ZCOkHzs3vShJ1NnKp3QehP2CmIAJC94is2JYnU4G33C1oclldzo7pBcYQ9NYfCAe76mx 4lQisVwc5JehuW1pTmGijjRlvS4dGtKxzY5iP/AV/y3oTMWpdzUWRXDaaNBCg+wGBuvT KM0/6YRUeMdSkJltGYzOHBGIhWCCg6GSyaU0Sjvp63YGFsH6g+g2rEdYT4+QuKJ+RKM3 t6DQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=7BhHmMprS3cHj6RuoN2L9pvN1wQhd3ChfSV3QwcCl3A=; b=STieAOggf1t9Db2vFcPWRPTb+KwCfA47/EeC+cwK5uH4qPDrdQtra6gIzhazk2E1O1 r9SMQa9iPNxje04Ztci99k+fHIN6A/Bwr4BPh+67Dehoy6IPbmw+lo8tZxR8RpU5w3sC wbgbWhmZ4M+xf0EEgDUWnE4JfKV2MKU6Py+eGMg0o+VNfzoOvroc83vnrtTvcNcq5e2B rhXc0VXiKz+GM9b69b2/ah7hbivtXsviVSx46EVqe8EU5AsikRRfPJ2NX+cjwrT8NtZM kDUO726PHz4LS3rfEa4hg9a7BHyqshZ5kMginEV3+zwNl+P+JSoJY9NT1Zi9Q3fH1XDq p5Qw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=GNIkCUKY; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fi26-20020a056402551a00b0049622a61f8bsi90732edb.307.2023.01.05.12.39.09; Thu, 05 Jan 2023 12:39:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=GNIkCUKY; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235405AbjAEUeo (ORCPT + 99 others); Thu, 5 Jan 2023 15:34:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232222AbjAEUem (ORCPT ); Thu, 5 Jan 2023 15:34:42 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2055.outbound.protection.outlook.com [40.107.223.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B904163D16 for ; Thu, 5 Jan 2023 12:34:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k2OEKleDsgWliDxgmFtlJKb1TVhhXY1mjLpjiW9k/JlEWQ3QRDaOUiS/Ueepbr6M7yneTqjdaeNh/7q1wWW2P1D4eax5mUFqT+cUS5P7ks1eTmPgPioHms5PKukI0z13PcEsjAnnlAR+HAK+WA4JbJQ2BwnPRil7mu029CplB4/UnXvcZ8XGIoooCeSwG3X2jy07GS8G7V6sIXDVR5NsGcD582Kv4KBMZ3BJRAvki+EgUxKVFY6e0uPCNBsazUHGU/ETuSYoHJ8WYMzhg5YXMFrNg39ezJtA5N98G4ajLuopYrMPoWKKtqaRpbKTstoheeMMvTEs+rympOkj9m/OBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=7BhHmMprS3cHj6RuoN2L9pvN1wQhd3ChfSV3QwcCl3A=; b=ARPqHY4XKcS5O9r+Le0VhEy1z3mJylqY+oKy0/i3mZBmYWdE14PUje9CXT1BelzURPIhFZ3DI5t58+vGLbn/9PS1T63Es2vHVU6ciL32Wqgm+WMJ5L19ck3Sk6qv16LQZsM3G+k4hON3VkXC5E+jSQGF6GxM3u9rR6NXUwueTDFEbQXRepH7iOQPjmw49uH/swdSECGgrkfxgnz1XnF6/4AIUNfZz7W0zBmxYDHOKROXnc0pb1IFboRIYqy7zmbZ9vdYYYEO0Mf3TEb16aNr0+F5q812NckP9dyY/ctddX7eKo3UnMK1x6/iwpsmzpt09a9WV89Z4mzhw0UB0Z2weQ== 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 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=7BhHmMprS3cHj6RuoN2L9pvN1wQhd3ChfSV3QwcCl3A=; b=GNIkCUKYz6c16aUlPz80ZC2i5JksC179AOmug0UuAPCCi6ulT/HVIEZpu/T4LwPaqsJCkn2jLuYgxBqKbfuirb4NSX7CakAgqW18bnu3bfLZIC3DbMrGfhx8J0fS1qvmmi2DSZftWlRA8qeQ2P1a52hfLc4nDSMMTbik4xVccWQ= Received: from MW4PR02CA0014.namprd02.prod.outlook.com (2603:10b6:303:16d::29) by PH0PR12MB7790.namprd12.prod.outlook.com (2603:10b6:510:289::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 20:34:37 +0000 Received: from CO1NAM11FT108.eop-nam11.prod.protection.outlook.com (2603:10b6:303:16d:cafe::dc) by MW4PR02CA0014.outlook.office365.com (2603:10b6:303:16d::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 20:34:37 +0000 X-MS-Exchange-Authentication-Results: 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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT108.mail.protection.outlook.com (10.13.175.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.18 via Frontend Transport; Thu, 5 Jan 2023 20:34:37 +0000 Received: from hamza-pc.localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 5 Jan 2023 14:34:34 -0600 From: Hamza Mahfooz To: CC: Hamza Mahfooz , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Anthony Koo , David Zhang , Po Ting Chen , "Nicholas Kazlauskas" , Shirish S , "Alex Hung" , Pavle Kotarac , Robin Chen , Camille Cho , , Subject: [PATCH v3] drm/amd/display: fix PSR-SU/DSC interoperability support Date: Thu, 5 Jan 2023 15:33:52 -0500 Message-ID: <20230105203353.378805-1-hamza.mahfooz@amd.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT108:EE_|PH0PR12MB7790:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f27c48a-5d28-4aa6-f1fb-08daef5c4362 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8btZJwoDoVlahqgOmjFm78YEYn9Vbtc/OEAMop+8SHyag3CyT6pm/1qY0HarId0BxERhvtOc23PXun18CCXCRI0rK6itjcRTWs3wTZ9HzL4UhnpxLDDd6M6xng8hz67sfoBitMhwjCgcJAS6gSt5Qzc2DBRpZUQQBn108F6T6/4zF24a+oCkOjyHPTEyRvr7F4GruP7NUehbK1QAnLiynnvf/JmIG3Yhyi3zHbOfHf0nM6eKBSE+2M5sYh/DkFG6RpYOdxZVcQVecKWqee0EPi4kYRrsBEcl/bTxg45z9i131/+kOYk9nA4DwJuNC0/szmO79boudsLFqi5x5uoAAza/bnrOSFWkHhb4DlPe2qgoigc5b858WSotcUebwJF1pY8Zt/ijOad7AK7Q8ljo+UZWefdhAGyKyujv1RDzlNPadTItTgeKMgCyp5tt+D5qVzsqPvlLs/l8w7QstiqYrbqSnE6Mt8+V5/40UxqaFE1Js4GBSdLj2YwRhDvRo30Zeq/gwnAngHKgsV7EurWcgApcaM6w+1mDAJ2PflySYR5MuFMialjEUTFxcr21JPfXnWe95Y1Yq7azI9gRoJMq9KNhHHKK0kE2zvEAiQo8Wo1x4NlHN/Nmmhq/1ShMLIxd8sn2ouPqGyWXgIw8qZuddo0kaKq+3h0DgsyqDDnKWBYgB+9ET6Le/yvs8+UoaGs0o9OqW5QLgjYMEDtgw7pfnDEzrkOQcRG3Z1N+yoxj9YcSVcD/s3b9ODTmW9eMOvxISgWqGCCPXtvnBB/3hgeLeA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(376002)(346002)(396003)(39860400002)(136003)(451199015)(36840700001)(40470700004)(46966006)(47076005)(8936002)(44832011)(426003)(83380400001)(6666004)(41300700001)(2906002)(336012)(70586007)(1076003)(36860700001)(70206006)(4326008)(5660300002)(82740400003)(8676002)(186003)(6916009)(2616005)(478600001)(356005)(16526019)(26005)(40480700001)(81166007)(316002)(54906003)(36756003)(40460700003)(82310400005)(86362001)(36900700001)(16060500005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 20:34:37.1215 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f27c48a-5d28-4aa6-f1fb-08daef5c4362 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT108.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7790 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754216448967947439?= X-GMAIL-MSGID: =?utf-8?q?1754216448967947439?= Currently, there are issues with enabling PSR-SU + DSC. This stems from the fact that DSC imposes a slice height on transmitted video data and we are not conforming to that slice height in PSR-SU regions. So, pass slice_height into su_y_granularity to feed the DSC slice height into PSR-SU code. Signed-off-by: Hamza Mahfooz Acked-by: Harry Wentland --- v2: move code to modules/power. v3: use ASSERT() instead of WARN() and add a condition that clarifies that PSR-SU + DSC can only be enabled on an eDP connection. --- .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 3 ++ .../amd/display/modules/power/power_helpers.c | 31 +++++++++++++++++++ .../amd/display/modules/power/power_helpers.h | 3 ++ 3 files changed, 37 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c index 26291db0a3cf..872d06fe1436 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c @@ -122,6 +122,9 @@ bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream) psr_config.allow_multi_disp_optimizations = (amdgpu_dc_feature_mask & DC_PSR_ALLOW_MULTI_DISP_OPT); + if (!psr_su_set_y_granularity(dc, link, stream, &psr_config)) + return false; + ret = dc_link_setup_psr(link, stream, &psr_config, &psr_context); } diff --git a/drivers/gpu/drm/amd/display/modules/power/power_helpers.c b/drivers/gpu/drm/amd/display/modules/power/power_helpers.c index 9b5d9b2c9a6a..381f708ef756 100644 --- a/drivers/gpu/drm/amd/display/modules/power/power_helpers.c +++ b/drivers/gpu/drm/amd/display/modules/power/power_helpers.c @@ -916,3 +916,34 @@ bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s { return context && context->stream_count == 1 && dc_is_embedded_signal(stream->signal); } + +bool psr_su_set_y_granularity(struct dc *dc, struct dc_link *link, + struct dc_stream_state *stream, + struct psr_config *config) +{ + uint16_t pic_height; + uint8_t slice_height; + + if (!dc->caps.edp_dsc_support || + link->panel_config.dsc.disable_dsc_edp || + !link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.dsc_support.DSC_SUPPORT || + !(link->connector_signal & SIGNAL_TYPE_EDP) || + !stream->timing.dsc_cfg.num_slices_v) + return true; + + pic_height = stream->timing.v_addressable + + stream->timing.v_border_top + stream->timing.v_border_bottom; + slice_height = pic_height / stream->timing.dsc_cfg.num_slices_v; + + if (slice_height) { + if (config->su_y_granularity && + (slice_height % config->su_y_granularity)) { + ASSERT(0); + return false; + } + + config->su_y_granularity = slice_height; + } + + return true; +} diff --git a/drivers/gpu/drm/amd/display/modules/power/power_helpers.h b/drivers/gpu/drm/amd/display/modules/power/power_helpers.h index 316452e9dbc9..bb16b37b83da 100644 --- a/drivers/gpu/drm/amd/display/modules/power/power_helpers.h +++ b/drivers/gpu/drm/amd/display/modules/power/power_helpers.h @@ -59,4 +59,7 @@ void mod_power_calc_psr_configs(struct psr_config *psr_config, const struct dc_stream_state *stream); bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_state *stream); +bool psr_su_set_y_granularity(struct dc *dc, struct dc_link *link, + struct dc_stream_state *stream, + struct psr_config *config); #endif /* MODULES_POWER_POWER_HELPERS_H_ */