From patchwork Tue May 24 10:10:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 9133393 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 AA7B9607D7 for ; Tue, 24 May 2016 10:27:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A631B28233 for ; Tue, 24 May 2016 10:27:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AE8528258; Tue, 24 May 2016 10:27:49 +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]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F97328233 for ; Tue, 24 May 2016 10:27:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F2A706E708; Tue, 24 May 2016 10:27:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0080.outbound.protection.outlook.com [207.46.100.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id EBF3D6E707 for ; Tue, 24 May 2016 10:27:31 +0000 (UTC) Received: from BY2PR03CA001.namprd03.prod.outlook.com (10.255.93.18) by CY1PR0301MB1195.namprd03.prod.outlook.com (10.160.165.26) with Microsoft SMTP Server (TLS) id 15.1.492.11; Tue, 24 May 2016 10:11:36 +0000 Received: from BY2FFO11FD015.protection.gbl (10.255.93.4) by BY2PR03CA001.outlook.office365.com (10.255.93.18) with Microsoft SMTP Server (TLS) id 15.1.497.12 via Frontend Transport; Tue, 24 May 2016 10:11:36 +0000 Authentication-Results: spf=softfail (sender IP is 192.88.168.50) smtp.mailfrom=gmail.com; arm.linux.org.uk; dkim=none (message not signed) header.d=none; arm.linux.org.uk; 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 BY2FFO11FD015.mail.protection.outlook.com (10.1.14.131) with Microsoft SMTP Server (TLS) id 15.1.497.8 via Frontend Transport; Tue, 24 May 2016 10:11:35 +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 u4OABCM9024148; Tue, 24 May 2016 03:11:33 -0700 From: Liu Ying To: Subject: [PATCH 10/14] drm/atomic-helper: Disable planes when suspending Date: Tue, 24 May 2016 18:10:49 +0800 Message-ID: <1464084653-16684-11-git-send-email-gnuiyl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1464084653-16684-1-git-send-email-gnuiyl@gmail.com> References: <1464084653-16684-1-git-send-email-gnuiyl@gmail.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131085582952479576; (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)(2980300002)(189002)(199003)(9170700003)(81442002)(73392002)(4326007)(76482005)(1220700001)(47776003)(36756003)(73972006)(105596002)(61266001)(82202001)(5008740100001)(586003)(2906002)(48376002)(5003940100001)(19580395003)(19580405001)(110136002)(15650500001)(92566002)(87572001)(189998001)(2351001)(50986999)(229853001)(104016004)(6806005)(50466002)(106466001)(33646002)(8936002)(11100500001)(77096005)(2950100001)(81166006)(86362001)(50226002)(83322999)(76176999)(87936001)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1195; H:tx30smr01.am.freescale.net; FPR:; SPF:SoftFail; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD015; 1:MxNg6ntFO345DAuqsC17Q0w7wQIm45sHB5SWMwQ/3Yg6VR7UsVBD/1f4BPj3J17mFRk+4LewE5jpIb4DhnalEjBCAzgk1D+OthJwk/dz8sd+Z1QO2HCBnwGPGzLbsQMXxTV6khR5Socfad33R0bIz3CcVon4f7RLySxRqZW+yN8RFDryMqwEfDUoA9iz5ikM14zk1aPxB55UhrFzF7PsfX0rl4P06oe3fFtEBVESWeu3pwPnsNBqHXoWeWpnxClfIrx3fVbi2j6F5VeHfTZZnxjSwHcm66qkDV98r0ojhHgX+Zxuem/hDF4shOFmR18FXjOsqXeOq6ejmQyTz+dg4EIZPBtw9fgloE9RzN09QQkGgql88tuYbb1vrHcp2Pu1JgpYBOIxefMWHf6USYtiaLXw3zuL1Wqdkcqpi6VzCBzg2EkFlR01YsCtysZ/CF5Mh+Sek1Jd2WjMYhsk+gWpbkaNyG2s+12CwFqZDs6MJAUQArLRMLg7QPYgZlXoFjUv7BgwmJu4M4AfD0BwHa1dFZv9Bghx6yPuEbewhmNPaCS5PCJ3pvwiEVmDQBLKLOp3 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 7c9cf6f7-2197-40c0-bb58-08d383bbc985 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1195; 2:iHk2T+su4uNiOxisxLgCmOmuEefSWnq1GwixaWCDkSMV41HDTa/ZaagQH8khtwBUPQ+hF7vrsw0WmRSn3aGhPms3i4AW07oa7R/nhM+N/dzsnpQKmLCULKHla+LW74VKRiKP/hicerlSS4cyLCHo/Yxx9tigb/cOjTbYMd2wEBJQiRua5AB7RSx9dKwm0g3G; 3:9nCwmdOnoif2FaY8fYFu0E9wbHPKRZ1Ku94Pu75AWy7HRh/mqB2114e4dbn4GYHYNG/sRsI+Fy8VZGxoVvDZ6Ix2Zsmh6JaxYY1G+NTnESrpmMeQpmC6dbl/sIzBwkw+W/sejRw7shK0x3oNtU115KgEKiIHwUllbYylB8wr9omt/GR5ztyiQqEiMF8slcVnzEtPokSPfNLMz0Y4X7PWnraDyQl4Hp54YPZDtmYcJOM=; 25:65f0B9a0a4T8+c9V9frvRxpf5Aye9F6Z7YIIsG8J6hDcstKsumpseT4iyZUfAMcILfl+sIJ/QEPv9BGDlCgKqb3+H88Pd8qHGk9cHE135XvfEQqDcq9PmuLbIomePYT98Xn+TGDSzzQxto3yB6OH63sLM4Ilg7Ww7ghUVOImxXdZhmEeRQgtoLSOHYtgu53BYhP5QUuUXHH6xQUYvr02Blwvh2Q+jAul2yeMsp5h2Z5CXeyp4WlgcZ5/CjEh/tw5GNEmzHXIFpdnKblT7ZV7VasivQPzYBHrfrFvN7mSrtA6gWi0AxuvyJCQsz3cFTrdgu0A7/QVEYcD0BgL3XNT4vQNdMnHOCHASkGodyP+c8uA3r09vk0wc9SZMm5lcYEWZY2Ugk0qkXTE6pkdFDrAIEAthRaADUN6jlPi51x0Vi4= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1195; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(13023025)(13017025)(13018025)(13015025)(13024025)(5005006)(3002001)(10201501046)(6055026); SRVR:CY1PR0301MB1195; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1195; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1195; 4:FI9h6fMrMeUW9k3Xwso3Fn/VhtIKLJI5MpdvuC7rXbJHLYuk3za3LhVuMEJdoRnDVG6W3wjwrT4R8sxKaJADT0TCx97c1SPAGy2P32XlAgIScwBWrdByCjPDwZNMe9k4oMcJBR4FzuuiinxZQ84tjihz10bGljnOiGXiqMA7X1G0zneqI78QtZFymY/Sp0QPjl+Tln1IiMBYcHz3F83BPjZm1+msvjIKDisY0vZCAG+jCLa1PO75uAd6LI20V2t8K07z1lboSTcJa+87cHU+IJkdsr0D0eRWK0slNfTg61ynbhy+/ZxOT2EzivhUh5iWormGcBeHiksGNzIQpR5NdttQAZVHVUCiJT29J4/P2sUYliArGazHNiFyxFp/+2eRBcEwJeB8o7KZSvZ7maXn44MPIJROjMqOTAEtQpx6frdmLEwv+7Vmz2iHqxRqTKinLLIfaSlfIePzbgaALQ9KoWvIRjKlVth0GL1epohxJ5w= X-Forefront-PRVS: 09525C61DB X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1195; 23:feimdULMJCrTy+qeNsFT0ysdAnggVpBybXDXbuN?= =?us-ascii?Q?JSMn56ZDwO4c59GYtxphgUQGoBk2MPW2eEN/yKwaSFZAXNRW955gs0k4KWdM?= =?us-ascii?Q?GD/CeNLpu15Q7v/VzoBsmQipQX9QKv/DuDne6zn0sABBGeyY6hROx773q+Pb?= =?us-ascii?Q?CLimBnR1bUUScgxdO3+c7wdeNzpoNGe1a+3V1I+QF9itvHzCMdbJL1bt1bvd?= =?us-ascii?Q?kUGnFDoQIPUgZXGA01RKTkUHqVFsr+7HhDXBCxg/0BdmTHfSe18rQ61fNaaq?= =?us-ascii?Q?O/ivKuNl8b47vAKYqRTcFcIXUMjT38ZXsg7whkpqpBZPI/cOwyWKO3oIpyZZ?= =?us-ascii?Q?17sNB2KMmhkVMDUdf4iO6w3G/ovht21pzaEfsb/7GP1P4d2Nzyrj150/oavo?= =?us-ascii?Q?rOSEnfhcJqQ18aku6rz1ouIrb+05q/rOr+CxWWkO/n3UTf445XuP0mioibgA?= =?us-ascii?Q?eSmwcKePdOooMTcFqFxGsl35OK6HJVuz0S26f8+tDcs290l+DtMLGIL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rFAcm7R4I=; 24:YqEws2vjd8f/e6L4iLz6WFkmQzuw1mm/SFBToe3JidST9q9jI4dmvoArvz7HJydPr/uvXKBrdwJttYjsT0lLxDuMNxkjnoL09txgliIjNdk=; 7:XwPB5hPvrObW1cjIi4MdDQHkVtwhJaQJ3OdyQM43luwf6+txzSLbPNzBxVx+hZMhyXrSFhjc9F9dRgZ90tds8ZzWvFzx0AvbnDLXCL3ioz7aBBKH4Jvul5HXsyHja4FhsnTOxl6f3ANzPn92wUbE2+r3jULRf6iqTrJ6k9HLuksvNu4KW/+58BzIzykuE88R SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2016 10:11:35.0607 (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: CY1PR0301MB1195 Cc: 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 We should disable planes explicitly when suspending. Especially, this is meaningful for those display controllers which don't support active planes without relevant CRTCs being enabled. Signed-off-by: Liu Ying --- drivers/gpu/drm/drm_atomic_helper.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 4befe25..5331d95 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1967,7 +1967,7 @@ commit: * * Loops through all connectors, finding those that aren't turned off and then * turns them off by setting their DPMS mode to OFF and deactivating the CRTC - * that they are connected to. + * that they are connected to. The relevant planes are deactivated as well. * * This is used for example in suspend/resume to disable all currently active * functions when suspending. @@ -1997,6 +1997,7 @@ int drm_atomic_helper_disable_all(struct drm_device *dev, drm_for_each_connector(conn, dev) { struct drm_crtc *crtc = conn->state->crtc; struct drm_crtc_state *crtc_state; + struct drm_plane *plane; if (!crtc || conn->dpms != DRM_MODE_DPMS_ON) continue; @@ -2008,6 +2009,21 @@ int drm_atomic_helper_disable_all(struct drm_device *dev, } crtc_state->active = false; + + drm_for_each_plane_mask(plane, dev, crtc_state->plane_mask) { + struct drm_plane_state *plane_state; + + plane_state = drm_atomic_get_plane_state(state, plane); + if (IS_ERR(plane_state)) { + err = PTR_ERR(plane_state); + goto free; + } + + err = drm_atomic_set_crtc_for_plane(plane_state, NULL); + if (err != 0) + goto free; + drm_atomic_set_fb_for_plane(plane_state, NULL); + } } err = drm_atomic_commit(state);