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:cQsvXRbah64kbyEIiQbGY17p9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x/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+PeZX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E5cblW+eHM2gcU8CH+Y4eCONYUaPNm3oOzqNBuegIWW0Tluj2ogtxcg94pk5FSM9Bgxf6+yX1J+ZPlAuvHVqLJMXzIoYOqqQ== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 20:5PtJfzlpI6qqsyJu3MPfYX3C+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