From patchwork Mon Aug 29 09:12:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 9303337 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 20C0D607F0 for ; Mon, 29 Aug 2016 09:33:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FC3F286E8 for ; Mon, 29 Aug 2016 09:33:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03EFF28716; Mon, 29 Aug 2016 09:33:20 +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 8A20028706 for ; Mon, 29 Aug 2016 09:33:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 27ADA6E4EA; Mon, 29 Aug 2016 09:33:18 +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-dm3nam03on0081.outbound.protection.outlook.com [104.47.41.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id 793A96E4EA for ; Mon, 29 Aug 2016 09:33:16 +0000 (UTC) Received: from BY2PR03CA079.namprd03.prod.outlook.com (10.141.249.52) by BLUPR0301MB2001.namprd03.prod.outlook.com (10.164.22.15) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9; Mon, 29 Aug 2016 09:17:20 +0000 Received: from BY2FFO11OLC008.protection.gbl (2a01:111:f400:7c0c::188) by BY2PR03CA079.outlook.office365.com (2a01:111:e400:2c5d::52) 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; Mon, 29 Aug 2016 09:17:20 +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 BY2FFO11OLC008.mail.protection.outlook.com (10.1.14.255) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Mon, 29 Aug 2016 09:17:17 +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 u7T9CLU4005066; Mon, 29 Aug 2016 02:12:30 -0700 From: Liu Ying To: Subject: [PATCH v2] drm/atomic-helper: Add NO_DISABLE_AFTER_MODESET flag support for plane commit Date: Mon, 29 Aug 2016 17:12:03 +0800 Message-ID: <1472461923-14364-1-git-send-email-gnuiyl@gmail.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131169358400838256; (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)(104016004)(110136002)(81156014)(15975445007)(61266001)(8676002)(11100500001)(2906002)(48376002)(305945005)(50466002)(8936002)(83322999)(4326007)(81166006)(68736007)(586003)(50226002)(47776003)(7846002)(73392002)(92566002)(356003)(86362001)(55446002)(82202001)(76482005)(5660300001)(19580405001)(19580395003)(87936001)(189998001)(77096005)(36756003)(5003940100001)(33646002)(626004)(97736004)(6260500002)(105596002)(50986999)(73972006)(87572001)(81442002)(229853001)(106466001)(2351001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0301MB2001; H:tx30smr01.am.freescale.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC008; 1:lia5EXi1/g0k8HXZ7HIm9BAqBTxBxqjSBzW1Gtw/wqb6CrJWMidXUY1WMfYcUvIbSy3lBpBuyObRCwSxEz9jPfe4T37xHrhis9AsfnXgXMdOHDgeK9u1QQgQDKFtwqWzsyec75WBOKVIxpSvUa5QD3DiPesCZkkwKpgh3gfNKCtVuq3HyxyhwMJqMPIRFiCaHvkO/rnrrZpK83aTgwA4Mgi6kdjhcc14ioOhvfyvFeuKr20Io+psQRlG5pXKJVQR1S4RKdLP4rzTTEy5vSm+jCOVTAFh7kltSV5vbJkdOgVI81v/+kpzEJ/3C1/fkcuO+aP54TVsX90BT+ls0qXaOcC3d4IpMjNxMVAfKC6mfwWU2oUmppF7xEqU3G8Hdh4MkP8Ia9TPxUIL+YJdcO7fiqhDX1b8btrnt4fHj/qqgPleevvfH1fPHN7jIh2Vky3/wa3Qv8qYs+n29L0B9ZMMqYbfFPySdTvAtIIPnZKIXi0tezghleWid0878TJLsjU6NBYT0Jsf1mi9Vqq7jyHux2XSIv1k1METERpGh3tIISZZZ2qblC3QJrSxwVKeVyHu0vW/+20vBrTlEwDyMFnycw== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 051f4a12-29ce-43bf-da70-08d3cfed475c X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB2001; 2:1zUOEgrvlwHlZ8TXFss2N5A42cWUsSaHmjrQmHmwscFZTb9N7uwCFv2/12G1hJzCPKYocsX2W1Xp1AZfKuEylJEsKNMiHP02MQCCQyzGTrQimSVbzVpG6w7zeph8/LlDIRDlxhvIJN6z59h1DA2X0Qur8TH87UXG+ti72z2+fPMbRP7IWMouG5xJVc/F0nOt; 3:csASH/QXz23FC8Rul140n3CpKlgRf6SX9cTNSwD5NRR/nwfGu87HkWXIQWoseqGfxc9O034wG5V6di0siSsMALwwYGaLpe7wnQ7AgVV0tNwbKcMamne9QwT92NUUBIVYCwoXFWnAUzxOXKAuE8lluzRzsuKTvJYX0YXlvJ70RUTIOaP3aLWrVWAc/pB5w2fwgtravMCz1mgo+goffTEeY+VuiPxzOxPc2DNb4qAJE/Y= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0301MB2001; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB2001; 25:CNnoJteWc+ky3Ed90/TVBEiAX0D+ieYsQ4tEbD5orjqrR6gggHcht/VZTo8kAhYif9D2e0Z0udMxvq2DAzdevTqnTWsV5Ok/ONqYbkWTibQhSnsceWb4XTN0KIOuu6LDMHD6yoGG2kTZts3k5otojb0FxjiDlJnzg8k8PXo8zFT2XuVu5NXxRCLmHIzKtWSY/XTuFoaFVUzOanwAwcclkez83FEysBgxyLm8v5b4NhIb4qJUpkMivF4rOavFaprDFkKO6huT0FgXlrjbReS+TLttNZMRsu1F9Sy2sERLqSgGWBxcJtIIR/rE+M3S3T0j5I5mO58hvhlfLKW32NKHp7MLXO1G0feWHgass/9D065JVuwG03fiGQVb7FPPFueDyMCUj1t9AHuaRqQmAOwkWKJMlniiif8hHofIK8Wykvb7VbbKDzveFWn0oVOo1Y4vHML0LdVhln3bA9ZG6BYqzcK5CJ9RPkk9yClhV1v9+y15tgJgfHG5OjoTMKvDYIby/FTVB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tl6Rr4N5OW9qOvXqJ0bcH8vMSvnAVWROaH77TK6H8FLQHT6NNnUMVTILvJBq5Bg03YlF X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(13015025)(13017025)(13024025)(13023025)(13018025)(10201501046)(3002001)(6055026); SRVR:BLUPR0301MB2001; BCL:0; PCL:0; RULEID:(400006); SRVR:BLUPR0301MB2001; X-Forefront-PRVS: 0049B3F387 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0301MB2001; 23:ypdJjMwSBjIRWjehnUVPP7h8zQmgR4MbErM9Rsu?= =?us-ascii?Q?aUINivJO0bkUpxFySWfgu3IRuMvskCukQuuB2FpTvf3C4qc1PcuNHsF9tjmI?= =?us-ascii?Q?3lNccGVjzb654upjVGpwx2V3fMJ52oxP6ZJh+9ToyA/4T3tQoNE1Qr8ELkme?= =?us-ascii?Q?aezMTZG+l4fMXAwgPhe9HJ8YGlu1/zDrDapWNkw3aLU9fJlP1SRjOzE0axJH?= =?us-ascii?Q?g8Z/VjSnFAzimZQqyAQBAADWrn9JMfEY3eG0qZgo9yfNTs4JtnL2lHj3pvmv?= =?us-ascii?Q?2xB1Q6/NOGVMjv/oigN5jeAA51h59lWBoc5WlM3HMGShgY0t65gazNhU73X0?= =?us-ascii?Q?t4XiMJb+Q2oY/KdLtsRKHrRGyRKyLCkCI5fy6DpT0QrDv3WpCdVNhjyRAV1S?= =?us-ascii?Q?vQ9nx4uusVKRYA4VfG03sQE1+I1tJqKJND+PmZnp0L/ETQ6jygzgqoki+xS7?= =?us-ascii?Q?VMXHkqlrFKTyB9thph5FeNitfnoze+MQCsF8NE7m4gyFh8lZR98c9Xlr4o8m?= =?us-ascii?Q?FmdcODrb5kNGLKPkbTiaTwERVdgRqBWawvsQ7UbZh6JDAiiLvZUlPFB7dCx5?= =?us-ascii?Q?U29Hpr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RvwmYa+leYVl+d/PGGVQj341XdIQX90TSNeOTRt3lyb3C7i4hWmsFJL3JmqatEx2nUYDKimTA4fgMIp/xreLMlGLiwM1Y=; 5:e24zk9zCbhtGQHTeKgSnFQ8Te2aewsukANWlv7GMjvmjLANoiO9dQ8/GlzEJUSZd/WwnU8NEv5R+Yf/Bz7y1iq0jF7lOhp13cidNkJj6c4sYFMNAyaSqyw+g/lGkqoNaVvEVl6uTtbze0RAH0C8sLBaqljcQ6hPuQvV/zeSeSbo=; 24:BYQfHa+sPz7cPwAwlalSWJiMifUxqUMqOF7h3/G+rVx4WZ4+5zILnNZFekQwkfCcTEn5uOSNl5mbp7oyjanDktgt5EvtSuyT0TzVq45whGY=; 7:m78+9hgGZOyv+TLrGTtc2GlRSb/u8mBZR1bFABdTB+Gur1ABtt8Ad5f7qwLE2IiVXAEOI8zRGgDGm+KogAyB+PEfVVs/K9dbNAWWXfnti0pnw+lvgTjIgFPOYU7fSKDR5V1qHIrDNCvkCVhTgYhqqiW2yEMq2d9iBbNpX81/JY9mkzUf+N+xvbRiFjTatCnPxUgPmQA/clzYF2OSTANQpaMo80b4Kh5fu0l+0/fHC7X57eIy93olFzKrISrvv0h3 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2016 09:17:17.4318 (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: BLUPR0301MB2001 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 Drivers may set the NO_DISABLE_AFTER_MODESET flag in the 'flags' parameter of the helper drm_atomic_helper_commit_planes() if the relevant display controllers(e.g., IPUv3 for imx-drm) require to disable a CRTC's planes when the CRTC is disabled. The helper would skip the ->atomic_disable call for a plane if the CRTC of the old plane state needs a modesetting operation. Of course, the drivers need to disable the planes in their CRTC disable callbacks since no one else would do that. 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 --- I choose to pick this patch from the patch set[1] so that I may address Daniel Vetter's comments conveniently by sending v2 for it alone. [1] http://www.spinics.net/lists/dri-devel/msg116491.html v1->v2: * Add a newline in the kernel-doc for drm_atomic_helper_commit_planes() to improve readability. * Remove unecessary check/warn on crtc_state before passing it over to drm_atomic_crtc_needs_modeset(). * Wrap plane_funcs->atomic_update with {} to make checkpatch happy. drivers/gpu/drm/arm/malidp_drv.c | 3 +- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 2 +- drivers/gpu/drm/drm_atomic_helper.c | 43 ++++++++++++++++++++-------- drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +- drivers/gpu/drm/imx/imx-drm-core.c | 3 +- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 6 ++-- drivers/gpu/drm/msm/msm_atomic.c | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 3 +- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 3 +- drivers/gpu/drm/sti/sti_drv.c | 2 +- drivers/gpu/drm/tegra/drm.c | 3 +- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +- drivers/gpu/drm/vc4/vc4_kms.c | 2 +- drivers/gpu/drm/virtio/virtgpu_display.c | 3 +- include/drm/drm_atomic_helper.h | 6 +++- 16 files changed, 59 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index 82171d2..c383d72 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -91,7 +91,8 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state) drm_atomic_helper_commit_modeset_disables(drm, state); drm_atomic_helper_commit_modeset_enables(drm, state); - drm_atomic_helper_commit_planes(drm, state, true); + drm_atomic_helper_commit_planes(drm, state, + DRM_PLANE_COMMIT_ACTIVE_ONLY); malidp_atomic_commit_hw_done(state); diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index d4a3d61..8e7483d 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c @@ -457,7 +457,7 @@ atmel_hlcdc_dc_atomic_complete(struct atmel_hlcdc_dc_commit *commit) /* Apply the atomic update. */ drm_atomic_helper_commit_modeset_disables(dev, old_state); - drm_atomic_helper_commit_planes(dev, old_state, false); + drm_atomic_helper_commit_planes(dev, old_state, 0); drm_atomic_helper_commit_modeset_enables(dev, old_state); drm_atomic_helper_wait_for_vblanks(dev, old_state); diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 5f82290..6fdd7ba 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1148,7 +1148,8 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks); * * drm_atomic_helper_commit_modeset_enables(dev, state); * - * drm_atomic_helper_commit_planes(dev, state, true); + * drm_atomic_helper_commit_planes(dev, state, + * DRM_PLANE_COMMIT_ACTIVE_ONLY); * * for committing the atomic update to hardware. See the kerneldoc entries for * these three functions for more details. @@ -1159,7 +1160,7 @@ void drm_atomic_helper_commit_tail(struct drm_atomic_state *state) drm_atomic_helper_commit_modeset_disables(dev, state); - drm_atomic_helper_commit_planes(dev, state, false); + drm_atomic_helper_commit_planes(dev, state, 0); drm_atomic_helper_commit_modeset_enables(dev, state); @@ -1678,7 +1679,7 @@ bool plane_crtc_active(struct drm_plane_state *state) * drm_atomic_helper_commit_planes - commit plane state * @dev: DRM device * @old_state: atomic state object with old state structures - * @active_only: Only commit on active CRTC if set + * @flags: flags for committing plane state * * This function commits the new plane state using the plane and atomic helper * functions for planes and crtcs. It assumes that the atomic state has already @@ -1698,25 +1699,34 @@ bool plane_crtc_active(struct drm_plane_state *state) * most drivers don't need to be immediately notified of plane updates for a * disabled CRTC. * - * Unless otherwise needed, drivers are advised to set the @active_only - * parameters to true in order not to receive plane update notifications related - * to a disabled CRTC. This avoids the need to manually ignore plane updates in + * Unless otherwise needed, drivers are advised to set the ACTIVE_ONLY flag in + * @flags in order not to receive plane update notifications related to a + * disabled CRTC. This avoids the need to manually ignore plane updates in * driver code when the driver and/or hardware can't or just don't need to deal * with updates on disabled CRTCs, for example when supporting runtime PM. * - * The drm_atomic_helper_commit() default implementation only sets @active_only - * to false to most closely match the behaviour of the legacy helpers. This should - * not be copied blindly by drivers. + * Drivers may set the NO_DISABLE_AFTER_MODESET flag in @flags if the relevant + * display controllers require to disable a CRTC's planes when the CRTC is + * disabled. This function would skip the ->atomic_disable call for a plane if + * the CRTC of the old plane state needs a modesetting operation. Of course, + * the drivers need to disable the planes in their CRTC disable callbacks + * since no one else would do that. + * + * The drm_atomic_helper_commit() default implementation doesn't set the + * ACTIVE_ONLY flag to most closely match the behaviour of the legacy helpers. + * This should not be copied blindly by drivers. */ void drm_atomic_helper_commit_planes(struct drm_device *dev, struct drm_atomic_state *old_state, - bool active_only) + uint32_t flags) { struct drm_crtc *crtc; struct drm_crtc_state *old_crtc_state; struct drm_plane *plane; struct drm_plane_state *old_plane_state; int i; + bool active_only = flags & DRM_PLANE_COMMIT_ACTIVE_ONLY; + bool no_disable = flags & DRM_PLANE_COMMIT_NO_DISABLE_AFTER_MODESET; for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) { const struct drm_crtc_helper_funcs *funcs; @@ -1760,10 +1770,19 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, /* * Special-case disabling the plane if drivers support it. */ - if (disabling && funcs->atomic_disable) + if (disabling && funcs->atomic_disable) { + struct drm_crtc_state *crtc_state; + + crtc_state = old_plane_state->crtc->state; + + if (drm_atomic_crtc_needs_modeset(crtc_state) && + no_disable) + continue; + funcs->atomic_disable(plane, old_plane_state); - else if (plane->state->crtc || disabling) + } else if (plane->state->crtc || disabling) { funcs->atomic_update(plane, old_plane_state); + } } for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) { diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 877d2ef..486943e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -105,7 +105,7 @@ static void exynos_atomic_commit_complete(struct exynos_atomic_commit *commit) atomic_inc(&exynos_crtc->pending_update); } - drm_atomic_helper_commit_planes(dev, state, false); + drm_atomic_helper_commit_planes(dev, state, 0); exynos_atomic_wait_for_commit(state); diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 438bac8..56dfc4c 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -193,7 +193,8 @@ static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state) drm_atomic_helper_commit_modeset_disables(dev, state); - drm_atomic_helper_commit_planes(dev, state, true); + drm_atomic_helper_commit_planes(dev, state, + DRM_PLANE_COMMIT_ACTIVE_ONLY); drm_atomic_helper_commit_modeset_enables(dev, state); diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 0e769ab..72c1ae4 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -70,13 +70,15 @@ static void mtk_atomic_complete(struct mtk_drm_private *private, * * drm_atomic_helper_commit_modeset_disables(dev, state); * drm_atomic_helper_commit_modeset_enables(dev, state); - * drm_atomic_helper_commit_planes(dev, state, true); + * drm_atomic_helper_commit_planes(dev, state, + * DRM_PLANE_COMMIT_ACTIVE_ONLY); * * See the kerneldoc entries for these three functions for more details. */ drm_atomic_helper_commit_modeset_disables(drm, state); drm_atomic_helper_commit_modeset_enables(drm, state); - drm_atomic_helper_commit_planes(drm, state, true); + drm_atomic_helper_commit_planes(drm, state, + DRM_PLANE_COMMIT_ACTIVE_ONLY); drm_atomic_helper_wait_for_vblanks(drm, state); diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index 4a8a6f1..5df252c 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -118,7 +118,7 @@ static void complete_commit(struct msm_commit *c, bool async) drm_atomic_helper_commit_modeset_disables(dev, state); - drm_atomic_helper_commit_planes(dev, state, false); + drm_atomic_helper_commit_planes(dev, state, 0); drm_atomic_helper_commit_modeset_enables(dev, state); diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 3dd78f2..e1cfba5 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -96,7 +96,7 @@ static void omap_atomic_complete(struct omap_atomic_state_commit *commit) dispc_runtime_get(); drm_atomic_helper_commit_modeset_disables(dev, old_state); - drm_atomic_helper_commit_planes(dev, old_state, false); + drm_atomic_helper_commit_planes(dev, old_state, 0); drm_atomic_helper_commit_modeset_enables(dev, old_state); omap_atomic_wait_for_completion(dev, old_state); diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index f03eb55..bd9c3bb 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -257,7 +257,8 @@ static void rcar_du_atomic_complete(struct rcar_du_commit *commit) /* Apply the atomic update. */ drm_atomic_helper_commit_modeset_disables(dev, old_state); drm_atomic_helper_commit_modeset_enables(dev, old_state); - drm_atomic_helper_commit_planes(dev, old_state, true); + drm_atomic_helper_commit_planes(dev, old_state, + DRM_PLANE_COMMIT_ACTIVE_ONLY); drm_atomic_helper_wait_for_vblanks(dev, old_state); diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index 55c5273..7ca8f34 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -233,7 +233,8 @@ rockchip_atomic_commit_tail(struct drm_atomic_state *state) drm_atomic_helper_commit_modeset_enables(dev, state); - drm_atomic_helper_commit_planes(dev, state, true); + drm_atomic_helper_commit_planes(dev, state, + DRM_PLANE_COMMIT_ACTIVE_ONLY); drm_atomic_helper_commit_hw_done(state); diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index f8311b2..7cd3804 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -178,7 +178,7 @@ static void sti_atomic_complete(struct sti_private *private, */ drm_atomic_helper_commit_modeset_disables(drm, state); - drm_atomic_helper_commit_planes(drm, state, false); + drm_atomic_helper_commit_planes(drm, state, 0); drm_atomic_helper_commit_modeset_enables(drm, state); drm_atomic_helper_wait_for_vblanks(drm, state); diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 755264d9d..4b9f1c7 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -57,7 +57,8 @@ static void tegra_atomic_complete(struct tegra_drm *tegra, drm_atomic_helper_commit_modeset_disables(drm, state); drm_atomic_helper_commit_modeset_enables(drm, state); - drm_atomic_helper_commit_planes(drm, state, true); + drm_atomic_helper_commit_planes(drm, state, + DRM_PLANE_COMMIT_ACTIVE_ONLY); drm_atomic_helper_wait_for_vblanks(drm, state); diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 3404d24..4405e4b 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -118,7 +118,7 @@ static int tilcdc_commit(struct drm_device *dev, drm_atomic_helper_commit_modeset_disables(dev, state); - drm_atomic_helper_commit_planes(dev, state, false); + drm_atomic_helper_commit_planes(dev, state, 0); drm_atomic_helper_commit_modeset_enables(dev, state); diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index 4ac894d..c1f65c6 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -44,7 +44,7 @@ vc4_atomic_complete_commit(struct vc4_commit *c) drm_atomic_helper_commit_modeset_disables(dev, state); - drm_atomic_helper_commit_planes(dev, state, false); + drm_atomic_helper_commit_planes(dev, state, 0); drm_atomic_helper_commit_modeset_enables(dev, state); diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index 4e192aa..7cf3678 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -338,7 +338,8 @@ static void vgdev_atomic_commit_tail(struct drm_atomic_state *state) drm_atomic_helper_commit_modeset_disables(dev, state); drm_atomic_helper_commit_modeset_enables(dev, state); - drm_atomic_helper_commit_planes(dev, state, true); + drm_atomic_helper_commit_planes(dev, state, + DRM_PLANE_COMMIT_ACTIVE_ONLY); drm_atomic_helper_commit_hw_done(state); diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 1abf2c0..f866828 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -65,9 +65,13 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, int drm_atomic_helper_prepare_planes(struct drm_device *dev, struct drm_atomic_state *state); + +#define DRM_PLANE_COMMIT_ACTIVE_ONLY BIT(0) +#define DRM_PLANE_COMMIT_NO_DISABLE_AFTER_MODESET BIT(1) + void drm_atomic_helper_commit_planes(struct drm_device *dev, struct drm_atomic_state *state, - bool active_only); + uint32_t flags); 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);