From patchwork Fri Oct 5 20:39:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 10628713 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 85AE216B1 for ; Fri, 5 Oct 2018 20:40:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BFCD299E9 for ; Fri, 5 Oct 2018 20:40:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A32729A08; Fri, 5 Oct 2018 20:40:12 +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 A1E2D299E9 for ; Fri, 5 Oct 2018 20:40:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C35B16E8D7; Fri, 5 Oct 2018 20:40:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0065.outbound.protection.outlook.com [104.47.36.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 104916E8D7; Fri, 5 Oct 2018 20:40:08 +0000 (UTC) Received: from BN4PR12CA0007.namprd12.prod.outlook.com (2603:10b6:403:2::17) by BN4PR12MB0739.namprd12.prod.outlook.com (2a01:111:e400:59bc::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.25; Fri, 5 Oct 2018 20:40:05 +0000 Received: from DM3NAM03FT003.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::208) by BN4PR12CA0007.outlook.office365.com (2603:10b6:403:2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1207.18 via Frontend Transport; Fri, 5 Oct 2018 20:40:05 +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 DM3NAM03FT003.mail.protection.outlook.com (10.152.82.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.1207.19 via Frontend Transport; Fri, 5 Oct 2018 20:40:05 +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; Fri, 5 Oct 2018 15:40:04 -0500 From: Nicholas Kazlauskas To: , Subject: [PATCH v3 2/4] drm: Add vrr_enabled property to drm CRTC Date: Fri, 5 Oct 2018 16:39:47 -0400 Message-ID: <20181005203949.6289-3-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181005203949.6289-1-nicholas.kazlauskas@amd.com> References: <20181005203949.6289-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)(396003)(346002)(376002)(39860400002)(2980300002)(428003)(199004)(189003)(476003)(486006)(36756003)(305945005)(356003)(50226002)(2906002)(47776003)(44832011)(11346002)(126002)(54906003)(186003)(77096007)(316002)(110136005)(2616005)(446003)(8936002)(53936002)(53416004)(14444005)(26005)(5024004)(16586007)(7696005)(575784001)(97736004)(76176011)(4326008)(72206003)(86362001)(50466002)(336012)(1076002)(426003)(478600001)(68736007)(104016004)(6666003)(106466001)(48376002)(81156014)(51416003)(81166006)(105586002)(5660300001)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN4PR12MB0739; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT003; 1:7jVpRWUyPyMIOwpF8fRt38/Y1O5nZfoPYeHouOQ4ttJzqxTznBAGz1p6em0c0dRtJQV/i9AIbWeJLlnozrdcX9nMGGqEAFP7TP5wYvBHRY0t+y3Bf1TWBAB4CCk+smpZ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c8688568-32cc-4eec-334a-08d62b02bb6d X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:BN4PR12MB0739; X-Microsoft-Exchange-Diagnostics: 1; BN4PR12MB0739; 3:lwoJWsvn9ejvgBqC2YCJUi1Sopi5uOne4GMIJIb3p0KlB7YRggZHoF7xCjixoyEaQxYwZ7X1Gd7Hi/i+iBVSIyA23j4uAWsWFv+T5iyDfw9Pbs2+kk6L9ffqztX2uuAds+KrenZ4TcSNjVIe02BKLZjoGBQ6ZfSjxh6NHDz0WfS4RvKR0CLkToBMg0HVdcSF6zgmkK5n0lTeZyQF0flnerKro2IM4XL6bMuaZZfiW/u+CJVdw4pm7x3bNpOIolj1y3cEkL+telTzaq3HuONPA435vvyHtG6RSyqU76qOibVBkYXUGwYUt/UcAUUZMTn+MFTZNakTml6eJdNx6yUn4FcD/xY70/TFoQjEQ8KNp1I=; 25:s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x+mXmFJJnLWKV+HZIU1oVLeUKfaJzYNEsKeEksrgbL9IrY9wh8S99rIW6oIgTrDGhdnwREqZ3QE3x/FSnOBvaHrU5ErRb392+3L1QoAz 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)(93006095)(93003095)(3231355)(944501410)(52105095)(10201501046)(3002001)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(201708071742011)(7699051); SRVR:BN4PR12MB0739; BCL:0; PCL:0; RULEID:; SRVR:BN4PR12MB0739; X-Microsoft-Exchange-Diagnostics: 1; BN4PR12MB0739; 4:bqWOub9F/wnJRUyjJQmhfLLeiVNY22FbxdR5NSE4tBo2rLzq2xHN1hf+yZjHOoUcnGlh0aTskaPiEtovUOhnzvGkOCf7uyhFPFEt95PNdiMme14jo11dY2DdqVKKM1UnCmBt2J6WMxgyTUPu4M0i4Jstp1L/treK8aAfxEUCMapvFiOXT+QUV9DSUYWwcHDr4g05IEneYRh+DtjqZ9TNRlEjLTavuQSMBm/bmDB1F/2ppk0bq+DDnDw3zuYiAUQwMtDSEWUbc/VcilQ5o/cJidRmabQ+QJyniiIKNMdUenmtYt5avW8psqeajt9IQDg5 X-Forefront-PRVS: 0816F1D86E X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN4PR12MB0739; 23:uXmz75D+N4XIO6kqpYjMKdblRbHeuB8qGPzatMgml?= uAKk0NLyTEVjOwTHuB+CDd+oAdG6DkToMOlWuuDUJFLfvXZ81ViTu7J8Itic+TOQ/FymEb7pgz6alH6UH0pC5w+N6/1ibMhc/5HYCs4/KCq9D9bMX188oSKzjmEnGL+BeuOmVohoa7a34NQC3eyu09ybbVlKHpgpNwUOA8RUWqcoWe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IUo7Qf9V7vLp9lCj8Gh+Yj0isYMJ2RXPO+FKU6b87Xvep5cb1CLgwNr2dptMfU33kOx0tjjnwd/qDhdMHoGx0mozrRdoEIa2LyQr/V0QKLN0wwWTUdd2YLhxy4ZRA0LHD2+ftdT1b4/Nr3XXC2h8+UFHE82NRDBdOmIHvERSttYTg+9kvmmOYK9L5UBKc6aEY3NfM540Km+nC7HmXmX/K/ALE4wM0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN4PR12MB0739; 20:FBexDdTbz2xEevNmXlF8jU6tDtxc+9JvN0wS/RhhgS97Fac/CHQVm8LGVizkDjHbwNPWY+FTe6U73l0tnfpWuKnM4M2PrB6QfIG47XUiciXscy4ZHrhcTAydvA2rP+cHAROx3FGwrBT6PqK6SM8mBtoEGlp21uLOQ7dtYBsTU2Uf8A/E9Mb15AmliGpkGq8ajJOwZ6oCZ57FUD7ol0irdBRQwphouNSfJ0eVR7zN5zCeRpHHeKdKG1JJGa2+pR0A X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2018 20:40:05.1272 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8688568-32cc-4eec-334a-08d62b02bb6d 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: BN4PR12MB0739 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: nicolai.haehnle@amd.com, michel@daenzer.net, Christian.Koenig@amd.com, manasi.d.navare@intel.com, Alexander.Deucher@amd.com, Nicholas Kazlauskas , Marek.Olsak@amd.com 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 --- 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 5f488aa80bcd..e4eb2c897ff4 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