From patchwork Thu Nov 8 14:43:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 10674415 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 6D41A13BF for ; Thu, 8 Nov 2018 14:44:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D96D2BAD5 for ; Thu, 8 Nov 2018 14:44:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 519422DC81; Thu, 8 Nov 2018 14:44:14 +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 A443C2DC8C for ; Thu, 8 Nov 2018 14:44:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A783A6E65A; Thu, 8 Nov 2018 14:44:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0615.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::615]) by gabe.freedesktop.org (Postfix) with ESMTPS id E318D6E65A; Thu, 8 Nov 2018 14:44:10 +0000 (UTC) Received: from BN6PR1201CA0015.namprd12.prod.outlook.com (2603:10b6:405:4c::25) by BLUPR12MB0417.namprd12.prod.outlook.com (2a01:111:e400:516a::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.29; Thu, 8 Nov 2018 14:44:08 +0000 Received: from BY2NAM03FT054.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::209) by BN6PR1201CA0015.outlook.office365.com (2603:10b6:405:4c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.21 via Frontend Transport; Thu, 8 Nov 2018 14:44:07 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by BY2NAM03FT054.mail.protection.outlook.com (10.152.85.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1339.10 via Frontend Transport; Thu, 8 Nov 2018 14:44:06 +0000 Received: from kazbox.amd.com (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Thu, 8 Nov 2018 08:44:05 -0600 From: Nicholas Kazlauskas To: , Subject: [PATCH v7 2/5] drm: Add vrr_enabled property to drm CRTC Date: Thu, 8 Nov 2018 09:43:50 -0500 Message-ID: <20181108144353.31363-3-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181108144353.31363-1-nicholas.kazlauskas@amd.com> References: <20181108144353.31363-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)(346002)(376002)(39860400002)(396003)(2980300002)(428003)(189003)(199004)(336012)(50466002)(68736007)(2616005)(105586002)(476003)(186003)(44832011)(77096007)(126002)(53936002)(305945005)(53416004)(81166006)(50226002)(446003)(11346002)(8676002)(5660300001)(97736004)(8936002)(486006)(106466001)(426003)(48376002)(81156014)(104016004)(36756003)(26005)(2906002)(478600001)(86362001)(5024004)(14444005)(316002)(575784001)(54906003)(51416003)(47776003)(1076002)(16586007)(110136005)(7696005)(4326008)(76176011)(356004)(6666004)(72206003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0417; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT054; 1:H9bew5Zp6wbC2g235i5BWr1FkoaI8lr9sY7xRZ3f9Dw7eyisHSQsEiUmi6eMKRIJHmpX4/RzVVIVoWGGAe78aoAS4GKvTnbv+a6SgTuCAXj8ErrrDsiWkzs/A3nACkhW X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 111547b2-24c7-46eb-5858-08d64588a2c0 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:BLUPR12MB0417; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0417; 3:e/1eoUbO9C+LFWXRI5ycca53571a6CvN1KmKeH4SZEXk9wGsOCsOnWSGm+9cbrcox5GyZ3yL8DHVRpznMP3i03Y+p2h8iWRXt4neGY1OPw2Z8xEqz+dQl+CQSZDDsgIOzas/UJX/xJfnbJS4meyT7w8E0APk0y/uY/nlm6TVv9xV/q2VKDMU8Yx6HwDscVsMBsPoiHDvPaHymCIPLFv45vdKvSYtah6Ckg3ZWtbS1j5l9F1qy5OFTB3LKnyQl/PbJhjKTHMPmcqEUmd5CkYd0unKylADicHd9QYq3HRb/WicgUdC4Qo4cA7Jp2bltdXEOShQLFKv8YPib8IgZ1heY2eSIeWOKF8BpeKU+S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NzQWCMtBZHcsWiIy9+FctdBey4+NzatTmHWZjuW4QBNkNLaz2q0JwyolCfJDXNi1kQEijSlhpmai8ys44PGCWYh4h4D94 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)(3231382)(944501410)(52105095)(93006095)(93003095)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:BLUPR12MB0417; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0417; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0417; 4:fqFPfSfboXM0paumqygRM1D+VFtNUYYgJ0/v5xkr0eWqTcTqd9qzf4tK7ZWgGodlLpdTYbhnYCplNneZu4zd4O+xR9pMHJAu9NcTJh2s64q+hkUuwso8T4fTYM4Bl3kETqgaJP0dSgtE8Ph5c60HVHmLrNEbWnrEy7pUhofIwtW/frc2MdFOU7QHQKj/PTUpuCBuY+J7B5fDGKjXhwbb3Q7LVVelMEwnjoHklqAp3DTW3Ci6rVzzwgT8C7hPrswxHuAvuE14RsliX6Bz8hUVyTQvkwp4Jx2/2UXLdaFJLfkzRLC9ILNO/FPifOTteFj1QV4BEyBDXb5Q9A0HWq39vcJ2kx8l9gsCmOAgOiJgPoo= X-Forefront-PRVS: 0850800A29 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR12MB0417; 23:hp/TBQtQo2zzTYQfzAFJSq8lYVlS60fLjiNBYo8Xj?= AbrzXiBsn310PrReWMfLNM/tqv9AuLJUumTDGHP3C5lsqbNMQqa6XmHpfuP48xpxjXM8W7spHIHcXCx9uRqmzrId67qMNY2iI2lDi3dMUIg5gKqeUlaYbT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; 7:9Tvcb00HNxkYhlzdax1HdalfHq48qTzRirjts6Sf/KexJB8znZn45PNjlMY59JZGySntAa6Rvt17P7rKUPm4vHspj9xAzMJ/GepOFPqnd8B8mgTBIkwJR3vvFSaZxoI+7CXuSS75THAHEDE8Ap2IaA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0417; 20:WP1kMxYZBVG+cpgTnAn/jP4W6v0w+2iD80gyIXJAUbdQ59cuSSydxOXUqwH7++SXopPix4nxuyY7dqhEwwGnFMZQLUP8yIRfvJPFLsPDo+N3tHldhDnu6NNHMriX1cbqY87BC/khBg4tWM/tOGNXaImiXJQe0I9Q/UWflTrjGcMR7L+cNmv2bwXYf9Nbm0trPk6OfpSbwPkzoIXvA2tu4EM45VPJgqhZaGjUxFjMbtvmXydReuSwrj7wh2oU3/a6 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2018 14:44:06.6012 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 111547b2-24c7-46eb-5858-08d64588a2c0 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0417 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