From patchwork Tue Nov 6 20:24:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 10671361 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF89713AD for ; Tue, 6 Nov 2018 20:25:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C00802AA29 for ; Tue, 6 Nov 2018 20:25:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B396E2AAC1; Tue, 6 Nov 2018 20:25:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5CC4B2AA29 for ; Tue, 6 Nov 2018 20:24:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7098A6E41E; Tue, 6 Nov 2018 20:24:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-eopbgr810070.outbound.protection.outlook.com [40.107.81.70]) by gabe.freedesktop.org (Postfix) with ESMTPS id E06416E414; Tue, 6 Nov 2018 20:24:42 +0000 (UTC) Received: from CY4PR1201CA0007.namprd12.prod.outlook.com (2603:10b6:910:16::17) by BY1PR12MB0423.namprd12.prod.outlook.com (2a01:111:e400:51b2::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.25; Tue, 6 Nov 2018 20:24:41 +0000 Received: from DM3NAM03FT037.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::208) by CY4PR1201CA0007.outlook.office365.com (2603:10b6:910:16::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.21 via Frontend Transport; Tue, 6 Nov 2018 20:24:41 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT037.mail.protection.outlook.com (10.152.83.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.14 via Frontend Transport; Tue, 6 Nov 2018 20:24:40 +0000 Received: from kazbox.amd.com (10.180.168.240) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Tue, 6 Nov 2018 14:24:39 -0600 From: Nicholas Kazlauskas To: , Subject: [PATCH v6 1/5] drm: Add vrr_capable property to the drm connector Date: Tue, 6 Nov 2018 15:24:31 -0500 Message-ID: <20181106202435.23556-2-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106202435.23556-1-nicholas.kazlauskas@amd.com> References: <20181106202435.23556-1-nicholas.kazlauskas@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(136003)(346002)(39860400002)(376002)(396003)(2980300002)(428003)(199004)(189003)(356004)(6666004)(8936002)(81166006)(8676002)(81156014)(186003)(77096007)(5024004)(14444005)(72206003)(50226002)(4326008)(11346002)(316002)(48376002)(50466002)(446003)(68736007)(2616005)(16586007)(26005)(7696005)(51416003)(478600001)(305945005)(476003)(47776003)(104016004)(2906002)(54906003)(110136005)(126002)(486006)(97736004)(44832011)(53936002)(76176011)(1076002)(53416004)(36756003)(336012)(5660300001)(105586002)(426003)(86362001)(106466001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR12MB0423; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT037; 1:HbGAiwjMDAIec1/Z6eU22563qrLgCOT9KSy+XZtS4S0ibFlj4Gf8mmCdav6WSKm8kqwbmn2WXyblTmc3GdlmvPATwquw0dfwNdM/hjWb5gWJilTrAoh71mVCy/62ikKY X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 35929ca6-b4dd-4e44-4946-08d64425e1b5 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060); SRVR:BY1PR12MB0423; X-Microsoft-Exchange-Diagnostics: 1; BY1PR12MB0423; 3:r7G5ee1Ij+cTLdEZ+Ffa9SES+ax6vz6zxKsTKrjgkvwqDTdUeBHKhAnahrgEZCXoWv6XnXG66aZfUDUfgm8yuEBqvR3yvODnWTd1AlsscI3k9FwzQJoLERidJm7QC200o0ow7a+wSDInvX4jPO0IiGkpAjTMeoPyQ/JT6uNVfd2JdZekhbfZFy3sRVBzMAFWKSq/qfx9n36Qa88qLGRP/P/xeotp1ciUAJ97O/RxiQzGy7w5uucKNo8LE+fheBNuCK0n32xFifZMbiTiEOapmifytmDaxqvbg5aJ0bn9Xj+0DK4B9uvscu8sUDM0PkS5N1brp3wSdP/ABWeg3vv5FOq/lC802uk/QUpDTdwKkXk=; 25:P7+QjeCzV73GGFvI8BRzwPqHInOWlWjEtC2gv5Pjj0lN/hZh4tI4gqE4nrOrVSDviESruvUJHmsql8DbmtCj6cYBinz327p4w/jZaNcQCfHAxfiMheQaqT1moDKCbj4Dyc6eohZ6gC4X2/H9b/A7YrWlgSrEKVWeBe4JUi9KX1weroDTkFLpmmN3Cos8hP0KXkV8jfDJ/rWBMs2rDNcEsBbn6QMp2m5N9PNRVNpXXbEAt8sGbcfPjoxAkNxgpIdwhCueEZGTx/WL1tmo1caAtNEoOa61GfmCZAWDqW9NmOALz0wD25Bn+gww7XcKtFa7FGr20M469TUkce8I0muGAg== X-MS-TrafficTypeDiagnostic: BY1PR12MB0423: X-Microsoft-Exchange-Diagnostics: 1; BY1PR12MB0423; 31:fdc262GlThk+2CbuXUBudvUgABaAszdAMwilMDXR048xblA+3IRhbRj1AIMdJ1ahByxANOcxE9EH3BfI+0YgVP5h9RE5ZA0HX2IM53hgasS9AuJfmHe15LmI5BsRq2BCHid1Fgg79gE+d664mJZb43ZQ3NgF0lElMT/tda20M4E3bkE5Kf0yIBcrB/vlzu38dNAEzN7iNKBi0VLIe0ez4QP+umCaxfYYgNFDlR5skS4=; 20:vHBdkKhyQXFT1jkMDvAtFaRBx+xcql2SydtjX5lmCrmlyoj04diPRvdhn8f8BeoKj76bNbKCxZ+TWhDekf9E07qEfBklif4y3oEamTUUHUmiVydr3BD9/1nsP7Tq8TcQWAuGRK88XjbiuTrKDBXm4DVlB4bzvJaMfRaA+W8rgpimsuOaLSXxyGh/KqJzicZBOmjNHUsUj/stSJfz8wjY+JMBJZ/pkKYlEqBE8clVopmA7UEvgnExB+bc3hiB31sowgjXgl5qtWl6EeF5l3SwlGVrfWWRfzWhy3INNGNTraToO2WrG+ExIkuAVD6nEUIotlgLSHBg5b895eBEyBsthZmVpJvvr0hU2bg8FDS84NKQAstv0yxvuPqY10f175iOxv8mNVP5ut736S7sXomRHHsPCXSLGcrBl44tRUdDsMLh/rZZ6eTA5JicTBI2/CD59c521PSydj28LH2QFpwy6N/UQ6jceA/Zh0Ao5LmFPWmE3lJuny3mmc/i/bAQqJnQ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93003095)(3231382)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:BY1PR12MB0423; BCL:0; PCL:0; RULEID:; SRVR:BY1PR12MB0423; X-Microsoft-Exchange-Diagnostics: 1; BY1PR12MB0423; 4:gr5dQrOvjpz87lNysXfoIN9mFoocScDreU7F3bvwursCXc79XYBzIBgo7ED9apRkCg6ZnIn3DLNmkInZF3xYpTglo23vM73J6pTbTCInA2msDJWw21LcMgqW/FxTQyfRjz7S42HIcLf96dE4sWM5pUv6yiHyv5AlVRAwagWjz/kzTS+jLZHwA9ssL5zpl0Tf7JpjDiBr60WZOAmZRgd5z8eU9pYwlYuuQV7DuEGAsaxj2NrsMLBGxO91eB3k4Tuq5mMp2CE1UTIyXayINu4Vba293t2AuixOEcib1mSM4Hk9Sh0342X5OoKcmnj9puwT5r5YESFZ/CAGWXnLbMZvJQ== X-Forefront-PRVS: 0848C1A6AA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR12MB0423; 23:xhfWty2sGmQ5WF8j00cEcHLZIJTiM27fn1daGBf4l?= ndvrsVh0zm/ganFDNej+neDbUQMSfeCn3BdMkmujV2eKsVYiRAVdr/2VECw8viTnEU+1uyiNgPOMLuEKBGv5djOhrutrAwOhJ3/FPkLblcLLmhtygtLrSo7BFLxF53JUw3ZF04WcKT70jREVxOuWM2UhO3gC+iiYWMvyz545DWVx64wuaynVJ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DWDb3kXKu+XKrM6lIqCTLXjQpjjREiVAz0A=; 7:T2qEDCdlaETbOkOBF5FVy8pVDnGANna4gmy5v4arXxEGAYQCZcovlVx1D4zEeT67SuLqyfjV7l9iSzR0WfsOX7t2YrhYimKy6/AtStJKnae+g+hH66ygcBuqPmG7H3k4lMRHmoHXRt9sXrgPwm6mgA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR12MB0423; 20:GfWZsLdahiwFij5UKy0xSpl7Qr3Pxdw26h3z118pCvTdmYJWH4n3+Zi2iC9eOpIDuqtOX6Jjlh1bGPKOAWNEEwxil1jRPTHIr9/TSG8L+1baY1Iby5aAP6+Yoc0HlOwq5eK5S82qL85NRe1qJSgEnKiBeIZ8O3M14k/elGV3LvTLQQr258vR5VllX775+VINhzK2t4ORB30HYWuNkWBec1XXfNfmT6vusO3cbrJMgfsSTB5VPoOmCpeKTccjnpl/ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2018 20:24:40.8237 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35929ca6-b4dd-4e44-4946-08d64425e1b5 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=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR12MB0423 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: michel@daenzer.net, Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Modern display hardware is capable of supporting variable refresh rates. This patch introduces the "vrr_capable" property on the connector to allow userspace to query support for variable refresh rates. Atomic drivers should attach this property to connectors that are capable of driving variable refresh rates using drm_connector_attach_vrr_capable_property(). The value should be updated based on driver and hardware capabiltiy by using drm_connector_set_vrr_capable_property(). Signed-off-by: Nicholas Kazlauskas Reviewed-by: Manasi Navare Reviewed-by: Harry Wentland --- drivers/gpu/drm/drm_connector.c | 49 +++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 15 ++++++++++ 2 files changed, 64 insertions(+) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 4943cef178be..49290060ab7b 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1255,6 +1255,37 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev) } EXPORT_SYMBOL(drm_mode_create_scaling_mode_property); +/** + * drm_connector_attach_vrr_capable_property - creates the + * vrr_capable property + * @connector: connector to create the vrr_capable property on. + * + * This is used by atomic drivers to add support for querying + * variable refresh rate capability for a connector. + * + * Returns: + * Zero on success, negative errono on failure. + */ +int drm_connector_attach_vrr_capable_property( + struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + struct drm_property *prop; + + if (!connector->vrr_capable_property) { + prop = drm_property_create_bool(dev, DRM_MODE_PROP_IMMUTABLE, + "vrr_capable"); + if (!prop) + return -ENOMEM; + + connector->vrr_capable_property = prop; + drm_object_attach_property(&connector->base, prop, 0); + } + + return 0; +} +EXPORT_SYMBOL(drm_connector_attach_vrr_capable_property); + /** * drm_connector_attach_scaling_mode_property - attach atomic scaling mode property * @connector: connector to attach scaling mode property on. @@ -1583,6 +1614,24 @@ void drm_connector_set_link_status_property(struct drm_connector *connector, } EXPORT_SYMBOL(drm_connector_set_link_status_property); +/** + * drm_connector_set_vrr_capable_property - sets the variable refresh rate + * capable property for a connector + * @connector: drm connector + * @capable: True if the connector is variable refresh rate capable + * + * Should be used by atomic drivers to update the indicated support for + * variable refresh rate over a connector. + */ +void drm_connector_set_vrr_capable_property( + struct drm_connector *connector, bool capable) +{ + drm_object_property_set_value(&connector->base, + connector->vrr_capable_property, + capable); +} +EXPORT_SYMBOL(drm_connector_set_vrr_capable_property); + /** * drm_connector_init_panel_orientation_property - * initialize the connecters panel_orientation property diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 9ccad6b062f2..4e6befff153b 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -959,6 +959,17 @@ struct drm_connector { */ struct drm_property *scaling_mode_property; + /** + * @vrr_capable_property: Optional property to help userspace + * query hardware support for variable refresh rate on a connector. + * connector. Drivers can add the property to a connector by + * calling drm_connector_attach_vrr_capable_property(). + * + * This should be updated only by calling + * drm_connector_set_vrr_capable_property(). + */ + struct drm_property *vrr_capable_property; + /** * @content_protection_property: DRM ENUM property for content * protection. See drm_connector_attach_content_protection_property(). @@ -1250,6 +1261,8 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev); int drm_connector_attach_content_type_property(struct drm_connector *dev); int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, u32 scaling_mode_mask); +int drm_connector_attach_vrr_capable_property( + struct drm_connector *connector); int drm_connector_attach_content_protection_property( struct drm_connector *connector); int drm_mode_create_aspect_ratio_property(struct drm_device *dev); @@ -1266,6 +1279,8 @@ int drm_connector_update_edid_property(struct drm_connector *connector, const struct edid *edid); void drm_connector_set_link_status_property(struct drm_connector *connector, uint64_t link_status); +void drm_connector_set_vrr_capable_property( + struct drm_connector *connector, bool capable); int drm_connector_init_panel_orientation_property( struct drm_connector *connector, int width, int height); From patchwork Tue Nov 6 20:24:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 10671359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8D491109C for ; Tue, 6 Nov 2018 20:25:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AACC29483 for ; Tue, 6 Nov 2018 20:25:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B1832AABA; Tue, 6 Nov 2018 20:25:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DEB8529483 for ; Tue, 6 Nov 2018 20:24:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9CC186E41F; Tue, 6 Nov 2018 20:24:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-eopbgr790077.outbound.protection.outlook.com [40.107.79.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 385886E419; Tue, 6 Nov 2018 20:24:45 +0000 (UTC) Received: from CY4PR1201CA0007.namprd12.prod.outlook.com (2603:10b6:910:16::17) by BLUPR12MB0419.namprd12.prod.outlook.com (2a01:111:e400:516c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Tue, 6 Nov 2018 20:24:42 +0000 Received: from DM3NAM03FT037.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::208) by CY4PR1201CA0007.outlook.office365.com (2603:10b6:910:16::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.21 via Frontend Transport; Tue, 6 Nov 2018 20:24:42 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT037.mail.protection.outlook.com (10.152.83.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.14 via Frontend Transport; Tue, 6 Nov 2018 20:24:41 +0000 Received: from kazbox.amd.com (10.180.168.240) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Tue, 6 Nov 2018 14:24:40 -0600 From: Nicholas Kazlauskas To: , Subject: [PATCH v6 2/5] drm: Add vrr_enabled property to drm CRTC Date: Tue, 6 Nov 2018 15:24:32 -0500 Message-ID: <20181106202435.23556-3-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106202435.23556-1-nicholas.kazlauskas@amd.com> References: <20181106202435.23556-1-nicholas.kazlauskas@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(136003)(39860400002)(346002)(376002)(396003)(2980300002)(428003)(189003)(199004)(11346002)(2616005)(81156014)(7696005)(53416004)(316002)(97736004)(81166006)(51416003)(53936002)(426003)(1076002)(68736007)(4326008)(14444005)(110136005)(50226002)(72206003)(26005)(77096007)(76176011)(486006)(36756003)(476003)(54906003)(16586007)(106466001)(186003)(5024004)(8936002)(478600001)(446003)(126002)(6666004)(104016004)(2906002)(47776003)(44832011)(48376002)(356004)(336012)(305945005)(8676002)(50466002)(575784001)(105586002)(86362001)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0419; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT037; 1:xxvKuX/Ba5/+jC/zvXR8CzXKPmGMqRu4wp5JZiCcPvtNUPzUEAsgVSr8InjkQ0z5suJFt636zRX31NwvPVdQusn2WH+E9r1IJZbYPuXBy4Q97aP8sk9upq2IS0XpueRI X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 101610bb-b1da-477f-b98f-08d64425e227 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:BLUPR12MB0419; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 3:jwePWChQsRoOJ2//BYWvVKkHDeVKE9F8gIhvryHn3YEoloJjHIX8Km5OX1xKrU9VMAKgm0sgf3FR0h3fUJ/NetB9ixeVKKGwGfemWHgttA/OTrR5c1gXH4IHQY5dif+UK7VuCb8ETXeXc6UaYTTBd5vF0cCXAkphdHcq1NH+AtPFTH9z08YbWdF9SGIrE18RXOSRJtgh1rkiOYOoaaMKfx+LsNXSUkoZGyEVP64j2Ia5hlg6bXp+7hLhvUqIImoarr3Mt76/1ZscuxWiPxX0VbmMIn6YWWeAjuPou+QImtBbmR93VI4um63O9n2Niaz1PLyZCk0S6nYbe9qAmG0LQntvILZTh9a9IJBNAk351Bc=; 25:cQsvXRbah64kbyEIiQbGY17p9gCxUWXf/fqClTvD7FOVNMK+C2e8AcE+aEkCT2TPhyOgpsv1o09X2jrOpAffQbW8u4u7x2zaMPUIoPvB1KKTQoJ4RrIE6eaRz4edWu20n6MbMuevDFw/APLGgzptCdaV7MzM7cE6eevQY0L+4yXDBloTbtdPjfjwZV7WZnII5Kx+bkxmD/AWfxYMocga1g5hakYRlbllWTSViToBWL4S/rldfvmT5waPqWZNLpfvGAW9IeYcJahk9eb2pu43dEtHC1k3WF0bSCoh9U3TXRW5j7ZvivL14KQt+Wy07fdBh19XAVczkWLtYHbZhEllWA== X-MS-TrafficTypeDiagnostic: BLUPR12MB0419: X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 31:abKbaAKOSbguwmNSpPCYg2Njqz0ubpEClaKtpgL7AIp8RhEXTIEqH3jDIvNERMxG+9Q2/2aKtRSesaGYkbnwnDV5yDD980kknWSB9lGgruF6gaQJKp7oVkpcc87Ei0N6iPejs0NW9FK8CT9kPsxKSGgUpAgpRTzlryFYCukRO0ZPyAT8Har6f6e7s2w8zBewAvLDaTolCWP8cD/LaQHW4Sfyp571mCCvBziUX0z0x+g=; 20:7c2nxOWnwOp3IBGBoWhJnCydUgg6+TG6UGAjjGRwBAglHbxrIl7sEOGmovwAwXNdVP84sTnuZXOJr8QpppX5gCXhDXIPoJuUMVTbQP/o98p4JVoUKT2FFYlpI2W9ObIEpY1Qa5mNjrTNiDok72Xo+jisgNUmEEE2INYegnpwJorkSItmYfUV0aofLx4LrXr4AFlox7fiV5fiC+aU1Wxt/FxE82ouISIAQMPEvJh3S6QqneQI3XmvG0LUE7NBWm2lcZpH72BXOOPS9M0SPAhqCn5m6A4F8fjdNo+hHzSOV3afEmNdmtjZFzK67fWuHqofLjXGnEpDCu/iG35QdwoKc89fnGLqgjK6hINj5rqW3XqNpOkgyB+tXXj/jEFCcLNAguMbqXuJhZDFQTwYs7XKgGqinkw9fbQq4JfwgGMkWCJraSJqz4tL5KF2afaJgDYiVkGOSP4GDB0ZW6x/3dyh7IS6yLnAgDFvpUytH1nocL/vTrzqPiLH5XiR22tHHp6u X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231382)(944501410)(52105095)(3002001)(10201501046)(93006095)(93003095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:BLUPR12MB0419; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0419; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 4:iUqhbO853505EO2r908GTRCGOWPq7raoDOMbWny0YVaNxTE1resVBtd7SZ1snMxy3fswHpRBk382aoVECA9f4XdROVESVTcC/+gcDaqLLQO9vn7cdZDXdhKVL0twpRWPDR9eYVQKMn4lUXDcuE79XRSAwgUOV3p0maNlMw2oGi3OBmJ1gnUrDmoJvYdQtrcvDIBerNqOfst/GmF3f2yVGlqyljo6HUeGkUG6y21BoM6RyxdSAF3LuH6m3tWPqX4Mhr3VVrBE3LWBFc/Wx6h24MoUUXWxlo+k4kM8oJvlDMbX2DPL3GrLFV0Rf/jtzCyAq9c7Fz3FqmsWdBrfHi92NQ== X-Forefront-PRVS: 0848C1A6AA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR12MB0419; 23:hRCNVzWbCr9BqqxgXv/z6H9//VD/3S99dPmMcKFV1?= fB/45LullMSbstYeS0/ln9Cx82ivb5MmLTrd8OReqWV5lPUAAutVQprFPQiodhrwKBruDteyOFE8HkJJXLkFdxo4P9Lm/Usm7nvCG0vNoRZZiGmSMjLjrWk1PcuwEl3al6UaqnXRCi2xSzpnsttvAmah6+12DJl/yD4HIfS8P3Yawbzk1kpEjcft6Y+PeZXgqKa4t91D9VP583u6N5JFwhgEykkoJZ0jIdTVYcfa+emyHK7GpNpzGkLC1/YNUn+4QDv88PhsOj7Y9AZygs9SgccPu+cM+FdqFJYn/d9xbjqD7s+1q5NR3mgGd7V4Jh3EngjuXwTqJepdLVWylmP7Z/oUq9o3oznfWW37ZZFcUel1NP/IsykRD5U7wktfg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6qqsyJu3MPfYX3C+pEBWaUZS5hvMZ+OjIJAxBWqMnOiIg5JQESeCN1CyRPou2zwbKAO1amO6+OWpur5xbs+zgSbAQSj/V7YDynh4p/TY30BUbYbUpYXu2caOl427ugVWhV42Ax+9GTYNvLc9K5ffWQPH9o9MStuUOamuM0jnN716TBVqRUOxGzxV4uFwPuftW2XIPvoHE309wck6zgP7N7Xa2aq525/83F0GN+bbf2A3igjDtkFnJvv X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2018 20:24:41.5736 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 101610bb-b1da-477f-b98f-08d64425e227 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=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0419 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Manasi Navare , michel@daenzer.net, Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch introduces the 'vrr_enabled' CRTC property to allow dynamic control over variable refresh rate support for a CRTC. This property should be treated like a content hint to the driver - if the hardware or driver is not capable of driving variable refresh timings then this is not considered an error. Capability for variable refresh rate support should be determined by querying the vrr_capable drm connector property. It is worth noting that while the property is intended for atomic use it isn't filtered from legacy userspace queries. This allows for Xorg userspace drivers to implement support. Signed-off-by: Nicholas Kazlauskas Reviewed-by: Harry Wentland Cc: Manasi Navare --- drivers/gpu/drm/drm_atomic_uapi.c | 4 ++++ drivers/gpu/drm/drm_crtc.c | 2 ++ drivers/gpu/drm/drm_mode_config.c | 6 ++++++ include/drm/drm_crtc.h | 9 +++++++++ include/drm/drm_mode_config.h | 5 +++++ 5 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index d5b7f315098c..eec396a57b88 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -433,6 +433,8 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc, ret = drm_atomic_set_mode_prop_for_crtc(state, mode); drm_property_blob_put(mode); return ret; + } else if (property == config->prop_vrr_enabled) { + state->vrr_enabled = val; } else if (property == config->degamma_lut_property) { ret = drm_atomic_replace_property_blob_from_id(dev, &state->degamma_lut, @@ -491,6 +493,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc, *val = state->active; else if (property == config->prop_mode_id) *val = (state->mode_blob) ? state->mode_blob->base.id : 0; + else if (property == config->prop_vrr_enabled) + *val = state->vrr_enabled; else if (property == config->degamma_lut_property) *val = (state->degamma_lut) ? state->degamma_lut->base.id : 0; else if (property == config->ctm_property) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 268a182ae189..6f8ddfcfaba5 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -340,6 +340,8 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, drm_object_attach_property(&crtc->base, config->prop_mode_id, 0); drm_object_attach_property(&crtc->base, config->prop_out_fence_ptr, 0); + drm_object_attach_property(&crtc->base, + config->prop_vrr_enabled, 0); } return 0; diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index ee80788f2c40..5670c67f28d4 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -310,6 +310,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) return -ENOMEM; dev->mode_config.prop_mode_id = prop; + prop = drm_property_create_bool(dev, 0, + "VRR_ENABLED"); + if (!prop) + return -ENOMEM; + dev->mode_config.prop_vrr_enabled = prop; + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, "DEGAMMA_LUT", 0); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index b21437bc95bf..39c3900aab3c 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -290,6 +290,15 @@ struct drm_crtc_state { */ u32 pageflip_flags; + /** + * @vrr_enabled: + * + * Indicates if variable refresh rate should be enabled for the CRTC. + * Support for the requested vrr state will depend on driver and + * hardware capabiltiy - lacking support is not treated as failure. + */ + bool vrr_enabled; + /** * @event: * diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 928e4172a0bb..49f2fcfdb5fc 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -639,6 +639,11 @@ struct drm_mode_config { * connectors must be of and active must be set to disabled, too. */ struct drm_property *prop_mode_id; + /** + * @prop_vrr_enabled: Default atomic CRTC property to indicate + * whether variable refresh rate should be enabled on the CRTC. + */ + struct drm_property *prop_vrr_enabled; /** * @dvi_i_subconnector_property: Optional DVI-I property to From patchwork Tue Nov 6 20:24:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 10671363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3B12E13AD for ; Tue, 6 Nov 2018 20:25:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ADB02AA29 for ; Tue, 6 Nov 2018 20:25:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EA742AAAC; Tue, 6 Nov 2018 20:25:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BC75B2AA62 for ; Tue, 6 Nov 2018 20:24:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1AAC96E41C; Tue, 6 Nov 2018 20:24:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-eopbgr810083.outbound.protection.outlook.com [40.107.81.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 89EC26E41B; Tue, 6 Nov 2018 20:24:45 +0000 (UTC) Received: from CY4PR1201CA0007.namprd12.prod.outlook.com (2603:10b6:910:16::17) by CY1PR12MB0742.namprd12.prod.outlook.com (2a01:111:e400:59d1::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.30; Tue, 6 Nov 2018 20:24:43 +0000 Received: from DM3NAM03FT037.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::208) by CY4PR1201CA0007.outlook.office365.com (2603:10b6:910:16::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.21 via Frontend Transport; Tue, 6 Nov 2018 20:24:43 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT037.mail.protection.outlook.com (10.152.83.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.14 via Frontend Transport; Tue, 6 Nov 2018 20:24:42 +0000 Received: from kazbox.amd.com (10.180.168.240) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Tue, 6 Nov 2018 14:24:40 -0600 From: Nicholas Kazlauskas To: , Subject: [PATCH v6 3/5] drm: Document variable refresh properties Date: Tue, 6 Nov 2018 15:24:33 -0500 Message-ID: <20181106202435.23556-4-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106202435.23556-1-nicholas.kazlauskas@amd.com> References: <20181106202435.23556-1-nicholas.kazlauskas@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(136003)(376002)(39860400002)(346002)(396003)(2980300002)(428003)(3190300001)(189003)(199004)(476003)(50466002)(126002)(23676004)(356004)(7696005)(11346002)(305945005)(486006)(446003)(2616005)(1076002)(76176011)(66574009)(81166006)(104016004)(81156014)(47776003)(336012)(39060400002)(2906002)(14444005)(5660300001)(426003)(5820100001)(53416004)(8676002)(53936002)(5024004)(6666004)(97736004)(2870700001)(44832011)(72206003)(4326008)(50226002)(68736007)(54906003)(106466001)(110136005)(186003)(478600001)(36756003)(105586002)(86362001)(316002)(26005)(77096007)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0742; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT037; 1:D2GQ45YoYum8hvE6gnshS2T5SC2TmOq7OM0DByffH7F9FRdLPxz0WT9B6Iis2oac8w+N0kYHY5HJDG322s3BdqWSUlQxPSRmTfDT3aj+AdL9iXvuFbHDdka3Hv56lKpN X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf967a41-3254-453f-37d2-08d64425e30a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060); SRVR:CY1PR12MB0742; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0742; 3:ZIeVEK+Jkfs2FWTLhtifXTpozG7tVEaYtQpgJU3Id/Gr9hE/8EBCUdFGGhw94N5e7fXqNvi8mPsct3VzFQNdsTdYEW/7SGmkYAPxWOdXZIZ/U39do6Vv9a7Ky2lN2UqAq8zu7PctdQMjd6i4Gb6VO0yr0vbwsccWM1d+IvcOlMnbPruFirSJN8V6xvTl0kHZLknaO7QZ2j2LCiiNebigl7YE01JghTnTWaMPfmSRoq1gQknSC9i1xCfUrzwAgVKjjUjmrBoucJIRKx8wx/c/HxCpjSqauDQPp6BvfkqZqTBjqW9bLNYO3kunfbRBJvPWd9FayaTEyXQ2jLQdjfeCMKobjl23+MUBb+gZQYrSzoQ=; 25:OGMtcaKzbq4nJOp5wYBV0yp7D4fFz23xMpODe4j1E7GiEtXnERSn43nogi0HIhE5de1qksznnIe17q5BrPFvbdpg7IGish13EUY2jzofaVjKkOf/ndPR8igfFg1cjp3SY47atGXE15RPnF+D/FfFpXqgj4q/vbG3HlZXpIt8VmDGbH+i0N4Ua2t/BGWrV6iHi+CXP3kmZ80Sd7zXsa7PMAi4MFGCb2PhnlWxI4HDek74omn3ua1O0k5N2qmE2kVX0rTHqbSmIZxiFJMGHThcK0p5ebDJwlw2oAez5Ec54gI5C1jjMaAlz1T0GAJB1r7C6J75zpr1CFYlaMVTsqSOnA== X-MS-TrafficTypeDiagnostic: CY1PR12MB0742: X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0742; 31:i15gVQt/IrZ7/T49sNPfCpfCwHaYIC9InmOnaeaahl7NnLvZ9264iSe7CQidCtit1wlCxvUWV25j74oJowU4y4hIBSgw3SIK+llzyfpd8PKPqBR4fk6q6w2X8taAnD/ZbCfvmdEkCnN0NA07r+LYDLyDHJ6RBWAKCQmztwYCquluV+bvlFZZ2AuSjtHC9+oLoDOl2sUPYt/hWp7bjRFnLc5Btu4ev/LZqCxTHrWzRUE=; 20:263Rr4uV3ApF2InbwvhQVVz8o853n6UALGihaL3tyLCZ78TxgR+GmrhdcrJ7MyjJ5n6n1jSnwL2eO/kJa9gQqSr7i0w1k/HLundPqeisxdRbr8mXLpEiBlvSog2gY8/6tEdS3RBP/EauauyInE/g1G9cBFCuLzBFyyEBBxFeix2bt6/rH5SE8mpwAVKreZSReDRWmBYCYpBLOlmHp2WWE5ufZbb2XUYd1C8ISqAYDJ7eDqPSiaEuXccxqBPQ7h8wVt9g3SYs92dgpdwzcGvwNo5ZBiRpJIs5sKFx/rJZkS1OAfgrcTsm7TNl7vsZ9VJZgIXjOnSuy4/daV/fh08nk4SUy400Jwyem0B1FamJz0YMq7MqCIfEWdgAfbU1XGV9HDUw1SL1Ws6NZ8ifNu8KxBda9C36Lz7utV19/PESQNiZhXEG840KZtHtEXcc7vmpPwwxInriJMCVAKpTnrEu0FzGZIYFBZMRJHANLGAMVpZzV9+lN1HMG06eeK1+6FCT X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699)(85827821059158); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93003095)(3231382)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:CY1PR12MB0742; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0742; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0742; 4:NZgGyzKKZGfB6g3WRHXKzTTBkBqnFqRYvXnJthr4Uo14pOuXfpfrSdFhOkaDbjvyeyWjxloVkCIioWWzZHIFK4AhSqITKwjha/wT5hlTiW8wPUqEc0SxykIgOeprBXIRJ0/tQ5MbANLciFUIVxv6u5Np5aeEzteJ3V4JdGex5OwpGEPAvV2hXC5QQ1EWa7XEwip9dbzUudJi4TtHf+voL8u0zk9uuDyzgo6SRIaG5f6gt8uMrt7p1K323b9rggQpD8nfJUK5Rz2iyN8KTrAQN/p0h8hWqnafG0i6YE04uEmBhbDrOtzqQU4NqxsM7pKCeh3AOd3PifKKd3zOuww9cXOCUc5T/fALs0EAjqZ1HtuUpiOQu4Uz4QF7W1vl/pvu X-Forefront-PRVS: 0848C1A6AA X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BCY1PR12MB0742=3B23=3ASJsBRO2?= =?utf-8?q?H5iEXgCVLjZbn/9p2bfWeOnmKB6XO62etY39NPsmlkyDn+YyPD1MABmEOb/4DQIvi?= =?utf-8?q?aVDd2ncSFkJJvYE8x1sG9/GekJVkGqkmv0XeLGWIkcqnjx6uLuG/YCMOYrqpMUSOd?= =?utf-8?q?kvffMHCGFII97vp5+nl3GElLAEFZY24QCp5yCP4LeU3mVFysIm3WD+ng618RzE3i+?= =?utf-8?q?zwRzjL4vvLGNugrsux7HmmZlzuSwzDdBs7MjKo4pvEmIGcMTw+xriZzTnLylW/PPU?= =?utf-8?q?5PSpdxfIELZyWSKmOr5XSAacogs8OCgsKLuqSeBPg7tDYUz1NV8nKaSLIQq7l9Xzc?= =?utf-8?q?dZT8sLWZS5DYjd+UxCbS1HrmzI+9zjGN1NQfkG93aNHjCJWJJ1+qMwmkpM0sAzPq1?= =?utf-8?q?sPKCHSC9ONTpLtCt5izJ8jR2H0abC0RDG+86yzZPX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V9cimJ5RktGgcAc30k5rywaIqQWjXa8WKbBzW3Bc5RLD2/8h3HYjZhoJc+TZEVDDs+uqyyNnZaCZlyBb08srOBnosYHnsSWBQBWjcwvpp4F8+A== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0742; 20:ZwEWuJUjIU6iYwQeBgWuzKOajstHKfFQXLHkwuvPMs9YbXXFnccyPn7Nm74W9bG5dr8WZW/8F0UXI5O70BOcoG92jAI/a3ZR9s0G7f5Nu+Wc/HYZYWqRW0dZW4YsDC0IO33swu8o8OCipYUqPEgSTomfViTpcNMjNhgYEXDUv7A4AeF8EQEp5tOr7gklfJXwmrEWhVLcrJZBRyXiQI3euK/KSLoMvFZpHKJEa8abVSnY79Di+XFBI6f+2n5HF6ne X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2018 20:24:42.9174 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf967a41-3254-453f-37d2-08d64425e30a 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=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0742 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: michel@daenzer.net, Manasi Navare , Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP These include the drm_connector 'vrr_capable' and the drm_crtc 'vrr_enabled' properties. Signed-off-by: Nicholas Kazlauskas Cc: Harry Wentland Cc: Manasi Navare Cc: Pekka Paalanen Cc: Ville Syrjälä Cc: Michel Dänzer Acked-by: Pekka Paalanen --- Documentation/gpu/drm-kms.rst | 7 ++++ drivers/gpu/drm/drm_connector.c | 61 +++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst index 4b1501b4835b..8da2a178cf85 100644 --- a/Documentation/gpu/drm-kms.rst +++ b/Documentation/gpu/drm-kms.rst @@ -575,6 +575,13 @@ Explicit Fencing Properties .. kernel-doc:: drivers/gpu/drm/drm_atomic_uapi.c :doc: explicit fencing properties + +Variable Refresh Properties +--------------------------- + +.. kernel-doc:: drivers/gpu/drm/drm_connector.c + :doc: Variable refresh properties + Existing KMS Properties ----------------------- diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 49290060ab7b..a6adf5450db3 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1255,6 +1255,67 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev) } EXPORT_SYMBOL(drm_mode_create_scaling_mode_property); +/** + * DOC: Variable refresh properties + * + * Variable refresh rate capable displays can dynamically adjust their + * refresh rate by extending the duration of their vertical porch until + * page flip or timeout occurs. This can reduce or remove stuttering + * and latency in scenarios where the page flip does not align with the + * vblank interval. + * + * An example scenario would be an application flipping at a constant rate + * of 48Hz on a 60Hz display. The page flip will frequently miss the vblank + * interval and the same contents will be displayed twice. This can be + * observed as stuttering for content with motion. + * + * If variable refresh rate was active on a display that supported a + * variable refresh range from 35Hz to 60Hz no stuttering would be observable + * for the example scenario. The minimum supported variable refresh rate of + * 35Hz is below the page flip frequency and the vertical front porch can + * be extended until the page flip occurs. The vblank interval will be + * directly aligned to the page flip rate. + * + * Userspace control for variable refresh rate is supported via properties + * on the &drm_connector and &drm_crtc objects. + * + * "vrr_capable": + * Optional &drm_connector boolean property that drivers should attach + * with drm_connector_attach_vrr_capable_property() on connectors that + * could support variable refresh rates. Drivers should update the + * property value by calling drm_connector_set_vrr_capable_property(). + * + * Absence of the property should indicate absence of support. + * + * "vrr_enabled": + * Default &drm_crtc boolean property that notifies the driver that the + * content on the CRTC is suitable for variable refresh rate presentation. + * The driver will take this property as a hint to enable variable + * refresh rate support if the receiver supports it, ie. if the + * "vrr_capable" property is true on the &drm_connector object. The + * veritcal front porch duration will be extended until page-flip or + * timeout when enabled. + * + * The minimum vertical front porch duration is defined as the vertical + * front porch duration for the current mode. + * + * The maximum vertical front porch duration is greater than or equal to + * the minimum vertical front porch duration. The duration is derived + * from the minimum supported variable refresh rate for the connector. + * + * The driver may place further restrictions within these minimum + * and maximum bounds. + * + * Some displays may exhibit noticeable differences in brightness when + * varying vertical front porch duration. + * + * The semantics for the vertical blank timestamp differ when + * variable refresh rate is active. The vertical blank timestamp + * is defined to be an estimate using the current mode's fixed + * refresh rate timings. The semantics for the page-flip event + * timestamp remain the same. + */ + /** * drm_connector_attach_vrr_capable_property - creates the * vrr_capable property From patchwork Tue Nov 6 20:24:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 10671367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E00BC13AD for ; Tue, 6 Nov 2018 20:25:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC78928E5D for ; Tue, 6 Nov 2018 20:25:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF3C929483; Tue, 6 Nov 2018 20:25:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 624692AA6E for ; Tue, 6 Nov 2018 20:25:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 957096E425; Tue, 6 Nov 2018 20:24:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0078.outbound.protection.outlook.com [104.47.40.78]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4E2496E41C; Tue, 6 Nov 2018 20:24:46 +0000 (UTC) Received: from CY4PR1201CA0007.namprd12.prod.outlook.com (2603:10b6:910:16::17) by BLUPR12MB0419.namprd12.prod.outlook.com (2a01:111:e400:516c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Tue, 6 Nov 2018 20:24:44 +0000 Received: from DM3NAM03FT037.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::208) by CY4PR1201CA0007.outlook.office365.com (2603:10b6:910:16::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.21 via Frontend Transport; Tue, 6 Nov 2018 20:24:44 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT037.mail.protection.outlook.com (10.152.83.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.14 via Frontend Transport; Tue, 6 Nov 2018 20:24:43 +0000 Received: from kazbox.amd.com (10.180.168.240) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Tue, 6 Nov 2018 14:24:41 -0600 From: Nicholas Kazlauskas To: , Subject: [PATCH v6 4/5] drm/amdgpu: Correct get_crtc_scanoutpos behavior when vpos >= vtotal Date: Tue, 6 Nov 2018 15:24:34 -0500 Message-ID: <20181106202435.23556-5-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106202435.23556-1-nicholas.kazlauskas@amd.com> References: <20181106202435.23556-1-nicholas.kazlauskas@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(136003)(39860400002)(346002)(376002)(396003)(2980300002)(428003)(189003)(199004)(11346002)(2616005)(81156014)(7696005)(53416004)(316002)(97736004)(81166006)(53936002)(23676004)(426003)(1076002)(68736007)(4326008)(14444005)(110136005)(50226002)(72206003)(26005)(77096007)(76176011)(486006)(36756003)(5820100001)(476003)(54906003)(2870700001)(106466001)(186003)(8936002)(478600001)(446003)(126002)(6666004)(104016004)(2906002)(66574009)(47776003)(44832011)(356004)(336012)(305945005)(8676002)(50466002)(105586002)(86362001)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0419; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT037; 1:+HXN2M33DqzlDzuCcHtYy7m5oJBLGwcfreTYtE6mx7Zd9hmQbnXmwE0uVIOz5pWw3ILVZOHB+71Tlqfh6xwFhsWaBBU6ZkQkyD/fjlbupLnEhS0yyp/VMCa5mNW7TNRb X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 054aa3ba-8564-4ef2-d0bb-08d64425e364 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:BLUPR12MB0419; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 3:tFA3HxLvnvn6kyaxn1g+7FMjRjrb8yJOqGUJ+pWDlDtlBmJFqdf/hX7y4y8DbCALHGzutG04giw+TFvezwR5p3jDUzUra3yn0XFUwznR5I81ZNf7FDvFGgmvKva+LFoELVhjFfslA/tvPwO6L9pnhG7L9ozEMEx7omJUUFbOq4sUIbArRsJ8bXhb3Ok1mzHWBuYHSqhNrLdpKUmHQrYBLMayv4QOmSvXVQbOUU4+ab4IsVJktjYcyIditsqP4LgeFGyhlNY+p2ACnCG7oqIA9/EzvOJA1C/4xMzhjYHa/q9Xzk+dM0XHXFDkOv68B6vIXfe76oP7yTyQ/xtPA3tTcO5t9MsC0AxlMeSX0Van4XM=; 25:+27rMpSBtVhF+2J0XyOb1uTc0YBBAFO9OcI8XDkVO0Mgbxb7Jka3ursNv42tyTAVg4uTzNqDCsguuuvm9gljY9MybDMaWumszP1UE6F2a8HPcVeQu9T9EZP8EjARw0rVrSb9M2s4Ig13ER2DFj3le8Qz6XvWNVe+SKyP5UHhc8goSS6uzgkIHKtXU1b65GpbAsZIKftJgx/52v2e7Nxwj8kGaC4N/VugnnquFn0WtKrLd3SlBS+6uWCu/iMkRc+oTIopEcwlUiaewXdEjsEncCzwc0BeHTssksjcjQHIOPYDoQU6nmFbBnnqLo8lz1gvYaFmxGhxAteMZMr4OP6FLA== X-MS-TrafficTypeDiagnostic: BLUPR12MB0419: X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 31:K63oUjKuxl9XkDwLMO0twdqPlgIrE9UkWLdfcwRSowR1PvsEdeqc8lZegNoQ3yMB46e/VhAIGrDshW5OG02zBy/ZsNw6fVynHi+YSy9mdm4oZaJk2MMpbU6gOrbDrLUga4vVk9Be6/nUwy7eWzhmYpxqyQ0lDWDXnJehlduXjKRqCltJv0SoPMfLcBaZoVpob1ZVIAJ0cyIvJiJyZJtkKAQbP1AiRC/YhjRZTYiKRLs=; 20:zmNdsjcMMIuIVejZCpJvcuBV6ohHBIEU2j5VnpWLwNKf1k/VF/10MWoFDAmTnznlPLyAd/tTUWjBnFjbXn+hlpqsgH8VMIdtlndg/5MhbiPm9jpBGQbOWBc9K7xYpJj8KUuva9VsEBKLDNa+y2eAjBFJDNeybypj8UIRI8J0qaPpM5Blh4cBriSV/foSfcbGEhCcJMk/wngcyfqapN2WmxIws+AA6RM/4r1CwCy/0cBGNMtR1rw/N6W6/aYVF6ffd4XPEjwXeKghB0f1IilxHg7cNts6IUBFgm8Tz73BCZhOCxuglVWT6w55+AYhl+SrHtKE2wNaa3mscdsuJwd9T7cnddGo/u2HMvmbIH90L1svK8irg30iLdJ2Eu/uYzb1wnJMJUMvHjThUx90vAVveGC0cCOQ7IsXLzUcTcDT+XHvqFmCIX6V0RR9teDtZwG5DZsMpmWUSDy5Zgml0E5zN4hc6Ak8gMTvOMBEzZ/VCvr/71x21/zDbnHRkeR7AWJH X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(17755550239193); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231382)(944501410)(52105095)(3002001)(10201501046)(93006095)(93003095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:BLUPR12MB0419; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0419; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 4:vVTe5CzJo1+rLoVCvQcfn4Ksz45ugiGfSfYQFWnI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APSupdPLtB+cRqHGkTKCoWDCKT9pqpMk05a8CYfn/6CD3C7BhIQRlMTyok01vV/CQxL+7dTNVD8AAWIGA6B/Glam3CHmxbFmvZ07eaBGv/H9AlfD2Oc82wiE= X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 6:qvsQd3MA53M2lwzMXTj+2IYqCOsnOiP7jwC4XkwPmxdJIi4ddSOHkz8vRCqivraVVTtwjOTe8FnwMXNNz6rVIXigJrYnVYtoYjFWYKy7RgWrhkxx+2vHXNYSD2zEJvLOQcGvkb90x1l/r+/qWRuuFppiRO+DXfUfU+FSqsdv28HVWOfJVVYs586F7kSRAwqnXzFGWQATbAqFw75YJouZ4OcWQHZsZ5APfsAerm056eLWA03AtVllYkpC6Frq2YJzlCt/1fHsWCZ67MmIKLGvtXTWxRzeuBq1/CVFOkMqhAvH93NXlMdk/azvWQsZrbCeM65z1oSucshLAk6kqs0+9AdikC/tB2BoB9tttU7NuyUchAbNj/b2qLVN41nDc7WPoo3qEQxsVnXE4V8DmmSkI2NLibEzIRRQ2TePBfm7oYsWm2N57OGnBKWmc/BU5Oz6CZ3XiLAFVzS19DxJ1YdetQ==; 5:0Vdmb4UFv1KrQ9MenQ0BrO13kFxNMphfzT7iHgroNWknoRv4XDjIhkxCRuduUAVqYe099xc3yA/MJVFDlLAIs4Cj4kJbQzPM9S5xSxGpJmdLsluOjpufDadM9Lgjtzqb5Ak2ryEl/9/hH74z8Z6oPPwieTyifttIjJrE9fPKbOU=; 7:Pp+aEtVkJ8oPQE8nOuwB1Drdu7Um3y3vXguifHfcEnu5kQfAHiIsfsSYplbflXfq1JSw4f35Mwe0VFund9qlAgo+TNA3TWHTa0ot3A4Puztj3t4TVfOZStaGWCkDHjeH8ZShTn7csWZvsBECZiBEUg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 20:Ie7+doP6PnhaatMlwvA/AeJYRPTFHWlHi8bTh+wmkSjRWqgZqqMyoPgQMtGhtm8g5Ox0kY/VhU/mLzlyzszPEZI+HbXqOADbGpufyX/3Exde3A9Wkf1w4f4vU1Xn3M7xRk/mWDGFMFnu6Mm1/p+1qR5NmXqPjkO9oGsCtxam+2eUV3AyimeWd8KAJY+1+AaJDtTpP9do2pUvzai+/hJbwqXMo9eMeQfqx++Ya/+qsi9jTmFkvJlHtk+j2lG4vNE2 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2018 20:24:43.7142 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 054aa3ba-8564-4ef2-d0bb-08d64425e364 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=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0419 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: michel@daenzer.net, Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP When variable refresh rate is active the hardware counter can return a position >= vtotal. This results in a vpos being returned from amdgpu_display_get_crtc_scanoutpos that's a positive value. The positive value indicates to the caller that the display is currently in scanout when the display is actually still in vblank. This is because the vfront porch duration is unknown with variable refresh active and will end when either a page flip occurs or the timeout specified by the driver/display is reached. The behavior of the amdgpu_display_get_crtc_scanoutpos remains the same when the position is below vtotal. When the position is above vtotal the function will return a value that is effectively -vbl_end, the size of the vback porch. The only caller affected by this change is the DRM helper for calculating vblank timestamps. This change corrects behavior for calculating the page flip timestap from being the previous timestamp to the calculation to the next timestamp when position >= vtotal. Signed-off-by: Nicholas Kazlauskas Cc: Michel Dänzer Cc: Harry Wentland Reviewed-by: Harry Wentland --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index 6748cd7fc129..cb331319f225 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -850,7 +850,12 @@ int amdgpu_display_get_crtc_scanoutpos(struct drm_device *dev, /* Inside "upper part" of vblank area? Apply corrective offset if so: */ if (in_vbl && (*vpos >= vbl_start)) { vtotal = mode->crtc_vtotal; - *vpos = *vpos - vtotal; + + /* With variable refresh rate displays the vpos can exceed + * the vtotal value. Clamp to 0 to return -vbl_end instead + * of guessing the remaining number of lines until scanout. + */ + *vpos = (*vpos < vtotal) ? (*vpos - vtotal) : 0; } /* Correct for shifted end of vbl at vbl_end. */ From patchwork Tue Nov 6 20:24:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 10671365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 381C4109C for ; Tue, 6 Nov 2018 20:25:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27DE528E5D for ; Tue, 6 Nov 2018 20:25:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B8C02AA62; Tue, 6 Nov 2018 20:25:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 17DB628E5D for ; Tue, 6 Nov 2018 20:24:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FF646E424; Tue, 6 Nov 2018 20:24:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0089.outbound.protection.outlook.com [104.47.40.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 065A46E423; Tue, 6 Nov 2018 20:24:48 +0000 (UTC) Received: from CY4PR1201CA0007.namprd12.prod.outlook.com (2603:10b6:910:16::17) by BLUPR12MB0419.namprd12.prod.outlook.com (2a01:111:e400:516c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Tue, 6 Nov 2018 20:24:46 +0000 Received: from DM3NAM03FT037.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::208) by CY4PR1201CA0007.outlook.office365.com (2603:10b6:910:16::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.21 via Frontend Transport; Tue, 6 Nov 2018 20:24:46 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT037.mail.protection.outlook.com (10.152.83.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.14 via Frontend Transport; Tue, 6 Nov 2018 20:24:45 +0000 Received: from kazbox.amd.com (10.180.168.240) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Tue, 6 Nov 2018 14:24:41 -0600 From: Nicholas Kazlauskas To: , Subject: [PATCH v6 5/5] drm/amdgpu: Set FreeSync state using drm VRR properties Date: Tue, 6 Nov 2018 15:24:35 -0500 Message-ID: <20181106202435.23556-6-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106202435.23556-1-nicholas.kazlauskas@amd.com> References: <20181106202435.23556-1-nicholas.kazlauskas@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(136003)(39860400002)(346002)(376002)(396003)(2980300002)(428003)(189003)(199004)(11346002)(2616005)(81156014)(7696005)(53416004)(316002)(97736004)(81166006)(51416003)(53936002)(426003)(1076002)(68736007)(4326008)(14444005)(110136005)(50226002)(72206003)(26005)(77096007)(76176011)(486006)(36756003)(476003)(54906003)(16586007)(106466001)(186003)(5024004)(8936002)(478600001)(446003)(126002)(6666004)(104016004)(2906002)(47776003)(44832011)(48376002)(356004)(336012)(4744004)(305945005)(8676002)(50466002)(575784001)(105586002)(86362001)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0419; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT037; 1:pqA2eheBN9OdCMMU/Q5POc3tccZPEp/A0AIq6hkndVNXdoV/g96Wg8XYUsbnEF2BspYwoqWlaQ2UE4rxc9RkmMugxIkzZYUQSjMeDaOsX7RQpFbzhcpBGQ3C0biYorzw X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f7ca953f-4de3-40e6-2350-08d64425e49d X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:BLUPR12MB0419; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 3:rRbAvZe3fnMk4LRqElQ41fyXVALR7RDbI3lkTdQJSfrVOQOf0tOOXh0aCMRf9nbnYVvg6EQszs1VGi1n6ULhlIJW1rX6+ZkL+WMwSVyERKbWwU3iTtT33JcbTDHsaB3fQfgSnnFLJYwiDfZfm0nThbGSJ7W3x4N90kV6qSFCrApCYTTgZZfpXz1gTh/fosj3yt0tCN4vs3lxPk3hP1s+Tw8Xh+JEC0qCY3maDUfzqoS4jhbO6Iw5FkCpoR2HljmQWY3Rs1EOfzk85goZgGtnIczbslUZn58vaSwJPOkkaWFg9pKk75oBgdW5zpQHTf+WYqmgywcqVtkyJbCqIvPfGCqz+3BbY7IJGwhIrDrrc0k=; 25:pgkl/tEs4qU7dj1eGO4gE+HmN70RKPZkndlRgDSib2gj9Kfni0oRc2UO1/uE0BqN0MUusrEG5RL7JWCOg5EV+Wdt2CU1vj6tMUZUFvNYY1PCQKwNXCZWwEJJbpvosbREbmOo3HOP8mC6LmefA4N1ocjJKEOrzwajjv173tc9xB5WnXc637/e4xuHLaCFLf6LvmeSaulKV6KkixXxuNg3TOZjVYDmCwLlhx6rKBNAjm0rj/aJFLmTGXUIHsyOXP4JwhHLxd2XqtVQ3rYdMQOzVIJLY4eohGnL9fJIe1Dm+p/JIcIFCag6KDYhzpDRPSqKxup62QvterdIWcRlR5pGpg== X-MS-TrafficTypeDiagnostic: BLUPR12MB0419: X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 31:o6UHEfszcrKtejtuwz9c86waYURVR8uq/F91ouuQk5y1L4pEY65Y/ynenOv9HxtukGGq2nqQWoeUcpSqOV8hBA0KHUNTixON2ppGnuAuIEyiISUN/Ai/rm4b9SSynfcKEIvMRwdiXH1L5zKxaErzhbkfYUSO63DVaBvJmszkEvfsHOHqzZzC5pMbzVh5xuNKNws3hjahDtKvcoI4fHRQx6hvSKIumXRezFGxW7qJ7Bk=; 20:ZOqOVyj2g8iI5M0cEmxNm2y3lP83pxT9BlmNDNfFWiUdwG5fYqy6F5hCjc1vgAOZQVb8HUA/hwJrxFLHW/eFJAwnTf8hGhZ9AcJ6zs2tKVegBq7SoSOF3jGQ8s7+L2jSzxVVcsIMLoYi8UWRBUJaofGGlZBvSSx3+/BCLPZ6zAXPNhdNYLhhe5e/OioIe1UpcHfBMT2tO4Ec1figtVljuUVBBV1Ikyv0xtEcrDAWCeYPA/PE8sBOS37bfPln/mw3LcVSaO7IgD2mAJy9gev0YLqfC7h/+eJ0T8tM9rbmo8ZqboicVcZ73FA+qs+x4io7Q8ozwTMB6VFZcfOcoizWy0V5OawKYLufkF2IPAvPvdykY9pKwIRS0tdHbDmc6QYVh4bIMiFVFbYmioTVf9Mg4jQ2wrVe42IzxtJEvA7q4EqCSwvCkQPwRntDcQsqI9/tsMNDBw9TmnK4msGQAvYM0Z/4efzRGtVlTyaF4kfTJ8Fl6jn9y7PqL2gPhdHkdzHd X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231382)(944501410)(52105095)(3002001)(10201501046)(93006095)(93003095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:BLUPR12MB0419; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0419; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 4:vz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9XXai2MFoT X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2018 20:24:45.7454 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7ca953f-4de3-40e6-2350-08d64425e49d 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=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0419 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: michel@daenzer.net, Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Support for AMDGPU specific FreeSync properties and ioctls are dropped from amdgpu_dm in favor of supporting drm variable refresh rate properties. The notify_freesync and set_freesync_property functions are dropped from amdgpu_display_funcs. The drm vrr_capable property is now attached to any DP/HDMI connector. Its value is updated accordingly to the connector's FreeSync capabiltiy. The freesync_enable logic and ioctl control has has been dropped in favor of utilizing the vrr_enabled on the drm CRTC. This allows for more fine grained atomic control over which CRTCs should support variable refresh rate. To handle state changes for vrr_enabled it was easiest to drop the forced modeset on freesync_enabled change. This patch now performs the required stream updates when planes are flipped. This is done for a few reasons: (1) VRR stream updates can be done in the fast update path (2) amdgpu_dm_atomic_check would need to be hacked apart to check desired variable refresh state and capability before the CRTC disable pass. (3) Performing VRR stream updates on-flip is needed for enabling BTR support. VRR packets and timing adjustments are now tracked and compared to previous values sent to the hardware. Signed-off-by: Nicholas Kazlauskas Reviewed-by: Harry Wentland --- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 7 - .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 255 +++++++++--------- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 7 +- 3 files changed, 138 insertions(+), 131 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h index b9e9e8b02fb7..0cbe867ec375 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h @@ -295,13 +295,6 @@ struct amdgpu_display_funcs { uint16_t connector_object_id, struct amdgpu_hpd *hpd, struct amdgpu_router *router); - /* it is used to enter or exit into free sync mode */ - int (*notify_freesync)(struct drm_device *dev, void *data, - struct drm_file *filp); - /* it is used to allow enablement of freesync mode */ - int (*set_freesync_property)(struct drm_connector *connector, - struct drm_property *property, - uint64_t val); }; 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 b0df6dc9a775..53eb3d16f75c 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1809,72 +1809,6 @@ static void dm_bandwidth_update(struct amdgpu_device *adev) /* TODO: implement later */ } -static int amdgpu_notify_freesync(struct drm_device *dev, void *data, - struct drm_file *filp) -{ - struct drm_atomic_state *state; - struct drm_modeset_acquire_ctx ctx; - struct drm_crtc *crtc; - struct drm_connector *connector; - struct drm_connector_state *old_con_state, *new_con_state; - int ret = 0; - uint8_t i; - bool enable = false; - - drm_modeset_acquire_init(&ctx, 0); - - state = drm_atomic_state_alloc(dev); - if (!state) { - ret = -ENOMEM; - goto out; - } - state->acquire_ctx = &ctx; - -retry: - drm_for_each_crtc(crtc, dev) { - ret = drm_atomic_add_affected_connectors(state, crtc); - if (ret) - goto fail; - - /* TODO rework amdgpu_dm_commit_planes so we don't need this */ - ret = drm_atomic_add_affected_planes(state, crtc); - if (ret) - goto fail; - } - - for_each_oldnew_connector_in_state(state, connector, old_con_state, new_con_state, i) { - struct dm_connector_state *dm_new_con_state = to_dm_connector_state(new_con_state); - struct drm_crtc_state *new_crtc_state; - struct amdgpu_crtc *acrtc = to_amdgpu_crtc(dm_new_con_state->base.crtc); - struct dm_crtc_state *dm_new_crtc_state; - - if (!acrtc) { - ASSERT(0); - continue; - } - - new_crtc_state = drm_atomic_get_new_crtc_state(state, &acrtc->base); - dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); - - dm_new_crtc_state->freesync_enabled = enable; - } - - ret = drm_atomic_commit(state); - -fail: - if (ret == -EDEADLK) { - drm_atomic_state_clear(state); - drm_modeset_backoff(&ctx); - goto retry; - } - - drm_atomic_state_put(state); - -out: - drm_modeset_drop_locks(&ctx); - drm_modeset_acquire_fini(&ctx); - return ret; -} static const struct amdgpu_display_funcs dm_display_funcs = { .bandwidth_update = dm_bandwidth_update, /* called unconditionally */ @@ -1888,7 +1822,6 @@ static const struct amdgpu_display_funcs dm_display_funcs = { dm_crtc_get_scanoutpos,/* called unconditionally */ .add_encoder = NULL, /* VBIOS parsing. DAL does it. */ .add_connector = NULL, /* VBIOS parsing. DAL does it. */ - .notify_freesync = amdgpu_notify_freesync, }; @@ -2841,7 +2774,8 @@ dm_crtc_duplicate_state(struct drm_crtc *crtc) state->adjust = cur->adjust; state->vrr_infopacket = cur->vrr_infopacket; - state->freesync_enabled = cur->freesync_enabled; + state->vrr_supported = cur->vrr_supported; + state->freesync_config = cur->freesync_config; /* TODO Duplicate dc_stream after objects are stream object is flattened */ @@ -3060,8 +2994,6 @@ amdgpu_dm_connector_atomic_duplicate_state(struct drm_connector *connector) __drm_atomic_helper_connector_duplicate_state(connector, &new_state->base); new_state->freesync_capable = state->freesync_capable; - new_state->freesync_enable = state->freesync_enable; - return &new_state->base; } @@ -3807,6 +3739,11 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, adev->mode_info.underscan_vborder_property, 0); + if (connector_type == DRM_MODE_CONNECTOR_HDMIA || + connector_type == DRM_MODE_CONNECTOR_DisplayPort) { + drm_connector_attach_vrr_capable_property( + &aconnector->base); + } } static int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap, @@ -4183,6 +4120,77 @@ static void prepare_flip_isr(struct amdgpu_crtc *acrtc) acrtc->crtc_id); } +static void update_freesync_state_on_stream( + struct amdgpu_display_manager *dm, + struct dm_crtc_state *new_crtc_state, + struct dc_stream_state *new_stream) +{ + struct mod_vrr_params vrr = {0}; + struct dc_info_packet vrr_infopacket = {0}; + struct mod_freesync_config config = new_crtc_state->freesync_config; + + if (!new_stream) + return; + + /* + * TODO: Determine why min/max totals and vrefresh can be 0 here. + * For now it's sufficient to just guard against these conditions. + */ + + if (!new_stream->timing.h_total || !new_stream->timing.v_total) + return; + + if (new_crtc_state->vrr_supported && + config.min_refresh_in_uhz && + config.max_refresh_in_uhz) { + config.state = new_crtc_state->base.vrr_enabled ? + VRR_STATE_ACTIVE_VARIABLE : + VRR_STATE_INACTIVE; + } else { + config.state = VRR_STATE_UNSUPPORTED; + } + + mod_freesync_build_vrr_params(dm->freesync_module, + new_stream, + &config, &vrr); + + mod_freesync_build_vrr_infopacket( + dm->freesync_module, + new_stream, + &vrr, + packet_type_vrr, + transfer_func_unknown, + &vrr_infopacket); + + new_crtc_state->freesync_timing_changed = + (memcmp(&new_crtc_state->adjust, + &vrr.adjust, + sizeof(vrr.adjust)) != 0); + + new_crtc_state->freesync_vrr_info_changed = + (memcmp(&new_crtc_state->vrr_infopacket, + &vrr_infopacket, + sizeof(vrr_infopacket)) != 0); + + new_crtc_state->adjust = vrr.adjust; + new_crtc_state->vrr_infopacket = vrr_infopacket; + + new_stream->adjust = new_crtc_state->adjust; + new_stream->vrr_infopacket = vrr_infopacket; + + if (new_crtc_state->freesync_vrr_info_changed) + DRM_DEBUG_KMS("VRR packet update: crtc=%u enabled=%d state=%d", + new_crtc_state->base.crtc->base.id, + (int)new_crtc_state->base.vrr_enabled, + (int)vrr.state); + + if (new_crtc_state->freesync_timing_changed) + DRM_DEBUG_KMS("VRR timing update: crtc=%u min=%u max=%u\n", + new_crtc_state->base.crtc->base.id, + vrr.adjust.v_total_min, + vrr.adjust.v_total_max); +} + /* * Executes flip * @@ -4204,6 +4212,7 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc, struct dc_flip_addrs addr = { {0} }; /* TODO eliminate or rename surface_update */ struct dc_surface_update surface_updates[1] = { {0} }; + struct dc_stream_update stream_update = {0}; struct dm_crtc_state *acrtc_state = to_dm_crtc_state(crtc->state); struct dc_stream_status *stream_status; @@ -4276,11 +4285,26 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc, } surface_updates->flip_addr = &addr; + if (acrtc_state->stream) { + update_freesync_state_on_stream( + &adev->dm, + acrtc_state, + acrtc_state->stream); + + if (acrtc_state->freesync_timing_changed) + stream_update.adjust = + &acrtc_state->stream->adjust; + + if (acrtc_state->freesync_vrr_info_changed) + stream_update.vrr_infopacket = + &acrtc_state->stream->vrr_infopacket; + } + dc_commit_updates_for_stream(adev->dm.dc, surface_updates, 1, acrtc_state->stream, - NULL, + &stream_update, &surface_updates->surface, state); @@ -4340,11 +4364,6 @@ static bool commit_planes_to_stream( stream_update->dst = dc_stream->dst; stream_update->out_transfer_func = dc_stream->out_transfer_func; - if (dm_new_crtc_state->freesync_enabled != dm_old_crtc_state->freesync_enabled) { - stream_update->vrr_infopacket = &dc_stream->vrr_infopacket; - stream_update->adjust = &dc_stream->adjust; - } - for (i = 0; i < new_plane_count; i++) { updates[i].surface = plane_states[i]; updates[i].gamma = @@ -4480,9 +4499,6 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, spin_unlock_irqrestore(&pcrtc->dev->event_lock, flags); } - dc_stream_attach->adjust = acrtc_state->adjust; - dc_stream_attach->vrr_infopacket = acrtc_state->vrr_infopacket; - if (false == commit_planes_to_stream(dm->dc, plane_states_constructed, planes_count, @@ -4686,9 +4702,6 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) WARN_ON(!status); WARN_ON(!status->plane_count); - dm_new_crtc_state->stream->adjust = dm_new_crtc_state->adjust; - dm_new_crtc_state->stream->vrr_infopacket = dm_new_crtc_state->vrr_infopacket; - /*TODO How it works with MPO ?*/ if (!commit_planes_to_stream( dm->dc, @@ -4912,20 +4925,18 @@ static int do_aquire_global_lock(struct drm_device *dev, return ret < 0 ? ret : 0; } -void set_freesync_on_stream(struct amdgpu_display_manager *dm, - struct dm_crtc_state *new_crtc_state, - struct dm_connector_state *new_con_state, - struct dc_stream_state *new_stream) +static void get_freesync_config_for_crtc( + struct dm_crtc_state *new_crtc_state, + struct dm_connector_state *new_con_state) { struct mod_freesync_config config = {0}; - struct mod_vrr_params vrr = {0}; - struct dc_info_packet vrr_infopacket = {0}; struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(new_con_state->base.connector); - if (new_con_state->freesync_capable && - new_con_state->freesync_enable) { - config.state = new_crtc_state->freesync_enabled ? + new_crtc_state->vrr_supported = new_con_state->freesync_capable; + + if (new_con_state->freesync_capable) { + config.state = new_crtc_state->base.vrr_enabled ? VRR_STATE_ACTIVE_VARIABLE : VRR_STATE_INACTIVE; config.min_refresh_in_uhz = @@ -4935,19 +4946,18 @@ void set_freesync_on_stream(struct amdgpu_display_manager *dm, config.vsif_supported = true; } - mod_freesync_build_vrr_params(dm->freesync_module, - new_stream, - &config, &vrr); + new_crtc_state->freesync_config = config; +} - mod_freesync_build_vrr_infopacket(dm->freesync_module, - new_stream, - &vrr, - packet_type_fs1, - NULL, - &vrr_infopacket); +static void reset_freesync_config_for_crtc( + struct dm_crtc_state *new_crtc_state) +{ + new_crtc_state->vrr_supported = false; - new_crtc_state->adjust = vrr.adjust; - new_crtc_state->vrr_infopacket = vrr_infopacket; + memset(&new_crtc_state->adjust, 0, + sizeof(new_crtc_state->adjust)); + memset(&new_crtc_state->vrr_infopacket, 0, + sizeof(new_crtc_state->vrr_infopacket)); } static int dm_update_crtcs_state(struct amdgpu_display_manager *dm, @@ -5022,9 +5032,6 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm, break; } - set_freesync_on_stream(dm, dm_new_crtc_state, - dm_new_conn_state, new_stream); - if (dc_is_stream_unchanged(new_stream, dm_old_crtc_state->stream) && dc_is_stream_scaling_unchanged(new_stream, dm_old_crtc_state->stream)) { new_crtc_state->mode_changed = false; @@ -5033,9 +5040,6 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm, } } - if (dm_old_crtc_state->freesync_enabled != dm_new_crtc_state->freesync_enabled) - new_crtc_state->mode_changed = true; - if (!drm_atomic_crtc_needs_modeset(new_crtc_state)) goto next_crtc; @@ -5072,6 +5076,8 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm, dc_stream_release(dm_old_crtc_state->stream); dm_new_crtc_state->stream = NULL; + reset_freesync_config_for_crtc(dm_new_crtc_state); + *lock_and_validation_needed = true; } else {/* Add stream for any updated/enabled CRTC */ @@ -5149,7 +5155,9 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm, amdgpu_dm_set_ctm(dm_new_crtc_state); } - + /* Update Freesync settings. */ + get_freesync_config_for_crtc(dm_new_crtc_state, + dm_new_conn_state); } return ret; @@ -5414,12 +5422,9 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, goto fail; for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { - struct dm_crtc_state *dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); - struct dm_crtc_state *dm_old_crtc_state = to_dm_crtc_state(old_crtc_state); - if (!drm_atomic_crtc_needs_modeset(new_crtc_state) && !new_crtc_state->color_mgmt_changed && - (dm_old_crtc_state->freesync_enabled == dm_new_crtc_state->freesync_enabled)) + !new_crtc_state->vrr_enabled) continue; if (!new_crtc_state->enable) @@ -5571,14 +5576,15 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, struct detailed_data_monitor_range *range; struct amdgpu_dm_connector *amdgpu_dm_connector = to_amdgpu_dm_connector(connector); - struct dm_connector_state *dm_con_state; + struct dm_connector_state *dm_con_state = NULL; struct drm_device *dev = connector->dev; struct amdgpu_device *adev = dev->dev_private; + bool freesync_capable = false; if (!connector->state) { DRM_ERROR("%s - Connector has no state", __func__); - return; + goto update; } if (!edid) { @@ -5588,9 +5594,7 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, amdgpu_dm_connector->max_vfreq = 0; amdgpu_dm_connector->pixel_clock_mhz = 0; - dm_con_state->freesync_capable = false; - dm_con_state->freesync_enable = false; - return; + goto update; } dm_con_state = to_dm_connector_state(connector->state); @@ -5598,10 +5602,10 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, edid_check_required = false; if (!amdgpu_dm_connector->dc_sink) { DRM_ERROR("dc_sink NULL, could not add free_sync module.\n"); - return; + goto update; } if (!adev->dm.freesync_module) - return; + goto update; /* * if edid non zero restrict freesync only for dp and edp */ @@ -5613,7 +5617,6 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, amdgpu_dm_connector); } } - dm_con_state->freesync_capable = false; if (edid_check_required == true && (edid->version > 1 || (edid->version == 1 && edid->revision > 1))) { for (i = 0; i < 4; i++) { @@ -5645,8 +5648,16 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, if (amdgpu_dm_connector->max_vfreq - amdgpu_dm_connector->min_vfreq > 10) { - dm_con_state->freesync_capable = true; + freesync_capable = true; } } + +update: + if (dm_con_state) + dm_con_state->freesync_capable = freesync_capable; + + if (connector->vrr_capable_property) + drm_connector_set_vrr_capable_property(connector, + freesync_capable); } diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h index 978b34a5011c..a5aaf8b08968 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -185,7 +185,11 @@ struct dm_crtc_state { int crc_skip_count; bool crc_enabled; - bool freesync_enabled; + bool freesync_timing_changed; + bool freesync_vrr_info_changed; + + bool vrr_supported; + struct mod_freesync_config freesync_config; struct dc_crtc_timing_adjust adjust; struct dc_info_packet vrr_infopacket; }; @@ -207,7 +211,6 @@ struct dm_connector_state { uint8_t underscan_vborder; uint8_t underscan_hborder; bool underscan_enable; - bool freesync_enable; bool freesync_capable; };