From patchwork Thu Sep 14 17:53:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hamza Mahfooz X-Patchwork-Id: 140777 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1388138vqi; Fri, 15 Sep 2023 16:54:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtDBGkTS/1gd1UNuS9nV8bqnPT9fshv/1GNqDRyvcksLDGGHZ2WHyVA0Khoxnatf4RyRW8 X-Received: by 2002:a05:6a20:3255:b0:14d:6309:fc94 with SMTP id hm21-20020a056a20325500b0014d6309fc94mr3407734pzc.36.1694822093689; Fri, 15 Sep 2023 16:54:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694822093; cv=pass; d=google.com; s=arc-20160816; b=RZWxs4ughBgmGyYBk93xpUbZcf+BbcBu44h+vrPoD0vbs6o8PIpzmLUTTEY8rOy2sw O0pgOJWuTyuR6Mn9cGjq+9rE6i8HaCfzfQ1Z6P+qpk82VQ4AGatshVTtJHnQS928n4XV Jp3giCrco2pvtLW3fMQNfFUKlbtUfCnfLyB7VkeJWK91RvhJr+OTCeQr+WN5bSsUq9Zb x4QVo4VUXYpny3zma9Q9PLUKOWptr08J9Ad/6rC1DIaHnfHsD08iGk9DEjX5CYdBIhO1 6fpj5vykRwkNgoQDNuEmcrjgQx8qwejjQGSBmUpAXD3ErcUr+Xki0Z0mSAukKLm/FH/i Vxiw== 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=d4jGPU9cQORcjUs95P54KkeJwuA4VPdM47qnWdx3zRw=; fh=++FdSLFLIcVeS0H8fJnKfu0ZQMJUiHyO5WFTd7fes6s=; b=ROcx9txJV61g6jgHeeYWlAmvr2Vic00D6I7qNbGV2OyNtD3XFpbm8sQFT6BEauWzgN NcJ9FkfJ/jjizvg6qEMJK3Vs9n4bxrKr393mWAdq5zT6yzohuq84e3G2BqGLlgy5bIbA J//ZAEZTRS4nc6q+sfOeTLI1uDrLiJ2/J3reyu14wrsaDtuKwRu0RbAIty788K+12ViM ZMYmssR6NibkshPme4LdbtBs0dvSgrMl/5hfJ6SP1wU5CTXuqYpMO0i6yugvyhNWyAuB l0uNSzRdxI0owLzOpEMwSd5K5YXVeMi+mUxvUUpA3MMrUpbER2qeUIA1Rz/Aq5GmxJv6 wuVw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=izkdGNsz; 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::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bk13-20020a056a02028d00b00565a8da9a4fsi3981033pgb.5.2023.09.15.16.54.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 16:54:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=izkdGNsz; 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::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 17F258191444; Thu, 14 Sep 2023 10:54:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239556AbjINRyg (ORCPT + 33 others); Thu, 14 Sep 2023 13:54:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231419AbjINRyf (ORCPT ); Thu, 14 Sep 2023 13:54:35 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2072.outbound.protection.outlook.com [40.107.244.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14575CA; Thu, 14 Sep 2023 10:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DWNKpuTWbL7SilmsOkWwJVOQ81uunu86MmlBPJcBwkYWKscfs3nr4w0A26vVYM60sU0y3QeWPvuA+y7B9f+/fhbrJjNQHB1Ra54kwRIJaTREWyTwHX+RdhtBvlslMs3kKRo/GGlu4EB5HeYVAaBIBuXima9UMrwmwUW1TtF/tk7uNHFRaLlBJlGAIkq9z1Wszd5hWzvlgkOAfxH/q75zbyThLgp8WbTvOMbiE31VYF/kvzA9ePrchPqRdHvG/X5Y6X3RaA7V7oDXJcHXrHAJ6Z1m1g1nu6KQc31LrtUfydlJ52gjoGV8aKn92qKW8ipYh8of25Hga3olUvKcchx9mw== 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=d4jGPU9cQORcjUs95P54KkeJwuA4VPdM47qnWdx3zRw=; b=FwYTWYl+neTcYIU1+nit9KS7HW9oa8+EG3dRq39t4j32kaxlv7KKTJrmAizfHCfIApkQzsq/CAob0oEmaxnJIbZWUlkMg50hBuBh+YaoFbPW7q0b9muq+aVG1ktF49f94vTv+nBqOJa6L9zCDj8ztcWpZUIv9y+w4PZwGwsOUGsZjrNboDGO1ba2joy2isu88RYijffkUfINy0Z9f5T8qrgGtKPdp7pozkgYoIKHKD2Nt+yVU3RtYFm+RySQ+kbrh0EFRGIyHrhVvXj/VwNx9h3PXKhSc7YFaCeJI/WJvc7Uv7bPgTRGRI+v6BrAB0BZn/Su/hkFLKwvrBl0jLTFMQ== 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=d4jGPU9cQORcjUs95P54KkeJwuA4VPdM47qnWdx3zRw=; b=izkdGNszYBpxy+MkwI76LB2OAqe5MO5ctYayGVuXvdXU37awwR5j6vESAsGBGTahK8+lpyz/IwaxkrZa9ItaVU13d52oo//ik3kv0aVKYwAXE0y5ai3UuPqjkd+h7QNa79ouUe1+h+rFLsWT2ouQi3eP1XxsG+SkuWaZUdcFGuk= Received: from MN2PR04CA0022.namprd04.prod.outlook.com (2603:10b6:208:d4::35) by MN2PR12MB4376.namprd12.prod.outlook.com (2603:10b6:208:26c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.19; Thu, 14 Sep 2023 17:54:28 +0000 Received: from BL6PEPF0001AB75.namprd02.prod.outlook.com (2603:10b6:208:d4:cafe::f5) by MN2PR04CA0022.outlook.office365.com (2603:10b6:208:d4::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Thu, 14 Sep 2023 17:54:28 +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 BL6PEPF0001AB75.mail.protection.outlook.com (10.167.242.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Thu, 14 Sep 2023 17:54:28 +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.2507.27; Thu, 14 Sep 2023 12:54:26 -0500 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 , Qingqing Zhuo , Aurabindo Pillai , "Hersen Wu" , Srinivasan Shanmugam , Stylon Wang , Wayne Lin , Alan Liu , Joshua Ashton , , Subject: [PATCH] drm/amd/display: fix the ability to use lower resolution modes on eDP Date: Thu, 14 Sep 2023 13:53:51 -0400 Message-ID: <20230914175354.102709-1-hamza.mahfooz@amd.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB75:EE_|MN2PR12MB4376:EE_ X-MS-Office365-Filtering-Correlation-Id: 13bc4920-7bd5-4f53-8b30-08dbb54ba401 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6PbH5+20S08uXpxe0buxod1XajMQbZnrUj1wwMUYj8fuGeMYnupaKgdnQMAoimMm9/M4iWQWgIFfFG5E9JSURJzZ26olhttS7wreFwciEFuyxwdp6x3J5eOcCFGMd69EWxe+3pd7bHFV4syImdPj9/HFZUUlMs3WsELgHTHfMiYnJgX9BfytQhrNE2iEjUljrb5mLWoK261Zv7zxddY5pDIn3ItXMFobi6MlSZ2B8m69p94XL3pF28c3F8hgFX1gNQ8GUJNydanbAiaB91Di/1cz+AdUPh8UbI+JFhq4SrWu/3KM39UHxdhe0vGJqcs3LVO012BV4R0Io7fcx/3rDctH+93AQ71Io78DVbJR5YukZN1md9MM6GfyYha/cKpKdepHDnZMn8S1ZKijxk865StgzI5ClibnVVRp2EhjpJLPSNWA9HJncpM7TDOCPIQthpEp8YI0aST8TS+IgZO0nea4bbbH4rTFR35XltJZ9oQ3Q5+whZPUZisgLsgaqWvoeTBi0v74YEuuTwCRfLNJg3gj6/xEeXD8BxJPtbvviqEJHuObElUrEVitYiYnr9o9vkZUGvClSMYg/ujI2pCfgtUc+NbVPhUMqmJOVvBYhkCI6fqiu4lanIw1NriEzr4eZ5VXSkSVRlOFa7RUyAtuexsPvBbKGM3uQ9I+PXyiC4xFthsnZCz1XGvPwXPTikdQVFneXJC+5QHSbEtkdZZut+UzIDoc/t28llkxTn8RpHsQnE3Nr+hSkm0Rx/0sEQistOgPaS1BJSGdQ/OHO2xYfz33kjjlYzGmT1lYNApzE3Q= 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:(13230031)(4636009)(39860400002)(136003)(376002)(396003)(346002)(186009)(1800799009)(451199024)(82310400011)(46966006)(36840700001)(40470700004)(8676002)(4326008)(8936002)(70586007)(316002)(6916009)(70206006)(54906003)(44832011)(5660300002)(40460700003)(41300700001)(36756003)(36860700001)(426003)(16526019)(1076003)(40480700001)(336012)(26005)(356005)(82740400003)(6666004)(81166007)(2616005)(478600001)(47076005)(966005)(83380400001)(86362001)(2906002)(36900700001)(16060500005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2023 17:54:28.1327 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 13bc4920-7bd5-4f53-8b30-08dbb54ba401 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: BL6PEPF0001AB75.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4376 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 10:54:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777048994869919569 X-GMAIL-MSGID: 1777149771480102491 On eDP we can receive invalid modes from dm_update_crtc_state() for entirely new streams for which drm_mode_set_crtcinfo() shouldn't be called on. So, instead of calling drm_mode_set_crtcinfo() from within create_stream_for_sink() we can instead call it from amdgpu_dm_connector_mode_valid(). Since, we are guaranteed to only call drm_mode_set_crtcinfo() for valid modes from that function (invalid modes are rejected by that callback) and that is the only user of create_validate_stream_for_sink() that we need to call drm_mode_set_crtcinfo() for (as before commit cb841d27b876 ("drm/amd/display: Always pass connector_state to stream validation"), that is the only place where create_validate_stream_for_sink()'s dm_state was NULL). Cc: stable@vger.kernel.org Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2693 Fixes: cb841d27b876 ("drm/amd/display: Always pass connector_state to stream validation") Signed-off-by: Hamza Mahfooz Reviewed-by: Harry Wentland --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 933c9b5d5252..beef4fef7338 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -6128,8 +6128,6 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, if (recalculate_timing) drm_mode_set_crtcinfo(&saved_mode, 0); - else if (!old_stream) - drm_mode_set_crtcinfo(&mode, 0); /* * If scaling is enabled and refresh rate didn't change @@ -6691,6 +6689,8 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connec goto fail; } + drm_mode_set_crtcinfo(mode, 0); + stream = create_validate_stream_for_sink(aconnector, mode, to_dm_connector_state(connector->state), NULL);