From patchwork Fri Aug 26 07:30:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 9300907 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1ADB3607D8 for ; Fri, 26 Aug 2016 07:31:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 100F029565 for ; Fri, 26 Aug 2016 07:31:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04A842956D; Fri, 26 Aug 2016 07:31:05 +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=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,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 2799829565 for ; Fri, 26 Aug 2016 07:31:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 21B8C6E18D; Fri, 26 Aug 2016 07:31:03 +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-co1nam03on0054.outbound.protection.outlook.com [104.47.40.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id A9B136E18D for ; Fri, 26 Aug 2016 07:31:01 +0000 (UTC) Received: from BLUPR0301CA0014.namprd03.prod.outlook.com (10.162.113.152) by BL2PR03MB1876.namprd03.prod.outlook.com (10.164.115.20) with Microsoft SMTP Server (TLS) id 15.1.403.16; Fri, 26 Aug 2016 07:30:58 +0000 Received: from BN1AFFO11FD051.protection.gbl (2a01:111:f400:7c10::144) by BLUPR0301CA0014.outlook.office365.com (2a01:111:e400:5259::24) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9 via Frontend Transport; Fri, 26 Aug 2016 07:30:58 +0000 Authentication-Results: spf=softfail (sender IP is 192.88.168.50) smtp.mailfrom=gmail.com; pengutronix.de; dkim=none (message not signed) header.d=none; pengutronix.de; dmarc=fail action=none header.from=gmail.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning gmail.com discourages use of 192.88.168.50 as permitted sender) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD051.mail.protection.outlook.com (10.58.53.66) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Fri, 26 Aug 2016 07:30:59 +0000 Received: from victor.ap.freescale.net (victor.ap.freescale.net [10.192.241.62]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u7Q7UqoY006560; Fri, 26 Aug 2016 00:30:56 -0700 From: Liu Ying To: Subject: [PATCH v4 1/7] drm/atomic-helper: Add atomic_disable CRTC helper callback Date: Fri, 26 Aug 2016 15:30:38 +0800 Message-ID: <1472196644-30563-2-git-send-email-gnuiyl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472196644-30563-1-git-send-email-gnuiyl@gmail.com> References: <1472196644-30563-1-git-send-email-gnuiyl@gmail.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131166702598868814; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(189002)(199003)(8936002)(2351001)(47776003)(68736007)(104016004)(2906002)(73972006)(7846002)(82202001)(36756003)(8676002)(586003)(229853001)(50986999)(575784001)(50226002)(86362001)(55446002)(189998001)(50466002)(61266001)(81156014)(87572001)(11100500001)(106466001)(77096005)(92566002)(76482005)(5003940100001)(97736004)(87936001)(33646002)(105596002)(356003)(73392002)(48376002)(305945005)(2950100001)(81166006)(19580405001)(5660300001)(626004)(6260500002)(19580395003)(4326007)(83322999)(76176999)(110136002)(81442002); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR03MB1876; H:tx30smr01.am.freescale.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD051; 1:T//AIFgiaRHd7X+VP5QTIv1v6rl47b4lFEcznfmj/6RA3kW1l474JAaoQx2ft85gTcENPLLfir9lFq9sbKr653hs+w2tZm9fD6J5efcPGg83gwZFBUoy3FcR2d2GLbo9G/e7FVhMrGYG5qS9q26iqlrS5gqimxPb+8DUCC3Pq8SKDe6/9gHRQJCqB+C1N3mAVgcTBVcDBumdIklBiA0iW116K+ddCLPvDrMgJL9Yqxey1twjiKfxWA4DBzPESoALy96tG/uV72ecTF05lcSZ/ZxycNMhBTic11ScxH7xb9cOkmaHzGJBfb+SGQnvxLWEQlNQ9X9HjREbxwtECahBp7ATiomHuTesAvkGsPo4LC3tCfW3Ehemsyfz7Eh/Qwhc28DehMjiOSVGXm5TdgQeq4tqERjTd7OcQ2FKKcEkhsYBCe8meaGjBJx+MxclQpldTeFbdtVohdcAmAx2Rfl6gxQD0e/ufEhDvuMRTU6Z0W/KEdd6+wsudlES8AWEyiWHuSpjSW2bF8pscKy7nscPp5DCFAZC9Uj1MvlvQvopPiZDio6gL2pm3HLukQGSMsvq+/SOWW70tAC1wSqnWngHaw== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: d82f1039-f204-496b-c456-08d3cd82ed27 X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB1876; 2:7fBogMGNZhLWb5kvzoI122Ms3DA6pZmcw85rDPtwlIIguF3SUOqeUDkkdoFc/W0yIHn8Q0oagzW+e7BHTVkke3VMf3ZUMyv10whVLxHtXDPPiu7qXhYPZx39qnMT40GND34X3AmOvRn55ltGAt98d0VROCy70HaeyI0WesTvJuS1Qxt6QkZCq5kthmYUPyWz; 3:EPNoaQJnNgaT9L+vh/45asYT0lQoRgBVxQEu2zhQ1N7kvombBtH/+eJyXLyfQ9JGjRV2bEISWbTBguYvZ8K7adop2h1hSyG/oQX4FRemtm+Now5RfNEpJ4I7vcIBJTzuALffKI8dtZrekUx08fHYf4LZ3MyucRwouRlRU+F2KCfXRR+fbjkwGhp+VDdXpwA+xOoXJKkF2Z0d1FdsAim7lTwONxyHzXSSCwQUyGs6cDE= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB1876; X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB1876; 25:jfkdkeXT9zyAB01Y0S0YrSB/NNeWrXMvguOZ7NbmbImBcdzTJGAfexmDdV3w1Ao/P7ets7yVwBKdNRpj95JDyihlcofO/2z/Ol/kULCwzH85Vk+gzU9jKYj5OpIrx9QuyUR1dqnqdeTr5WT2/UbS63nExj75GOzncqLAp+uRsXcp7VByH29IH4DdjzVTUYUAE4duZWCj4aLZDcgJJDbFP6Mqre3uzlQyiBFE5osU9TiDj4WObA+cgSZnPpIWnD1QpKv/VJURGMdIisnEi+gVFWY99RIkYaxodulCzyV8coWIAROjw/twwIxPzYDLwWKzG7VLQVQ6F7iic0s7ZqFZdQxoCU3aOcuhAC9itMDX6H/mz2RoEIyqjrFgWz4TfgYXBmZrvltVE/dahYOeoYcff5vv3NMxw4acv/TwN6454qeD1O5UIkzQm4BbMxewsF+Hq2SpgDIxs4VJOfRAo6wGq75WXjSXrZDnBtkILvsS4Ukz1+eluflK4UjxWTqYEvyXEtnSQuPgCMECOXXjMM9eOP0eYymwVZ6h6Jkqled/L8N/t/vbC7DltYoUqxP4Pk99 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13017025)(13018025)(13024025)(13023025)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:BL2PR03MB1876; BCL:0; PCL:0; RULEID:(400006); SRVR:BL2PR03MB1876; X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB1876; 4:yU76trcWQZytdvy2ERMXHtx0A6HyE5XbT72WT5FwcUFS1wP6flRMjmzXlD2mxhoDT8jB7z7mO3lWn8y137Zvz31x6seXN1r76IWEKSEaYrQSf8r6fjP9AicS14S0J9GCavCOOdCX4a7xfdB2JTyUg6NAr1OqOhCUJusjkRcEhFvC5nV8w513bSEw/4DYayU4LNgV5KMI/jUtY/VlZkZ6+yDDflAltJtL14511Yss6AE2ohXlr7BVK7s8XVawxkEx2vc912pDsdJV1iOskKHffyqTzsdt9rgEGp+AbsKbb9jOYElMHs/lteph615xNJbmw1/aEzc8LCazBz1w5xbin6IAWRNp5fhOVvPGA6INa1aOYY8Vmdt9BByj/p3E8q9wHIqtFVir/79SG+n5fjnJpWYs+DRp5XMSTj5UG2FJUs3Qd5T7USW2C7wqRnE6N215nMsM6EdZ/o96AHINLxUMOf213YXVeZZV4pZBxCCymlI= X-Forefront-PRVS: 00462943DE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR03MB1876; 23:iTVkT2f9dVBgG3FD9EqWcjnNanC67MEBqkSpZdp2D?= =?us-ascii?Q?pZoP7EsTzftd51EuX0DIbqEe4uRH7RwAsFpstb3MQiweMluYqBFAmF0fLLTD?= =?us-ascii?Q?BTgA5Exsrn+C8DKpBI0YIdMacllTLe2TRmDrkrB9QO3tXg4VgL/Wkv9WHVY+?= =?us-ascii?Q?xek+FZz7HdIJeiGIk1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ci7i/H8o7Ch5FkZ2?= =?us-ascii?Q?j6NPwnKonAEGWX1fjpyHf7lT95aKio4AYqY1eeKdpps1NnP9IvlcJmiOzGi3?= =?us-ascii?Q?nyt2FGneaMDpk2x0baDodSkB21OwGDdM1WaNu4UK7nebGvDLfTiiFLSl8FeY?= =?us-ascii?Q?3bqw6+uRtXllKZGlU695urNl9PkYwTampe82I4WnJgSauSZnqFAxfQYD5jLU?= =?us-ascii?Q?1wVIHzsQ6OXuICpn4sp8qULcwr8ewe+oSnDqPS/vosvaoYXxMujcdN9OHMXR?= =?us-ascii?Q?Bt/q251cYR1RidVXXdDID3YyeilhpOw1aH9w7pDBFPp?= X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB1876; 5:AWWztjL5vzMTIu5zrzlpEqQ1X7ZU44ElOJHHfM23R04ard2TjpWCr4GwxUvvAyYythEXwh6igmuJAdM6DhIps1ojpU2bl1e/tssdP4+NElcteAt42yYj1FhYHuNONJmsmO9ZzCjrxmz/Kau/6pEobr7RGNw3Zospg2XAE7J7zJw=; 24:wb21Dea+EbEVNV1KnqEp4ZufAQYchFoAc54EoVfDgkE3KCtRHj5/9iTJ7fRy0uIp/WKR+u0okeSAopE+MTKEj1nWzK4GrvsgeBxIe1sJunk= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2016 07:30:59.5748 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR03MB1876 Cc: Daniel Vetter , Peter Senna Tschudin , Russell King X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Some display controllers need plane(s) to be disabled together with the relevant CRTC, e.g., the IPUv3 display controller for imx-drm. This patch adds atomic_disable CRTC helper callback so that old_crtc_state(as a parameter of the callback) could be used to get the active plane(s) of the old CRTC state for disable operation. Suggested-by: Daniel Vetter Cc: Philipp Zabel Cc: David Airlie Cc: Russell King Cc: Peter Senna Tschudin Cc: Lucas Stach Signed-off-by: Liu Ying --- v3->v4: * Improve kernel-doc of CRTC's atomic_disable callback to address Daniel Vetter's comment. v3: * Newly introduced in v3. drivers/gpu/drm/drm_atomic_helper.c | 2 ++ include/drm/drm_modeset_helper_vtables.h | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 9abe0a2..254bdde 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -749,6 +749,8 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) /* Right function depends upon target state. */ if (crtc->state->enable && funcs->prepare) funcs->prepare(crtc); + else if (funcs->atomic_disable) + funcs->atomic_disable(crtc, old_crtc_state); else if (funcs->disable) funcs->disable(crtc); else diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h index 6c8d3da..10e449c 100644 --- a/include/drm/drm_modeset_helper_vtables.h +++ b/include/drm/drm_modeset_helper_vtables.h @@ -266,6 +266,8 @@ struct drm_crtc_helper_funcs { * disable anything at the CRTC level. To ensure that runtime PM * handling (using either DPMS or the new "ACTIVE" property) works * @disable must be the inverse of @enable for atomic drivers. + * Atomic drivers should consider to use @atomic_disable instead of + * this one. * * NOTE: * @@ -391,6 +393,28 @@ struct drm_crtc_helper_funcs { */ void (*atomic_flush)(struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state); + + /** + * @atomic_disable: + * + * This callback should be used to disable the CRTC. With the atomic + * drivers it is called after all encoders connected to this CRTC have + * been shut off already using their own ->disable hook. If that + * sequence is too simple drivers can just add their own hooks and call + * it from this CRTC callback here by looping over all encoders + * connected to it using for_each_encoder_on_crtc(). + * + * This hook is used only by atomic helpers. Atomic drivers don't + * need to implement it if there's no need to disable anything at the + * CRTC level. + * + * Comparing to @disable, this one provides the additional input + * parameter @old_crtc_state which could be used to access the old + * state. Atomic drivers should consider to use this one instead + * of @disable. + */ + void (*atomic_disable)(struct drm_crtc *crtc, + struct drm_crtc_state *old_crtc_state); }; /**