From patchwork Fri Aug 26 07:30:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 9300951 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 79BC4607F0 for ; Fri, 26 Aug 2016 08:02:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C4F82959F for ; Fri, 26 Aug 2016 08:02:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 602BE295A1; Fri, 26 Aug 2016 08:02:55 +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 D1A1C2959F for ; Fri, 26 Aug 2016 08:02:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3746F6E018; Fri, 26 Aug 2016 08:02:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0042.outbound.protection.outlook.com [104.47.41.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 099866E018 for ; Fri, 26 Aug 2016 08:02:53 +0000 (UTC) Received: from BN6PR03CA0066.namprd03.prod.outlook.com (10.173.137.28) by SN2PR03MB1886.namprd03.prod.outlook.com (10.164.114.146) with Microsoft SMTP Server (TLS) id 15.1.434.16; Fri, 26 Aug 2016 07:31:01 +0000 Received: from BN1AFFO11FD018.protection.gbl (2a01:111:f400:7c10::178) by BN6PR03CA0066.outlook.office365.com (2603:10b6:404:4c::28) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.9 via Frontend Transport; Fri, 26 Aug 2016 07:31:01 +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 BN1AFFO11FD018.mail.protection.outlook.com (10.58.52.78) 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:31:02 +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 u7Q7UqoZ006560; Fri, 26 Aug 2016 00:30:59 -0700 From: Liu Ying To: Subject: [PATCH v4 2/7] drm/atomic-helper: Disable appropriate planes in disable_planes_on_crtc() Date: Fri, 26 Aug 2016 15:30:39 +0800 Message-ID: <1472196644-30563-3-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: 131166702623616591; (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)(68736007)(105596002)(6260500002)(83322999)(19580395003)(2906002)(77096005)(106466001)(92566002)(2351001)(19580405001)(229853001)(8936002)(81166006)(50226002)(86362001)(48376002)(36756003)(55446002)(73972006)(76176999)(626004)(87572001)(50986999)(81442002)(104016004)(87936001)(5003940100001)(73392002)(97736004)(76482005)(110136002)(4326007)(33646002)(82202001)(50466002)(305945005)(7846002)(11100500001)(8676002)(47776003)(356003)(189998001)(61266001)(2950100001)(81156014)(5660300001)(586003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB1886; H:tx30smr01.am.freescale.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD018; 1:hkK4RrCu/OA6C1lJ5wPZJtesKL66lHYd/8T0XPG0OZuymkEIlfkSR9sgAHdBcMLwXszflsFhIoGDNu3Xm90MMxJCGW+PLoPGcn3lIjxT8rMnnTGG1NBn1dneIHpNvIS1TO6/OAEUUJC1J9Au3wxYnu+lRvZBfWKnHd9khAuQUVNwTpv3RqcLE1v5MTIbppAhhQLKAb0GiLZ1FSszYnq4yekmgQDWJyzRkvjfwfsZky9wwo137EKbXoqVn9LKnY5BBjmwSTd5jIpZ0T1wn4vWYG1Ta4q+bQ1iSFtGDD6UtwSQUVlAm8UknXn/AUGEFYNbXZNEyYrGPibR/LCkVdaaOY8TdITtSnNGZYWESPAFuSmzqBQx8D8mdsMFxbBF7rrlFG1dLCIynT8hoqCGGaKh/tmGdsVQlO4HD+cXJM97wW6ywwXFHT6P6fErpsIT8orbURv6sFn7c8F29OijKPpo8dz7ytCV0HprOF+rO+wx+fYZtJJkouHtWujgCLobf1VynwUMc9NigHW5o0cO2MDfiLbCdhx+cSSE0QC5doZnChyDCmY00BMCo5zzaBgJ/cBgi5G78iaHevNgmMYVh9bo+A== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: c739092b-3511-4d52-634f-08d3cd82eea1 X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB1886; 2:fNwksQMO+WfaU8N3FIAjg1fhAaioO8t62XYCvoHHIjMDzY3iwLoN4pHdtCTmmDbrU+I1+GWSQFWMSIKecReRwhiHiwTeLZXcRSwREmpCDOa3zHnaz5aITUkMVKqFuc2t03hv/8YD+fFBIczKJIQbdcRxevUmIxCkQpRMxu/5Mqgwqk8uVA6v4KslO0e9MEVN; 3:gt/2ZDoR+1xwihyhdzd0wwYU8sra6/POUbGkzf7moeiMttMQen3Gxo5WMw4PhyExo7FG5HiNFREZm3Ftd9a85aOYNd84kgWki5VB/Gxjb/A8+V6lfKlUrk8OG/EmbKvX7LqRwLOsPdqsZrCoGKxTxFJzCXVjSjY6cjyQtxJSXV8kB69D/URZlz20YBvTJfNF0r+SFTVBF22rqBXLMTRw9TmP8xz/elgaQmkegp0wnko=; 25:V1RCz5JB5tlyWJ0ftDDboZGiEjMg9Q57nq9WHGw2HXgbjIuQpZ8LcftXIVvH029PB/OaXUWC4gQnW23v7TMZQ1ULvmWFtDLRf5oirSSOPltYaPoPsVI09XHAITrnn3vqXROIArALYYIiEH+Ksvld/77cNi/vBQcxzgVztG76hat+/ShaghvyblXMlhsgqn3Jw8gcM1yZ/YH4w2jVvH/YcZUpk+xHiPkiMVypZbzEq13gdbXIp0edWMsBr0gvtZu5 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN2PR03MB1886; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13024025)(13023025)(13017025)(13018025)(13015025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:SN2PR03MB1886; BCL:0; PCL:0; RULEID:(400006); SRVR:SN2PR03MB1886; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB1886; 4:x9c1aiHxGLVS4rqBP0kiImr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38syDKwr3o=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB1886; 5:EHND3MCTm1labUF3G0Q/kegWCNHdiniuyfXaTDFw0QQjZDn/ek7w6554ZZPbWZWAbSGNUziv4XlLUflfcT2XAmVZPqp4IdLpBEr4OMnDOv7bYkAJ/42vnqR+Yks+QsI61UNxNAtzHH0fLgvmCPrRYDRp54x+keQWTAzboxx0eM0=; 24:VilD6gm/oLrsQeqiWZmDxEd3jwNHMr/v2g34sBO22Q3pCl6gIlI/3ypMNMhK7YEu10LBBaZj5Nmd8Yx5zaNKwLyVOi0nIIPMbwwBs+QNYCg= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2016 07:31:02.0496 (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: SN2PR03MB1886 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 Currently, the helper drm_atomic_helper_disable_planes_on_crtc() calls ->atomic_disable for all planes _to be_ enabled on a particular CRTC. This is obviously wrong for those planes which are not scanning out frames when the helper is called. Instead, it's sane to disable active planes of old_crtc_state in the helper. 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 --- v4: * Newly introduced in v4. drivers/gpu/drm/drm_atomic_helper.c | 16 +++++++++------- include/drm/drm_atomic_helper.h | 5 +++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 254bdde..30c52a8 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1842,12 +1842,12 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc); /** * drm_atomic_helper_disable_planes_on_crtc - helper to disable CRTC's planes - * @crtc: CRTC + * @old_crtc_state: atomic state object with the old CRTC state * @atomic: if set, synchronize with CRTC's atomic_begin/flush hooks * * Disables all planes associated with the given CRTC. This can be - * used for instance in the CRTC helper disable callback to disable - * all planes before shutting down the display pipeline. + * used for instance in the CRTC helper atomic_disable callback to disable + * all planes. * * If the atomic-parameter is set the function calls the CRTC's * atomic_begin hook before and atomic_flush hook after disabling the @@ -1856,9 +1856,11 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc); * It is a bug to call this function without having implemented the * ->atomic_disable() plane hook. */ -void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc, - bool atomic) +void +drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc_state *old_crtc_state, + bool atomic) { + struct drm_crtc *crtc = old_crtc_state->crtc; const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; struct drm_plane *plane; @@ -1866,11 +1868,11 @@ void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc, if (atomic && crtc_funcs && crtc_funcs->atomic_begin) crtc_funcs->atomic_begin(crtc, NULL); - drm_for_each_plane(plane, crtc->dev) { + drm_atomic_crtc_state_for_each_plane(plane, old_crtc_state) { const struct drm_plane_helper_funcs *plane_funcs = plane->helper_private; - if (plane->state->crtc != crtc || !plane_funcs) + if (!plane_funcs) continue; WARN_ON(!plane_funcs->atomic_disable); diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 5a02e49..1abf2c0 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -71,8 +71,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, void drm_atomic_helper_cleanup_planes(struct drm_device *dev, struct drm_atomic_state *old_state); void drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state); -void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc, - bool atomic); +void +drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc_state *old_crtc_state, + bool atomic); void drm_atomic_helper_swap_state(struct drm_atomic_state *state, bool stall);